+++ /dev/null
-#--------------------------------------------------------------------------------
-#
-# ALIASES
-#
-#--------------------------------------------------------------------------------
-
-#[ "$UID" = "0" ] && grep -q '^_\?postgres:' /etc/passwd && alias psql='sudo -u postgres psql'
-
-#--------------------------------------------------------------------------------
-# Etherwake
-# Cable: alias advent-on="etherwake -i eth0 00:22:68:7b:fb:99 -D -b"
-#
-#alias advent-on="etherwake -i eth0 48:5b:39:eb:db:8a -D -b"
-
-#--------------------------------------------------------------------------------
-# Torrent
-#
-
-# btlaunchmanycurses.py
-#alias torrent="btdownloadcurses.py --max_download_rate 150 --max_files_open 0"
-#alias torrentdir="btlaunchmanycurses.py --max_download_rate 150 --max_files_open 0"
-
-# btdownloadcurses
-which btdownloadcurses 1>/dev/null && alias torrent="btdownloadcurses --max_upload_rate 1 --minport 6881 --maxport 6999"
-which btlaunchmanycurses 1>/dev/null && alias torrentdir="btlaunchmanycurses --max_upload_rate 1 --minport 6881 --maxport 6999"
-
-#--------------------------------------------------------------------------------
-# xterm
-#
-[ -x /usr/bin/xterm ] && alias xterm="xterm -bg black -fg gray -fn 10x20"
-
-#--------------------------------------------------------------------------------
-# debian upgrade
-#
-which server-package.pl 1>/dev/null && alias servers-upgrade='server-package.pl update,upgrade $((printf "big.cascais.loc\n";mysql -h mysql izi -NBe "select host from server where not hidden") | sort -u)'
-
-#--------------------------------------------------------------------------------
-#
-# FUNCTIONS
-#
-#--------------------------------------------------------------------------------
-
-nb_auth() {
- curl -H 'Accept: text/plain' -ku "$USER" https://nico.nbdom.net/private/auth/
-}
-
-nb_alert() {
- local cmd=". $NB_ROOT/etc/profile"
- local host
- case "$1" in
- led)
- host=pi.brighton.loc
- cmd="$cmd && echo $FUNCNAME > /var/run/gpiod.sock"
- ;;
- say)
- host=pi.brighton.loc
- shift
- cmd="$cmd && say <<< \"$@\""
- ;;
- beep)
- host=pi.brighton.loc
- cmd="$cmd && play 2>/dev/null -v 5 /home/pi/python_games/beep1.ogg"
- ;;
- -h|-help|--help)
- echo "Usage: $FUNCNAME [led|say|beep|-h] OR TEXT"
- return
- ;;
- *)
- host=macbook.brighton.loc
- case $HOSTNAME in *[Mm][Aa][Cc][Bb][Oo][Oo][Kk]*) host="";; esac
- local msg="$FUNCNAME from $HOSTNAME "$(echo "$*" | tr "\"\`'" "”")
- cmd="$cmd && mac_xmessage \"$msg\" 1>/dev/null"
- ;;
- esac
- #host=""
- #cmd=""
-
- if [ -n "$host" ]; then
-
- local ip=`dig +short $host`
- [ -z "$ip" ] && echo "Can't resolve $host" 1>&2 && return 1
-
- ping -qc1 "$host" >/dev/null 2>&1 || ( echo "Can't ping $host" 1>&2; return 1 )
-
- ips | grep -qxFm1 "$ip" || cmd="ssh -o BatchMode=yes $host -- '$cmd'"
-
- fi
-
- if [ "$USER" == "nico" ]; then
- eval "$cmd"
- else
- su - nico -c "$cmd"
- #echo sudo -u nico -- "$cmd"
- fi
-}
-
-radio_play() {
- # See http://fluxradios.blogspot.co.uk/
- local prog=`which mplayer`
- if [ -z "$prog" ]; then
- case $OSTYPE in
- darwin*) prog="open" ;;
- esac
- fi
-perl -e '
-@_=grep{$_} split("\n","
-FranceInter | http://direct.franceinter.fr/live/franceinter-midfi.mp3
-Indie | http://107.155.126.42:17160/listen.pls
-FranceInfo | http://direct.franceinfo.fr/live/franceinfo-midfi.mp3
-FranceCulture | http://direct.franceculture.fr/live/franceculture-midfi.mp3
-RTL | http://streaming.radio.rtl.fr/rtl-1-48-192
-BBC 1 | http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
-BBC 2 | http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
-BBC 3 | http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio3_mf_p
-BBC 4 | http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
-BBC 5 live | http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio5live_mf_p
-BBC 6 | http://bbcmedia.ic.llnwd.net/stream/bbcmedia_6music_mf_p
-");
-if (@ARGV) { $play=shift @ARGV; } else {
- $i=1;
- map{printf("%2d | %s\n",$i++,$_)} @_;
- print "\nChoose one > ";
- chomp($play=<>);
-}
-$play eq "" && exit; @_ = $_[$play-1] =~ /^(.*?)\s*\|\s*(.*?)$/ or exit;
-print "[ $play - ".$_[0]." ]\n\n";
-exec "'$prog'",$_[1];
-' "$@"
-}
-