summaryrefslogtreecommitdiffstats
path: root/functions
Side-by-side diff
Diffstat (limited to 'functions') (more/less context) (ignore whitespace changes)
-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(){
#/usr/bin/cscope -d -f $(readlink -f (../)#cscope.out) [email protected]
file=$(readlink -f (../)#cscope.out)
[[ $? != 0 ]] && return 1
- pushd $file:h
+ pushd -q $file:h
/usr/bin/cscope -d -p 4 [email protected]
}
function dmode(){
- unset CC CXX
- export CFLAGS="-march=native -O0 -pipe -g"
- export CXXLAGS="-march=native -O0 -pipe -g"
- unset LDFLAGS
+ if [[ $DMODE == 0 ]];then
+ unset CC CXX
+ export CFLAGS="-march=native -O0 -pipe -g -Wall"
+ export CXXFLAGS="-march=native -O0 -pipe -g -Wall"
+ unset LDFLAGS
+ echo "Switching to debug mode"
+ else
+ eval "export `grep -E \"^(CFLAG|CXX|LDF|MAKEF)\" /etc/makepkg.conf | tr '\n' ' '`"
+ export CC=colorgcc
+ echo "Switching to normal mode"
+ fi
}
function cscore()
{
@@ -418,7 +425,18 @@ fi
}
comcache(){
- export PATH="/usr/lib/ccache/bin/:$PATH"
+ if [[ $CC == clang || $CXX == clang++ ]];then
+ CC="ccache clang -Qunused-arguments -fcolor-diagnostics"
+ CXX="ccache clang++ -Qunused-arguments -fcolor-diagnostics"
+ else
+ [[ ! $CC == ccache* ]] && CC="ccache gcc"
+ [[ ! $CXX == ccache* ]] && CXX="ccache g++"
+ fi
+ #projdir=$PWD
+ #path=(/usr/lib/ccache/bin/ $path)
+ export CC
+ export CXX
+ #export CCACHE_DIR="$HOME/.ccache/cache/$projdir"
}
ad2que(){
@@ -542,7 +560,7 @@ function lsnew () {
else
lsnew_glob=$1
fi
- ls -tr -dl $~lsnew_glob(om[1,30])
+ ls -tr -dl $~lsnew_glob(oc[1,30])
}
alias lsnew='noglob lsnew'
@@ -591,11 +609,17 @@ function {news,mutt,ncm,weechat,weechat-curses,newsbeuter,ncmpcpp,atop,rtorrent,
# $muxaliases[$app] [email protected]
# fi
}
+function recflag(){
+ eval "export `grep -E \"^(CFLAG|CXX|LDF|MAKEF)\" /etc/makepkg.conf | tr '\n' ' '`"
+}
function btime(){
+ # Needs some work
stat -f $1 | /bin/grep -q ext || return 1
- mnt=$(stat --format %m $1 | xargs -I {} grep {} /proc/mounts | awk '{ print $1 }')
- debugfs -R "stat $1" $mnt | /bin/grep crtime
+ mntdir=$(stat --format %m $1)
+ mnt=$(grep $mntdir /proc/mounts | awk '{ print $1 }')
+ dir=$(sed -e "s#$mntdir/\(.*\)#\1#" <<< $PWD)
+ debugfs -R "stat $dir/$1" $mnt |& /bin/grep crtime
}
function {reboot,sdown} {
@@ -609,13 +633,36 @@ function {reboot,sdown} {
fi
}
startx(){
- /usr/bin/startx -- [email protected] &>|~/logs/X.log
+ bfs=$(dmesg | /bin/grep BFS)
+ if [[ -n $bfs ]];then
+ schedtool -I -e /usr/bin/startx -- [email protected] &>|~/logs/X.log
+ else
+ /usr/bin/startx -- [email protected] &>|~/logs/X.log
+ fi
}
viewjson(){
python -mjson.tool < $1
}
+pacsync(){
+ sudo pacman -Sy
+}
+
+update(){
+ sudo pacman -Su
+}
+
+slob(){
+ if [[ $# > 1 ]];then
+ pattern=${(pj:|:)@}
+ pattern="*.($pattern)(Oc[1,-1])"
+ eval print -lc $pattern
+ else
+ print -lc *.$1(Oc[1,-1])
+ fi
+}
+
viewlite(){
sqlite3 $1 .dump
}