# trap 'trap ERR' RETURN
-
-############
-# settings #
-############
+# * settings
CDPATH=.
bind 'set print-completions-horizontally on'
bind '"\C-i": self-insert'
else
+
+ # todo: not sure this works in sakura
+ #stty werase undef
+ #bind "\C-w": kill-region
# sakura == xterm-256color
# konsole == xterm
if [[ $TERM == "xterm" ]]; then
# works in addition to HISTCONTROL to do more flexible things
# it could also do the same things as HISTCONTROL and thus replace it,
# but meh. dunno why, but just " *" does glob expansion, so use [ ] to avoid it.
-HISTIGNORE='pass *:k *:[ ]*'
+HISTIGNORE='pass *:k *:[ ]*:lom '
export BC_LINE_LENGTH=0
C_DEFAULT_DIR=/a
-###################
-## include files ###
-###################
+# * include files
for _x in /a/bin/distro-functions/src/* /a/bin/!(githtml)/*-function?(s); do
source "$_x"
done
if [[ -e $_x ]]; then source $_x; fi
-###############
-### aliases ###
-###############
+# * aliases
# very few aliases, functions are always preferred.
-
-
-
-
-
-
-#####################
-### functions ####
-#####################
+# * functions
..() { c ..; }
pk1 emacs --daemon
}
+# at least in flidas, things rely on gpg being gpg1
+gpg() {
+ command gpg2 "$@"
+}
+
gse() {
git send-email --notes '--envelope-sender=<ian@iankelling.org>' \
--suppress-cc=self "$@"
grr() {
if [[ ${#@} == 1 ]]; then
- grep -riIP --color=auto "$@" .
+ grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" .
else
- grep -riIP --color=auto "$@"
+ grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@"
fi
}
hstatus() {
# do git status on published repos
cd /a/bin/githtml
- for x in !(forks) forks/* ian-specific/*; do
+ do_hr=false
+ for x in *; do
cd `readlink -f $x`/..
- hr
- echo $x
- i status
+ status=$(i status -s) || pwd
+ if [[ $status ]]; then
+ hr
+ echo $x
+ printf "%s\n" "$status"
+ fi
cd /a/bin/githtml
done
}
lcn() { locate -i "*$**"; }
+lt() { ll -tr "$@"; }
+
lld() { ll -d "$@"; }
+lom() {
+ local l base
+ if [[ $1 == /* ]]; then
+ l=$(sudo losetup -f)
+ sudo losetup $l $1
+ base=${1##*/}
+ if ! sudo cryptsetup luksOpen $l $base; then
+ sudo losetup -d $l
+ return 1
+ fi
+ sudo mkdir -p /mnt/$base
+ sudo mount /dev/mapper/$base /mnt/$base
+ sudo chown $USER:$USER /mnt/$base
+ else
+ base=$1
+ sudo umount /mnt/$base
+ l=$(sudo cryptsetup status /dev/mapper/$base|sed -rn 's/^\s*device:\s*(.*)/\1/p')
+ sudo cryptsetup luksClose /dev/mapper/$base
+ sudo losetup -d $l
+ fi
+}
+
low() { # make filenames lowercase, remove bad chars
local f new
for f in "$@"; do
set +x
}
+
mdt() {
markdown "$1" >/tmp/mdtest.html
firefox /tmp/mdtest.html
mo() { xset dpms force off; } # monitor off
+
+nopanic() {
+ sudo tee -a /var/log/exim4/paniclog-archive </var/log/exim4/paniclog; sudo truncate -s0 /var/log/exim4/paniclog
+}
+
+
otp() {
oathtool --totp -b "$@" | xclip -selection clipboard
}
+p8() { ping 8.8.8.8; }
pakaraoke() {
# from http://askubuntu.com/questions/456021/remove-vocals-from-mp3-and-get-only-instrumentals
done
}
-ping8() { ping 8.8.8.8; }
pub() {
rld /a/h/_site/ li:/var/www/iankelling.org/html
s rsync -rlpchviog --relative "${opts[@]}" "$path" "root@$host:/";
}
-# only run on desktop. simpler to keep this on one system.
+# only run on MAIL_HOST. simpler to keep this on one system.
r2eadd() { # usage: name url
# initial setup of rss2email:
# r2e new r2e@iankelling.org
scriptreplay "$1.t" "$1.s"
}
+spd() {
+ PATH=/usr/local/spdhackfix:$PATH command spd "$@"
+}
+
spend() {
s systemctl suspend
}
vpncmd() {
+ #m s nsenter -t $(pgrep -f "/usr/sbin/openvpn .* --config /etc/openvpn/.*pia.conf") -n -m "$@"
m s nsenter -t $(pgrep -f "/usr/sbin/openvpn .* --config /etc/openvpn/.*client.conf") -n -m "$@"
}
vpnf() {
- vpncmd gksudo -u iank "firefox -no-remote -P firefox-main-profile" &r
+ vpncmd gksudo -u iank "firefox -no-remote -P vpn" &r
+}
+vpni() {
+ vpncmd gksudo -u iank "$*"
}
vpnbash() {
vpncmd bash
xscreensaver-command -activate
}
-#############################
-######### misc stuff ########
-#############################
+# * misc stuff
# from curl cheat.sh/:bash_completion
_cheatsh_complete_curl()
-
-
-
-###############
-# prompt ######
-###############
+# * prompt
if [[ $- == *i* ]]; then
}
-###########################################
-# stuff that makes sense to be at the end #
-###########################################
+# * stuff that makes sense to be at the end
if [[ "$SUDOD" ]]; then
cd "$SUDOD"
unset SUDOD