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
@@ -139,20 +139,27 @@ function genscope(){
/usr/bin/cscope -b -R -q -k
}
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()
{
curl -s -e "http://www.google.com" -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1" "http://livechat.rediff.com:80/sports/score/score.txt"
}
@@ -415,13 +422,24 @@ else
done
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(){
trap 'break' INT
local tset
local input
@@ -539,13 +557,13 @@ dlink(){
function lsnew () {
if [[ $1 = "" ]]; then
lsnew_glob="*"
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'
#function {news,mutt,ncm,vim,weechat,weechat-curses,newsbeuter,ncmpcpp,atop,rtorrent,torrent} {
@@ -588,17 +606,23 @@ function {news,mutt,ncm,weechat,weechat-curses,newsbeuter,ncmpcpp,atop,rtorrent,
fi
# if [[ -n $1 ]];then
# $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} {
typeset -A map
map=(sdown '/sbin/shutdown -h now' reboot 'command reboot')
command=$0
@@ -606,19 +630,42 @@ function {reboot,sdown} {
if read -q;then
~/bin/down
eval "$=map[$command]"
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
}
function isitdown(){
dlink http://www.downforeveryoneorjustme.com/$1 | /bin/grep "you"
}