From: Francois Fleuret Date: Sun, 29 Sep 2013 09:16:18 +0000 (+0200) Subject: Update. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=d010af75293885a1787ac459081df82f7bcc977b;p=scripts.git Update. --- diff --git a/bashrc b/bashrc index 1a947db..067fdf5 100644 --- a/bashrc +++ b/bashrc @@ -192,10 +192,16 @@ function rl () { pdflatex "${FILEBASE}" pdflatex "${FILEBASE}" - if [[ "$1" == "--view" ]]; then - xpdf "${FILEBASE}.pdf" - elif [[ "$1" == "--print" ]]; then - lpr "${FILEBASE}.pdf" + if [[ "$1" ]]; then + if [[ "$1" == "-v" ]] || [[ "$1" == "--view" ]]; then + xpdf "${FILEBASE}.pdf" + elif [[ "$1" == "-p" ]] || [[ "$1" == "--print" ]]; then + lpr "${FILEBASE}.pdf" + else + echo "Usage: rl [-v|--view] [-p|--print]" >&2 + echo "Unknown option $1" >&2 + return 1 + fi fi else @@ -321,25 +327,10 @@ function trash () { echo "Trashed $@" } -# alias trash=trash.sh - function mmsget () { mplayer "$1" -dumpstream -dumpfile $(basename "$1") } -function quicktex () { - if [[ $1 ]]; then - MAIN=$1 - else - MAIN=$(\ls -t *.tex | head -1 | sed -r -e 's/\.tex//') - fi - pdflatex ${MAIN} - bibtex ${MAIN} - pdflatex ${MAIN} - pdflatex ${MAIN} - xpdf ${MAIN}.pdf -} - ###################################################################### # http://www.reddit.com/r/linux/comments/akt3j/a_functional_programming_style_map_function_for/ @@ -384,18 +375,6 @@ function pho () { \rm ${TEMP} } -# function rotjpeg () { -# if [ "$1" == "90" ] || [ "$1" == "180" ] || [ "$1" == "270" ]; then -# TEMP=$(mktemp /tmp/rotjpeg.XXXXXX) -# echo jpegtran -rotate "$1" -copy all $2 > ${TEMP} -# echo cp $2 ${2/jpg/}original.jpg -# echo cp ${TEMP} $2 -# rm ${TEMP} -# else -# echo "Can not rotate with an angle of "$1" degrees." -# fi -# } - ###################################################################### ## A version of date that shows the time at home if TZ is set @@ -419,6 +398,23 @@ function dt () { [[ ${NETUP_HISTORY} ]] || NETUP_HISTORY="${HOME}/.netup_history" function netup () { + WIFI_INTERFACE=wlan0 + + if [[ $1 == "--scan" ]]; then + if [[ ! $(\ifconfig -s | grep ${WIFI_INTERFACE}) ]]; then + sudo ifconfig ${WIFI_INTERFACE} up + UPPED_WIFI=1 + fi + + sudo iwlist ${WIFI_INTERFACE} scan|grep ESS\|Quali\|Encry + + if [[ ${UPPED_WIFI} ]]; then + sudo ifconfig ${WIFI_INTERFACE} down + fi + + return 0 + fi + if [[ $(\ifconfig -s | grep -v ^"(Iface|lo) ") ]]; then echo "There is already interface(s) up." >&2 return 1 @@ -517,7 +513,7 @@ function lr () { # cd and ls into a directory # [from http://www.oreillynet.com/onlamp/blog/2007/01/whats_in_your_bash_history.html] -# function c () { cd "$@" && lr; } +function c () { cd "$@" && lr; } ###################################################################### # You can change the xterm background color on the fly!