dotfiles

My opinionated dotfiles
git clone git://git.erethon.com/dotfiles
Log | Files | Refs

.aliases (2418B)


      1 #  go back x directories
      2 b() {
      3     str=""
      4     count=0
      5     while [ "$count" -lt "$1" ];
      6     do
      7         str=$str"../"
      8         let count=count+1
      9     done
     10     cd $str
     11 }
     12 
     13 # Extract almost any archive
     14 extract () {
     15     if [ -f $1 ] ; then
     16       case $1 in
     17         *.tar.bz2)   tar xjf $1     ;;
     18         *.tar.gz)    tar xzf $1     ;;
     19         *.bz2)       bunzip2 $1     ;;
     20         *.rar)       unrar e $1     ;;
     21         *.gz)        gunzip $1      ;;
     22         *.tar)       tar xf $1      ;;
     23         *.tbz2)      tar xjf $1     ;;
     24         *.tgz)       tar xzf $1     ;;
     25         *.zip)       unzip $1       ;;
     26         *.Z)         uncompress $1  ;;
     27         *.7z)        p7zip -d $1        ;;
     28         *)     echo "'$1' cannot be extracted via extract()" ;;
     29          esac
     30      else
     31          echo "'$1' is not a valid file"
     32      fi
     33 }
     34 
     35 # Instant server
     36 servedir(){
     37     python -m SimpleHTTPServer $1
     38 }
     39 
     40 shutd(){
     41     echo  $((date| cut -d' ' -f 1-5 && uptime | cut -d' ' -f 3-5 | cut -d',' -f 1 ) | tr "\n" " ")  >> ~/.uptime.txt
     42     sudo shutdown -h now
     43 }
     44 
     45 wifi(){
     46     sudo rfkill unblock wifi
     47     sleep 1
     48     sudo ifconfig wlan0 down
     49     sudo macchanger -r wlan0
     50     sudo ifconfig wlan0 up
     51     sudo service wicd start
     52     wicd-curses
     53 }
     54 
     55 # Clear terminal
     56 alias c="clear"
     57 
     58 alias clip="xclip -selection clipboard"
     59 alias burn="shred -n 3 -u "
     60 alias monitor="xrandr --output HDMI1 --mode 2560x1440 --left-of eDP1"
     61 alias monitor2="xrandr --output LVDS1 --mode 1024x600; xrandr --output VGA1 --mode 1920x1080 --left-of LVDS1"
     62 
     63 # Common typo
     64 alias les="less"
     65 
     66 # Open stdout in vim
     67 alias vr="vim -R -"
     68 
     69 # Pretty print json
     70 alias json="python -mjson.tool"
     71 
     72 # Common programs alias
     73 alias h="fc -l -100000 | grep"
     74 alias less="less -R"
     75 alias ls="ls --color=auto"
     76 alias l="ls"
     77 alias ll="ls -lah"
     78 alias cl="clear; ls"
     79 alias e="emacsclient"
     80 
     81 iptv(){
     82     iptables -v -n --line-numbers -L $@
     83 }
     84 
     85 iptvs(){
     86     ip6tables -v -n --line-numbers -L $@
     87 }
     88 
     89 alias alsamixer="alsamixer -c 0"
     90 
     91 cse() {
     92     grep -ir $1 ~/.mcabber/histo/ | sed -e 's/.*000 //'
     93 }
     94 
     95 # Unlock remote luks machines
     96 unluks() {
     97     read -s LUKSPASS
     98     ssh -l root $1 "echo -ne $LUKSPASS >/lib/cryptsetup/passfifo"
     99     unset LUKSPASS
    100 }
    101 
    102 # Archive emails
    103 archive() {
    104     DEST=$(dirname ~/Vault/mail/$1)
    105     archivemail -d 30 -o $DEST $1
    106 }
    107 
    108 # Add gzip header for zlib compressed files
    109 zlibtogz(){
    110     printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - $@
    111 }
    112 
    113 alias s="w3m https://google.com"