summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
Diffstat (limited to 'functions')
-rw-r--r--functions67
1 files changed, 57 insertions, 10 deletions
diff --git a/functions b/functions
index d3ddfa2..8e66f39 100644
--- a/functions
+++ b/functions
@@ -142,14 +142,21 @@ function cscope(){
142 #/usr/bin/cscope -d -f $(readlink -f (../)#cscope.out) [email protected] 142 #/usr/bin/cscope -d -f $(readlink -f (../)#cscope.out) [email protected]
143 file=$(readlink -f (../)#cscope.out) 143 file=$(readlink -f (../)#cscope.out)
144 [[ $? != 0 ]] && return 1 144 [[ $? != 0 ]] && return 1
145 pushd $file:h 145 pushd -q $file:h
146 /usr/bin/cscope -d -p 4 [email protected] 146 /usr/bin/cscope -d -p 4 [email protected]
147} 147}
148function dmode(){ 148function dmode(){
149 unset CC CXX 149 if [[ $DMODE == 0 ]];then
150 export CFLAGS="-march=native -O0 -pipe -g" 150 unset CC CXX
151 export CXXLAGS="-march=native -O0 -pipe -g" 151 export CFLAGS="-march=native -O0 -pipe -g -Wall"
152 unset LDFLAGS 152 export CXXFLAGS="-march=native -O0 -pipe -g -Wall"
153 unset LDFLAGS
154 echo "Switching to debug mode"
155 else
156 eval "export `grep -E \"^(CFLAG|CXX|LDF|MAKEF)\" /etc/makepkg.conf | tr '\n' ' '`"
157 export CC=colorgcc
158 echo "Switching to normal mode"
159 fi
153} 160}
154function cscore() 161function cscore()
155{ 162{
@@ -418,7 +425,18 @@ fi
418} 425}
419 426
420comcache(){ 427comcache(){
421 export PATH="/usr/lib/ccache/bin/:$PATH" 428 if [[ $CC == clang || $CXX == clang++ ]];then
429 CC="ccache clang -Qunused-arguments -fcolor-diagnostics"
430 CXX="ccache clang++ -Qunused-arguments -fcolor-diagnostics"
431 else
432 [[ ! $CC == ccache* ]] && CC="ccache gcc"
433 [[ ! $CXX == ccache* ]] && CXX="ccache g++"
434 fi
435 #projdir=$PWD
436 #path=(/usr/lib/ccache/bin/ $path)
437 export CC
438 export CXX
439 #export CCACHE_DIR="$HOME/.ccache/cache/$projdir"
422} 440}
423 441
424ad2que(){ 442ad2que(){
@@ -542,7 +560,7 @@ function lsnew () {
542 else 560 else
543 lsnew_glob=$1 561 lsnew_glob=$1
544 fi 562 fi
545 ls -tr -dl $~lsnew_glob(om[1,30]) 563 ls -tr -dl $~lsnew_glob(oc[1,30])
546} 564}
547alias lsnew='noglob lsnew' 565alias lsnew='noglob lsnew'
548 566
@@ -591,11 +609,17 @@ function {news,mutt,ncm,weechat,weechat-curses,newsbeuter,ncmpcpp,atop,rtorrent,
591# $muxaliases[$app] [email protected] 609# $muxaliases[$app] [email protected]
592# fi 610# fi
593} 611}
612function recflag(){
613 eval "export `grep -E \"^(CFLAG|CXX|LDF|MAKEF)\" /etc/makepkg.conf | tr '\n' ' '`"
614}
594 615
595function btime(){ 616function btime(){
617 # Needs some work
596 stat -f $1 | /bin/grep -q ext || return 1 618 stat -f $1 | /bin/grep -q ext || return 1
597 mnt=$(stat --format %m $1 | xargs -I {} grep {} /proc/mounts | awk '{ print $1 }') 619 mntdir=$(stat --format %m $1)
598 debugfs -R "stat $1" $mnt | /bin/grep crtime 620 mnt=$(grep $mntdir /proc/mounts | awk '{ print $1 }')
621 dir=$(sed -e "s#$mntdir/\(.*\)#\1#" <<< $PWD)
622 debugfs -R "stat $dir/$1" $mnt |& /bin/grep crtime
599} 623}
600 624
601function {reboot,sdown} { 625function {reboot,sdown} {
@@ -609,13 +633,36 @@ function {reboot,sdown} {
609 fi 633 fi
610} 634}
611startx(){ 635startx(){
612 /usr/bin/startx -- [email protected] &>|~/logs/X.log 636 bfs=$(dmesg | /bin/grep BFS)
637 if [[ -n $bfs ]];then
638 schedtool -I -e /usr/bin/startx -- [email protected] &>|~/logs/X.log
639 else
640 /usr/bin/startx -- [email protected] &>|~/logs/X.log
641 fi
613} 642}
614 643
615viewjson(){ 644viewjson(){
616 python -mjson.tool < $1 645 python -mjson.tool < $1
617} 646}
618 647
648pacsync(){
649 sudo pacman -Sy
650}
651
652update(){
653 sudo pacman -Su
654}
655
656slob(){
657 if [[ $# > 1 ]];then
658 pattern=${(pj:|:)@}
659 pattern="*.($pattern)(Oc[1,-1])"
660 eval print -lc $pattern
661 else
662 print -lc *.$1(Oc[1,-1])
663 fi
664}
665
619viewlite(){ 666viewlite(){
620 sqlite3 $1 .dump 667 sqlite3 $1 .dump
621} 668}