# -*-sh-*-

# old
# alias i=ipcs
# alias j=joe
alias D=exit
alias L='ls -lC --color=yes  --ignore-backups --human-readable |l '


# --exclude-script /linux/1/x/activity/mirrordir/dontbackup
alias mirrordir="mirrordir  -i --exclude-regexp '^.*~$'"

alias mirrordirr="=mirrordir --exclude-regexp '^.*~$'"
#alias mmirrordir='mirrordir --num-backups \'~%d~\'  --exclude-regexp \'^.*~\$\''

# i keep max 100 versions
alias copyd="copydir --num-backups 100"




alias copydir="copydir --exclude-regexp '^.*~$'  --num-backups '~%d~'"


alias xtree="xwininfo -root -children"


alias 12="fbset 12; czb"
alias 10="fbset 10; czb"
alias 11="fbset 11; czb"


# kernel problems ... solved

# Reset (frustration with HW)
alias reset_sound='rmmod  sb; rmmod  mpu401 ;rmmod  uart401; rmmod  sound; rmmod  soundcore'
alias reset_asound='rmmod  snd-pcm-oss;rmmod  snd-mixer-oss ; rmmod  snd-pcm1-oss;snd-card-cs4232; rmmod snd-cs4232;rmmod snd-cs4231 ;rmmod snd-cs4236 ;snd-card-emu10k1;snd-emu10k1;rmmod  snd-mpu401-uart; rmmod  snd-midi; rmmod  snd-sb16-csp; rmmod  snd-sb16-dsp; rmmod  snd-pcm1; rmmod  snd-pcm; rmmod  snd-timer; rmmod  snd-mixer; rmmod  snd-hwdep; rmmod  snd; rmmod  snd-opl3'
alias reset_scsi='rmmod  sr_mod; rmmod cdrom; rmmod sg'
alias reset_kbd=". /etc/rc.d/rc.kbd"
alias reset_ide='rmmod  ide-disk; rmmod  ide-probe-mod; rmmod ide-probe; rmmod ide-mod'
alias reset_usb='rmmod  scanner; rmmod  uhci;rmmod   usb-uhci; umount  /proc/bus/usb/; rmmod   usbcore; sleep 3;  modprobe   usbcore; mount /proc/bus/usb/;  modprobe   usb-uhci; modprobe scanner'

alias hd_longer='/sbin/hdparm  -S 50   /dev/hd'
alias hd_a="/sbin/hdparm    -d1 -u1 -c1  -m16 -r1  -a16 -k1  -K1  /dev/hda"
alias hdparm_all='foreach  disk (/proc/ide/hd?) { /sbin/hdparm -C  /dev/${disk#/proc/ide/} }'


alias llmod='ls modprobe depmod insmod'
alias mod=modprobe
# alias insm=insmod
alias lsm=lsmod
alias lsmodd="lsmod | awk ''{print \$1}' | tr '\n' ' ';echo"

alias insmod-all="foreach file (*(.)) {insmod $file}"



# found useless:
alias fgrep="find | grep "
alias fe="find -exec \\\{\\\} \\\;"

alias rd="remount /disk/"
alias mn="mount"

alias update_preference="mirrordir -v $preference_dir /linux/1/$preference_dir"


# work-arounds
alias route-mobil='route del default gw 192.168.2.2;route add default ppp0'
alias route-wire='if ifconfig ppp0 >& /dev/null; then route del default ppp0;fi; route add default gw 192.168.2.2;'



alias monitor="~/gauche/fs/monitor.scm ~/mail/misc   ~/mail/xfree86/devel  ~/mail/xorg ~/mail/sf  ~/mail/ebay ~/mail/scheme/gauche"






## CVS
# autoconf &&  automake && aclocal
# automake
alias cvs_build='aclocal && autoconf'

alias cvs_init='cvs import -m "" ./.  maruska start'

mkdir -p /tmp/cvs_log/
# What is better ??
if [ ! -z "$ZSH_VERSION" ]; then
alias -g  mycvsfile="/tmp/cvs_log/$$ "
export mycvsfile="/tmp/cvs_log/$$ "
alias cvu="(nice -n10 cvs update -d 2>&1 | grep -v -E '^\?' |& tee mycvsfile)"
alias cvur="(nice -n10 cvs update -d 2>&1 | grep -v -E '^\?' |& tee mycvsfile; say \"cvs update finished\" &)"
alias cvu_conflicts="/usr/bin/grep -E '^C ' mycvsfile| sed -e 's/^C //'|xargs rm"
fi

