Skip to main content

Posts

Showing posts from July, 2010

Racial Relations

I have a “Kiwi Chick” friend who is half Maori half Scottish; another who has a German Dad & another from Kent, three half-Italian children (two in Port Hedland, one en Italia), teaches Italian at two local schools; another US Citizen who has an English surname but French, German, Norse & Pawnee-Indian ancestors; a Thai citizen who has a Thai mother & Phillipino father; I am mostly British Australian but part Austrian & a small part Aboriginal (which really means Phœnecian) & born in Canada. It seems oddly appropriate that I paid AUD$ to a .com.au company yet had the resulting business cards airmailed from Holland.

In case you’ve forgotten that MS-Windows is a negative-pressure situation... *

OpenOffice 3.2.1 is failing to install on a nearby laptop as the Microsoft Visual C++ sub-install on Vista gronks out with a bizarre error which may on Windows 7 (Vista SP- MAXINT ) indicate a Registry entry set to too low a value. There’s no such registry entry here, but adding it & maxing it out has no effect at all. OpenOffice 3.2 had no such problem on the same machine. Said machine had another person (hereinafter PassionFingers ) left logged in as an Administrator create themselves a new user, & in passing grant themselves access to every file under C:\Users — not the most private situation for the other users of the machine. * That is: it sucks.

Simplifying things by complicating them

I have an application to modify which wants to go from a hard-wired Wyse VT-100B-clone character terminal emulation to a GUI interface with all stops in between, plus wants to go from spitting escape-sequences at a specific model of dot-matrix impact printer to spitting A4 pages out of name-your-printer, plus wants to go from unindexed flat (fixed-with binary records) data storage to an SQL backend (probably PostgreSQL to start with). How do I do this, step by step, so I can continue to validate the functionality of the application at each step? Feature Set One: wrap all of the terminal I/O in a standard set of functions; then figure out how many pixels wide/high a bog-standard Courier (fixed-width) character is at a standard scale (12 point?), multiply the text coordinates by those factors in the top-level code, then (when addressing a text screen) divide the resulting coordinates by the same factors before cramming the result down ncurses’ throat. Feature Set Two: wrap all of the p

Nasty trick for PortForward/DMZ on a TP-Link TD-8810 ADSL modem

You need to remove the (default 3x) "Bridge" entries in the DSL settings before a NAT entry will appear in the Advanced Settings menu, through which you can then configure Port Forwarding or DMZ... & a Port Forward rule which alters the port numbers en passant has yet to work for me — so, if you want SSH on port #2222 instead of #22, add "Port 2222" to your /etc/sshd_config file on the server, restart sshd, then configure the modem to port-forward TCP/2222 to the server concerned without altering the target port numbers.

YouTube links on download list script

Still a little clumsy, but... #!/bin/bash arg=$(echo $1 | sed -e 's/v=.*$/v=/') if ! [ "$arg" = "http://www.youtube.com/watch?v=" ]; then     echo "Not a YouTube URL: $1"     exit 1 fi target=$(echo $1 | sed -e 's/^.*v=//') wget $1 -O /tmp/fetched_from_youtube.data # @@@ below is (all on one line, blogger fails to handle well): # if($1 == "-" && $2 != "") { #   sub ("^[^A-Z]*",""); #   sub("\\(.*\\).*$",""); #   gsub("[[:punct:]]",""); #   sub(" +$",""); #   gsub(" +","_"); #   sub("_\\.","."); #   print $0; # } title=$(gawk '/<.title>/ { x=0; } x > 0 { @@@ } / / { x=2; }' /tmp/fetched_from_youtube.data) rm -f /tmp/fetched_from_youtube.data python youtube-dl.py $target ffmpeg -i ${target}.flv -ab 56 -ar 22050 -b 500 -s 320x240 ${title}_${RANDOM}.mpg rm -f ${target}.flv exit 0

Swimming up a waterfall...

Only one message in 56 (1.8%) survives my spam filtering (harsh PostFix rules plus minimal content filters), yet I still get about 200 junk messages each day. It's a pity that the only real alternative is positive ID of the sender, which of course traps you into one of the global ID systems run by the über-control-freaks who intend to run everything their way only... & historically speaking, zero of the ID systems put in place have benefited (or really been intended to benefit) those so IDed.

Adding YouTube watch?v= links to auto-download

The linked chunk of Python does the job well... but leaves a .flv file with a crypto-looking name. This chunk of shell script ( $1 is the full YouTube URL, as in http://www.youtube.com/watch?v=XYZZY123abc or whatever) hauls out the video title: wget $1 -O /tmp/fetched_from_youtube.data name=$(gawk '/<.title>/ { x=0; } x > 0 { if($1 == "-" && $2 != "") { sub ("^[^A-Z]*",""); sub("\\(.*\\).*$",""); gsub("[[:punct:]]",""); sub(" +$",""); gsub(" +","_"); print $0; } } / / { x=2; }' /tmp/fetched_from_youtube.data) rm -f /tmp/fetched_from_youtube.data The title is savagely pruned to exclude most things which would fail as part of a filename. Experiments will happen tomorrow AM, but I’m guessing that something like this would do the appropriate conversion/renaming: arg=$(echo $1 | sed -e 's/^.*v=//') ffmpeg -i ${arg} -ab 56 -ar 22050 -b 50

How to use your unlimited quota 2AM-8AM

Fun with BASH. Disclaimer: this may contain typoes, thinkoes, etc. Use (or don’t use) entirely at your own risk. The intent is to be educational here rather than subject to chapter-&-verse unquestioning acceptance. If the clock on the computer running this is inaccurate by more than five minutes, the downloads may (partially) take place from your monthly quota (in which case install rdate & aim it at a suitable time server, then install/use hwclock to update the PC’s battery-backed clock). Behold, the grabqueue.sh file: #!/bin/sh for list in pending/*; do     N=$(wc -l $list | sed -e 's/ .*$//')     for url in $(seq $N); do         L=$(tail -n +$url $list | head -n 1 -)         if [ "$L" != "" ]; then             wget -c "$L"         fi     done     rm -f $list done rm -f /tmp/grabqueue.pid Run this (in cron) at 02:05 (a little clock slackness): #!/bin/sh cd /path/to/download/directory sh grabqueue.sh & echo $! >/tmp/grabq