&& The Notes Folder This folder contains quick notes written about various subjects ... * getting a page via an authenticating proxy server >> curl -x proxy.utas.edu.au:8080 -U bobj http://www.server.net * getting a page via an authenticating proxy server as user 'bobj' with password 'asecret' >> curl -x proxy.utas.edu.au:8080 -U bobj:asecret http://www.server.net Supplying the password in this manner is possibly not a good idea from a security point of view * a function which prints its own name >> test () { echo "$FUNCNAME"; } * a function which prints its own name >> test () { [ -z "$1" ] && echo "$FUNCNAME: parameter needed" && return 1; } * download a text file through a proxy and edit it with vim ------------------------------ function edn { curl -x proxy.utas.edu.au:8080 -U bishop:secret http://bumble.sourceforge.net/notes/index.txt -o ~/notes.txt vim ~/notes.txt } ,,, * upload some file to a webserver cgi script which has http authententication through a proxy function up { [ -z "$1" ] && echo 'no parameter' && return 1; curl -F name='../htdocs/notes/'$1 -F contents='<'$1 -u user:upass -x proxy.utas.edu.au:8080 -U bob:proxypass http://www.server.net-bin/save.cgi } * upload data from the file 'list.txt' to a webserver >> curl -F comment=<~/docs/list.txt www.server.net/cgi-bin/save-comment.pl The curl line above is equivalent to the user filling out a web form and posting it. The form would look like >>
* upload the file 'notes.txt' with curl through a proxy server to a server cgi script >> curl -F filename='../htdocs/notes/index.txt' -F filecontents='> curl -F filename='../htdocs/notes/index.txt' -F filecontents='> mjbishop$ f=$(ls *.wav | head -$[$RANDOM%$(ls | wc -l)] | tail -1); afplay "$f" * slightly shorter way to do the same >> mjbishop$ f=$(ls *.wav | sed -n "$[$RANDOM%$(ls | wc -l)]p" ); afplay "$f" * an even shorter way to do the same thing but wont work if some filenames have spaces >> a=($(ls)); afplay "${a[$RANDOM%${#a}]}" * display the fifth file in the current folder >> a=($(ls)); echo ${a[5]} * display a random file in the current folder >> a=($(ls)); echo ${a[$RANDOM%${#a}]} * an interpreting loop which breaks when the user enters 'q' >> while true; do read a; echo $a; [ "$a" = "q" ] && break; done