summaryrefslogtreecommitdiffstats
path: root/aliases
blob: c645008d7530b9ccb3063ca6d2ef99c7914b6c0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# adding options to common commands {{{
alias ls="ls --color=auto --group-directories-first"
alias grep="grep --color=auto"
alias rm="rm -i"
alias cp="cp -i"
alias mv="mv -i"
alias bc="bc -lq"
alias truecrypt="sudo truecrypt -t"
alias cpan-outdated="cpan-outdated --mirror file://${HOME}/perl5/minicpan/"
alias netstat="netstat -a --inet --numeric-port"
# }}}
# games {{{
alias nao="(TERM=rxvt telnet nethack.alt.org)"
alias cao="(TERM=rxvt /usr/bin/ssh -C -i ${HOME}/.ssh/cao_key joshua@crawl.akrasiac.org)"
alias cdo="ssh -C -i ${HOME}/.ssh/cao_key crawl@crawl.develz.org"
# }}}
# termcast {{{
alias tc="telnet termcast.org"
# }}}
# shells {{{
alias bishamon='ssh bishamon'
alias apt="ssh ${USER}@apt.tozt.net"
alias tozt="ssh -t ${USER}@tozt.net tmux a"
# }}}
# tmux sessions {{{
alias main='tmux a -t main'
alias work='tmux a -t work'
alias docs='tmux a -t docs'
alias misc='tmux a -t misc'
# }}}
# other {{{
alias wgetff='wget --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070404 Firefox/2.0.0.3"'
alias pm="find lib -type f | sort"
alias bootstrap_cpanm="wget -O- -q http://xrl.us/cpanm | perl - App::cpanminus"
alias v="vim -c 'call feedkeys(\"t\")'"
alias wifi="sudo systemctl restart netctl-auto@wlan0"
alias prove="forkprove"
alias ack="ag"
function web {
    local port=$1
    if [[ -z $port ]]; then
        plackup -MPlack::App::Directory -e'Plack::App::Directory->new'
    else
        plackup -MPlack::App::Directory -e'Plack::App::Directory->new' --port $port
    fi
}
function perldoc {
    # XXX bash specific
    if type cpandoc > /dev/null 2>&1; then
        cpandoc "$@"
    else
        command perldoc "$@"
    fi
}
alias pd=perldoc
function webcam {
    local width=$1
    local height=$2
    if [[ -z $width ]];  then width=640;  fi
    if [[ -z $height ]]; then height=480; fi
    mplayer tv:// -tv driver=v4l2:width=${width}:height=${height}:device=/dev/video0 -fps 15 -vf screenshot
}
function webcam_record {
    local width=$1
    if [[ -z $width ]];  then width=640;  else shift; fi
    local height=$1
    if [[ -z $height ]]; then height=480; else shift; fi
    mencoder tv:// -tv driver=v4l2:width=${width}:height=${height}:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o $1
}
function setfont {
    printf '\e]710;%s\007\e]711;%s\007' "$1" "$1"
}
function mem_usage {
    ps -eo size,ucmd | sort -rn | head -n$([ -z "$1" ] && echo 20 || echo $1)
}
function opened_files {
    strace $* 2>&1 | grep -E '^open\('   | \
                     grep -v ENOENT      | \
                     grep -v O_DIRECTORY | \
                     cut -f2 -d"\"" | \
                     grep -vE '^/proc/'  | \
                     grep -v '^/sys/'    | \
                     grep -v '^/dev/'
}
function alert {
    echo "DISPLAY=$DISPLAY xmessage -center -default okay $1" | at $2
}
function fm22avi {
    fceux --playmov $1.fm2 --sound 1 --soundq 1 --soundrate 48000 --nospritelim 1 --pal 0 --xscale 1 --yscale 1 --opengl 0 --special 0 $2 --videolog "mencoder - -o $1.avi -ovc x264 -x264encopts qp=0 -oac mp3lame -lameopts mode=3:preset=128 -noskip -nocache -mc 0 -aspect 4/3 NESVSETTINGS"
}
function pdfcat {
    local out=$1
    shift
    gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$out $*
}
function svup {
    svc -u "$HOME/.services/$1"
    svstat "$HOME/.services/$1"
}
function svdn {
    svc -d "$HOME/.services/$1"
    svstat "$HOME/.services/$1"
}
function svst {
    svstat "$HOME/.services/$1"
}
function pick_music {
    lastfm_export --user doyster --dsn dbi:SQLite:${HOME}/.tracks.sqlite
    sqlite3 ${HOME}/.tracks.sqlite "SELECT artist FROM tracks WHERE strftime('%s') - timestamp < 60*60*24*365 GROUP BY artist ORDER BY count(artist) * (strftime('%s') - max(timestamp)) DESC LIMIT $([ -z "$1" ] && echo 20 || echo $1)"
}
function t {
    if [[ -d blib ]]; then
        perl -Mblib -MTest::Pretty "$@"
    else
        perl -Ilib -MTest::Pretty "$@"
    fi
}
function pt {
    if [[ -d blib ]]; then
        prove -Pretty -b "$@" t
    else
        prove -Pretty -l "$@" t
    fi
}
# }}}

# vim:ft=sh: