summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbash/j.sh133
-rw-r--r--bashrc27
2 files changed, 13 insertions, 147 deletions
diff --git a/bash/j.sh b/bash/j.sh
deleted file mode 100755
index 2a924b5..0000000
--- a/bash/j.sh
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/bin/bash
-
-# pure shell version of 'new j'
-# has frecency, rank, and recent
-# has common and case preference
-# lists to stderr
-# protect multiple PROMPT_COMMAND appends
-
-j() {
- local datafile=$HOME/.j
- if [ "$1" = "--add" ]; then
- # add
- shift
- # $HOME isn't worth matching
- [ "$*" = "$HOME" ] && return
- awk -v q="$*" -v t="$(date +%s)" -F"|" '
- BEGIN { l[q] = 1; d[q] = t }
- $2 >= 1 {
- if( $1 == q ) {
- l[$1] = $2 + 1
- d[$1] = t
- } else {
- l[$1] = $2
- d[$1] = $3
- }
- count += $2
- }
- END {
- if( count > 1000 ) {
- for( i in l ) print i "|" 0.9*l[i] "|" d[i] # aging
- } else for( i in l ) print i "|" l[i] "|" d[i]
- }
- ' $datafile 2>/dev/null > $datafile.tmp
- mv -f $datafile.tmp $datafile
- elif [ "$1" = "--complete" ]; then
- # tab completion
- awk -v q="$2" -F"|" '
- BEGIN { split(substr(q,3),a," ") }
- {
- if( system("test -d \"" $1 "\"") ) next
- for( i in a ) $1 !~ a[i] && $1 = ""; if( $1 ) print $1
- }
- ' $datafile 2>/dev/null
- else
- # list/go
- while [ "$1" ]; do case $1 in
- -h) echo "j [-h][-l][-r][-t] args" >/dev/stderr; return;;
- -l) local list=1;;
- -r) local typ="rank";;
- -t) local typ="recent";;
- --) while [ "$1" ]; do shift; local q="$q $1";done;;
- *) local q="$q $1";;
- esac; local n=$1; shift; done
- [ "$q" ] || local list=1
- # if we hit enter on a completion just go there
- [ -d "$n" ] && {
- cd "$n"
- return
- }
- cd="$(awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$q" -F"|" '
- function frecent(rank, time) {
- dx = t-time
- if( dx < 3600 ) return rank*4
- if( dx < 86400 ) return rank*2
- if( dx < 604800 ) return rank/2
- return rank/4
- }
- function output(r, s, c) {
- if( list ) {
- if( typ == "recent" ) {
- cmd = "sort -nr >/dev/stderr"
- } else cmd = "sort -n >/dev/stderr"
- for( i in r ) if( r[i] ) printf "%-15s %s\n", r[i], i | cmd
- if( c ) printf "%-15s %s\n", "common:", c > "/dev/stderr"
- } else {
- if( c ) s = c
- print s
- }
- }
- function common(r, a, nc) {
- for( i in r ) {
- if( ! r[i] ) continue
- if( !shortest || length(i) < length(shortest) ) shortest = i
- }
- if( shortest == "/" ) return
- for( i in r ) {
- if( ! r[i] ) continue
- if( i !~ shortest ) x = 1
- }
- if( x ) return
- if( nc ) {
- for( i in a ) if( tolower(shortest) !~ tolower(a[i]) ) x = 1
- } else for( i in a ) if( shortest !~ a[i] ) x = 1
- if( !x ) return shortest
- }
- BEGIN { split(q, a, " ") }
- {
- if( system("test -d \"" $1 "\"") ) next
- if( typ == "rank" ) {
- f = $2
- } else if( typ == "recent" ) {
- f = t-$3
- } else f = frecent($2, $3)
- case[$1] = nocase[$1] = f
- for( i in a ) if( $1 !~ a[i] ) delete case[$1]
- for( i in a ) if( tolower($1) !~ tolower(a[i]) ) delete nocase[$1]
- if( case[$1] > oldf ) {
- cx = $1
- oldf = case[$1]
- } else if( nocase[$1] > noldf ) {
- ncx = $1
- noldf = nocase[$1]
- }
- print $0 >> FILENAME ".tmp"
- }
- END {
- if( cx ) {
- output(case, cx, common(case, a, 0))
- } else if( ncx ) {
- output(nocase, ncx, common(nocase, a, 1))
- }
- }
- ' $datafile)"
- mv -f $datafile.tmp $datafile
- [ "$cd" ] && cd "$cd"
- fi
-}
-# tab completion
-complete -C 'j --complete "$COMP_LINE"' j
-# populate directory list. avoid clobbering other PROMPT_COMMANDs.
-echo $PROMPT_COMMAND | grep -q "j --add" || {
- PROMPT_COMMAND="$PROMPT_COMMAND"';j --add "$(pwd -P)"'
-}
diff --git a/bashrc b/bashrc
index 97402fe..a01e0de 100644
--- a/bashrc
+++ b/bashrc
@@ -18,10 +18,8 @@ export DARCS_SFTP="${HOME}/.bin/sftp"
export GIT_SSH="${HOME}/.bin/ssh"
export RSYNC_RSH="${HOME}/.bin/ssh"
export PERL5LIB="${HOME}/.perl:${HOME}/.perl/lib/perl5/site_perl/5.10.0/i686-linux"
-export CVS_RSH='ssh'
+export CVS_RSH="${HOME}/.bin/ssh"
export TEXINPUTS=".:${HOME}/conf/tex:"
-export NHBOT_DARCS_AUTHOR="doy@tozt.net"
-export NHBOT_PUBLIC_REPO_BASE="http://tozt.net/code/"
export LESS='-QR'
export NOPASTE_SERVICES="PastebinCom Rafb Shadowcat Pastie Husk"
[ -x `which git` ] && export GIT_EXEC_PATH="${HOME}/.bin/git:"`git --exec-path`
@@ -36,7 +34,7 @@ if [[ $- != *i* ]] ; then
return
fi
[ -z "$PS1" ] && return # }}}
-# Enable colors for ls, etc. Prefer ~/.dir_colors #64489 {{{
+# Enable colors for ls, etc. Prefer ~/.dir_colors {{{
if [[ -f ~/.dir_colors ]]; then
eval `dircolors -b ~/.dir_colors`
elif [[ -f /etc/DIR_COLORS ]]; then
@@ -49,9 +47,6 @@ case ${TERM} in
xterm*|rxvt*|Eterm|aterm|kterm|gnome|screen*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
;;
- #screen*)
- #PROMPT_COMMAND='echo -ne "\033k${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
- #;;
esac # }}}
# aliases {{{
# adding options to common commands {{{
@@ -80,13 +75,18 @@ alias starcraft="wine c:\\Program\ Files\\Starcraft\\StarCraft.exe"
alias tc="telnet termcast.org"
# }}}
# shells {{{
+alias bishamon='ssh bishamon'
alias apt='ssh doy@apt.tozt.net'
alias jjaro="ssh doy@jjaro.net"
-alias tozt="ssh doy@tozt.net"
-alias csil="(TERM=rxvt ssh jluehrs2@csil-core7.cs.uiuc.edu)"
-alias ews="ssh jluehrs2@remlnx.ews.uiuc.edu"
+alias tozt="ssh -t doy@tozt.net tmux a"
alias henzell="ssh henzell@crawl.akrasiac.org"
# }}}
+# 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 ..='cd ..'
@@ -97,6 +97,9 @@ function luado { # thanks rici
shift
lua /dev/fd/3 $* 4<&0- <<<$e 3<&0- 0<&4-
}
+function moose {
+ perl -Moose -E "$*"
+}
function setfont {
printf '\e]710;%s\007' "$1"
}
@@ -129,9 +132,6 @@ function pdfcat {
shift
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$out $*
}
-function vack {
- vim $(ack -la -- $*)
-}
function github-clone {
git clone git://github.com/$1/$2.git
}
@@ -305,7 +305,6 @@ export PS1="\[\$__error_color\]\$__error \[${HIYELLOW}\][\t] \[${HIGREEN}\]\u@\h
[ -f /etc/bash_completion ] && source /etc/bash_completion
[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion
source ~/.bash/cdhist.sh
-source ~/.bash/j.sh
# }}}
# fortune {{{
fortune -n300 -s ~/.fortune | grep -v -E "^$"