alias cvo="cvs commit -m ''"
alias cvs_subdirs='foreach dir (*(/)) { pushd .; cd $dir; cvs update; popd}'
alias cvs_ch='$sd/cvs/change.scm /linux/3/usr/local/cvsroot /x/cvsroot  CVS/Root'
# alias cvsz="cvs update -d &> zapis &"



## X

# $HOSTNAME
# xlog_file= ~/.startx.log.$HOSTNAME
# -dpi 115

#XLOG=/local/${LOGNAME}/.startx.log.$HOSTNAME
#mkdir -p $(dirname $XLOG)
XLOG=~/local/1
XLOG=/dev/null

alias sx="startx  >> $XLOG   2>&1"
alias sxl="startx -dpi 115  |& flog -t $XLOG"
alias lx="lg -f $XLOG"
alias tx="T $XLOG"



##  email
alias F=from
alias mkd=mkdir
alias mdk=mkd
alias P="wwwoffle -on;sendmail -q -v; wwwoffle -fetch; fetchmail"




#alias lls="lynx \!INDEX.html"
alias mz="zapis=zapis; (time nice -n 10 make &> \$zapis ; ring; say \"compilation is over\") &  sleep 1;tail -f \$zapis"
alias mring="m dep &&  m bzImage && m modules ;  ring"
alias mq=mailq

alias mrm="postsuper -h ALL deferred"




alias lbl="/internet/links/lynx2links/lynx2links -links .links/bookmarks -lynx"
alias O='wwwoffle -off; ppp-off'




#alias proc_dir='ll -d /proc/[0-9]*/cwd; ll /proc/[0-9]*/fd/; cat /proc/[0-9]*/maps'

alias ahoj="pwd"

alias find_grep="find . -type f -print0 | xargs -0 -e grep -n -e"
alias find_chmod='find . -exec chgrp html \\{\\} \\;  -exec chmod g+wr \\{\\} \\;'
alias find_chown='find -exec chown mmc \\{\\}  \\;'




alias r="rsh linux1"
alias mls="my_less"
alias mcm="my_cmd"
alias mca="my_cat"


alias initdb="export LC_COLLATE=\"C\" && initdb"

alias icq='licq -b ~/.licq.alt'
alias  GETMAR="GET -e 'http://www.ruska.it/'"
alias lf=lftp
alias mmp=mempeak



# rsh
function rl  (){
    case $1 in
	toshiba)
	    host=$1
	    ;;
	*)
	    host=linux$1
    esac
    name=`zsh-expand $2`
    program=rsh
    if [ $host = linux3 -o $host = linux2 -o  $host = toshiba  -o $host = linux9 -o $host = linux7 \
	-o $host = linux8  -o $host = linux9  -o $host = linux10  -o $host = linux1 -o $host = linux12 ];
    then
	program=ssh
    fi
    $program  -l $name  $host
}


function rl  (){
    case $1 in
	toshiba)
	    host=$1
	    ;;
	*)
	    host=linux$1
    esac
    name=`zsh-expand $2`
    program=rsh
    if [ $host = linux3 -o $host = linux2 -o  $host = toshiba  -o $host = linux9 -o $host = linux7 \
	-o $host = linux8  -o $host = linux9  -o $host = linux10  -o $host = linux1 -o $host = linux12 ];
    then
	program=ssh
    fi
    $program  -l $name  $host
}


alias  dpms='xset dpms 300 400 500'
# $(expr $minutes \* 60)  $(expr $minutes \* 60) $(expr $minutes \* 60)

# dpms(){
#     minutes=$1
#     if under_xterm;
#     then
#         xset dpms $(expr $minutes \* 60)  $(expr $minutes \* 60) $(expr $minutes \* 60)
#     else
#         echo "on console un-implemented"
#     fi
# }


alias si="scsi-idle /dev/sd"
alias S="su -l"

alias u="unrpm -x -d"
# alias un="unrpm -l"
alias tel=telnet
alias xs="export SANE_DEBUG_MICROTEK2=128; xscanimage microtek2:/dev/scanner 2>>/tmp/scanner"
alias scanfax="scanimage  --mode lineart  --resolution 197"
