Torture of various coding and scripting languages has always been fun. And it's not been outlawed yet! Excellent! Encompasses torture of the languages, torture of the compilers & runtime env. Torture of people reading the code and running scripts.
Brilliant.

So anyway this "torture" I mention is half in jest BUT if you take a look further it is easy to see it is true. You will be a subject of my torture >;)

Some more recent torture (march 2009) embed rss feeds in web page. Google AJAX and Facebook badge. index-just-plainestgooglefeed.html index-with-blog-rss-feeds.html

notes on coding/scripting
notes on process/quality
torture of PI and FreeMind

TBD:

Redesign? Refactor? Throw away code. YES .... but ...

Our minds (human beings) are an organised mess of stuff. Often doing _stuff_ also becomes messy, scripting and programming IS messy. .... unless you ignore the error handling that is!!!! :) This has been mentioned before I think. Comes from perl philosophy. Also from XP. Somewhere on the web (! :)) [1] someone mentions how they restarted project from scratch, threw out all the messy code. Were very brave. In the days before XP but when "redesigning" and other re- words were equally applicable buzzwords. I recall thinking of throwing away & redesigning as good around the same time OO and UML were huge. My young and easily impressionable years! :) (see the treadmarks still left)

I like XP. But XP would say be brave and throw it the hell out and refactor. Wouldn't it? Well, not quite, NO in fact. Yes refactor, throw it AWAY if you are have been implementing XP and you have your huge set of regression tests that you will get all to pass after you refactor. This large set of tests gives you great confidence. Allows us to be brave! So ... um, yep, in reality XP programmers are cowardly wusses and all this talk of bravery just makes us feel cool :)

Back to refactor. Without XP. If you have a large interlinked "mess" of code. All talking happily internally and handling everything relatively stably. Without tests. Then throwing away the code which is the distilled essence of all the time the developers have put into developing and testing is more than throwing out code. It is also chucking experience and all the testing & debugging & fixing out too. Even if have tests .... was there a test made for every weird thing ever fixed? AND are they still there? Past refactoring might mean that unit tests put in to check specific situations disappear. So must rely on functional tests as test bed to make us brave.

oMLG! enuf guff! Stop ALREADY!


[2]
jwz - nomo zilla


[2]
Joel On Software - Things You Should Never Do
[3]
O'Reilly references Joel's Netscape article
[4]
mozilla.org - fear and loathing on the merger trail
[5]

.fvwm2rc and xchat perl

On changes to xchat script to get it more usable for me day to day logging to X root desktop where it catches my eye. Originally
waider's xchat-hacks.pl Accompanies a .fvwm2rc for fvwm2 (lives in ~/.fvwm/.fvwm2rc). Here are my .fvwm2rc and xchat-hacks.pl files:
-rw-rw-r--    1 jamesey  jamesey     15673 Feb 16  2004 
~.fvwm/.fvwm2rc
-rw-rw-r--    1 jamesey  jamesey      4074 Feb 17  2004 
~/.xchat/xchat-hacks.pl
-rwxr-xr-x    1 jamesey  jamesey     11253 Oct 15 11:35
~/.xchat/xchat-alert.pl
The .fvwm2rc is so changed as to be utterly unrecognisable I think. xchat-hacks.pl has a few lines still recognisable. xchat-alert.pl is actually what I use HAS throttling and doesn't die if people paste weird chars
 This seq I figured out/played with before and have had to with similar (but different).
This is in particular for Red hat 9 but modified to add fvwm2 support.
/usr/X11R6/bin/startx calls
  /etc/X11/xinit/xinitrc
    does xmodmap and xkbdmap stuff 
    if user has ~./Xclients execs it (presumably to start wm (where I should've put fvwm2 start code))
    calls /etc/X11/xinit/Xclients (or maybe start fvwm if else fails:)
    e.g. all else fails =>

    FVWM2=/usr/local/bin/fvwm2
    if [ -f $FVWM2 ]; then
      exec $FVWM2
    fi
    exec twm

      /etc/X11/xinit/Xclients decides what wm to use 
      source /etc/sysconfig/desktop
        DESKTOP="GNOME" #old
        DESKTOP="FVWM2" # me

      and starts gnome or kde and/or windowmaker

      or fvwm2

      redhat did have fvwm* stuff in there ... which didn't work.
      
anyway remember this for future reference.
In future look first to making ~/.Xclients
Good start: cp /etc/X11/xinit/Xclients ~/.Xclients

Miscellaneous demonstrations of torture

Watch a file or directory for change and jump up and down when it does: DirMon.pl No, there isn't a _standard_ better way yet IMHO. Has to go inside a kernel. Would be nice if/when this would become standard.

getwotd dial up the oed.com and haul down wotd and email; it to yourself every day.

sfa Scriptie to support multiple users for Slime Forest Adventure. Installs multi-user support if not there already. Wants to do sudo.

viewTimesheet.pl Browse timesheet file (with unix timestamps start every line end with :

reportGiftTrans.php Perl connect to mySQL, slurp out stuff, organise it & print report.

MopsCrypt.pm MopsCryptTest.pl Interface to GnuPG and tests for this module.

greek.csv =&nbgt; iso88597csv2hypercom.pl =&nbgt; greek2greeklish.pl =&nbgt; (+ source code) convert.pl
Apply translations to source code. Translate translation csv files between iso8859-7 and proprietary hypercom format.

http auth manually

wget -O report.html --http-user="$user" --http-passwd=$password http://server/path/script
in /etc/wgetrc
http_proxy = http://proxy:8080/
ftp_proxy = http://proxy:8080/

rfc2616 - Hypertext Transfer Protocol -- HTTP/1.1
rfc2068 - Hypertext Transfer Protocol -- HTTP/1.1
rfc2069 - An Extension to HTTP : Digest Access Authentication

$ grep "03/Feb/2004" /var/log/httpd/access_log |head -n 20
192.168.10.1 - - [03/Feb/2004:09:34:49 +0000] "GET /thing/script.php HTTP/1.0" 200 5239 "http://server/thing/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1"

$ telnet localhost 80
GET /thing/script.php HTTP/1.0" 200 0 "http://server/thing/" "Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.2.1) Gecko/20030225 

response:
HTTP/1.1 401 Authorization Required
WWW-Authenticate: Basic realm="multi"

so ask user for username & password for "multi"

$ perl -e 'use MIME::Base64;$encoded = encode_base64("username:password");print $encoded;'

telnet bakunin.dev.ie.alphyra.com 80
GET /thing/script.php HTTP/1.0" 200 0 "http://server/thing/" "Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.2.1) Gecko/20030225 
Authorization: Basic c3RlbGxhOnN0ZWxsYQ==

password hashing, /etc/passwd and /etc/shadow

gpg GnuPG

Read
The GNU Privacy Handbook.
GnuPG is a RFC2440 (OpenPGP) compliant application.
here are my keys: keys e.g. perl modules GnuPG::Interface GnuPG Crypt::*lots* also interesting and useful is gpg-dialog.pl Jagadeesh Venugopal gpg-dialog@jagadeesh.org recommend to help with key management & other gpg work by hand mutt --command-fd interface to gpg, using expect OR perl From MopsCrupt.pm _yet_ another interface to gpg. Fun to write & test this. :)

Dumping hex

I used cart teeny wee proggies I made self in a rush when had to get something working. Since have discovered (quel surprise!) that someone else wrote an equivalent! So to people exactly like me. If you want to hexdump something use hexdump or xxd! You can imagine the contents of these vewry short c proggies just looking at their names: ascii.c hexdump.c bin2scn.c bin2hist.c bin2scn.pl mpack.c bin2srec.c now unix util standards: hexdump and xxd srec2bin and bin2srec might be more gecomplicated as have checksums & stuff. hmmmmn.

Oh and speaking of dumping hex jwz :)


About xxd

# just dump something (ptr: hex  ascii) 16chrs per line
$ xxd ../test-protocol-dump.bin 
0000000: 2032 3430 302f 4e4f 4e45 0d0a 050a 2d2d   2400/NONE....--
0000010: 2d2d 2d2d 2d2d 2d2d 0a02 4231 3131 3233  --------..B11123

# -p for plain
$ xxd -l 120 -p ~/notes 
0a41646420227365742062656c6c2d7374796c65206e6f6e652220746f20
796f7572207e2f2e696e70757472632e0a237365742062656c6c2d737479

# -c for how many chars per line
# -l 24 first 24 chars
$ xxd -l 24 -c 12 xxd.1
0000000: 2e54 4820 5858 4420 3120 224d  .TH XXD 1 "M
000000c: 616e 7561 6c20 7061 6765 2066  anual page f

# -r for hexdump to binary
$ xxd -r -p ~/testing/IMAGE.plainhex > ~/testing/IMAGE.binary

$ cp /usr/X11R6/lib/X11/fonts/misc/10x20-ISO8859-7.pcf.gz ..
$ gunzip 10x20-ISO8859-7.pcf.gz
$ xxd -c 16 10x20-ISO8859-7.pcf 
# -c 16 is redundant

# there is more than one way of doing things?
# in this case much better ways!
# we're whacking out "ptr: " part and 
#  translating ASCII ctrl chars 1c 1d 1f to " FS " " GS " " US "
$ sed "s/^.*: *//" ~/bin/data.txt | sed "s/1c/20 46 53 20/g;s/1d/20 47 53 0a/g;s/1f/20 55 53 20/g" | xxd -p -r

# see man ascii
# FS = Field Seperator, GS Group, US Unit
$ man ascii
       034   28    1C    FS             134   92    5C    \
       035   29    1D    GS             135   93    5D    ]
       036   30    1E    RS             136   94    5E    ^
       037   31    1F    US             137   95    5F    _

$ apropos hex

ascii                (7)  - the ASCII character set encoded in octal, decimal, and hexadecimal
hexdump              (1)  - ascii, decimal, hexadecimal, octal dump
iso_8859-1           (7)  - the ISO 8859-1 character set encoded in octal, decimal, and hexadecimal
iso_8859-15          (7)  - the ISO 8859-15 character set encoded in octal, decimal, and hexadecimal
iso_8859-2           (7)  - the ISO 8859-2 character set encoded in octal, decimal, and hexadecimal
iso_8859-7           (7)  - the ISO 8859-7 character set encoded in octal, decimal, and hexadecimal
iswxdigit            (3)  - test for hexadecimal digit wide character
koi8-r               (7)  - Russian Net Character Set encoded in octal, decimal, and hexadecimal
text2pcap            (1)  - Generate a capture file from an ASCII hexdump of packets
xxd                  (1)  - make a hexdump or do the reverse

$ hexdump -e '"%07.7_ax  " 8/2 "%04x " "\n"' headoocalcrules_engr.csv
0000000  4527 5252 524f 2c27 2722 d6d3 cbc1 c1cc

# >;) Histogram >;)
$ hexdump -e '1/1 "%02x " "\n"' headoocalcrules_engr.csv |sort |uniq -c

Mime pack/unpack and Uuencode/decode

rfc2045 MIME

uuencode alphabet:
`!"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]~_

_almost_ matches ascii ?
#20-40:  !"#$%&'()*+,-./0123456789:;<=>?
#40-60: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
#60-80: `abcdefghijklmnopqrstuvwxyz{|}~

# if system had not got standard ascii table ... ! :) hmm well now then 
# uuencoded message would look different but work fine now wouldn't it?
# 64 chars here:

mime or base64 alphabet:
#00-19: ABCDEFGHIJKLMNOPQRSTUVWXYZ
#1a-33: abcdefghijklmnopqrstuvwxyz
#34-3d: 0123456789
#3e-3f: +/
#padding: =

// in c
// best to have const string lying around 
static const char base64alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
return base64alpha[i];
// more fun to calculate every time, NOT more efficient in any imaginable way
r=(i<0x1a)?'A'+i:(i<0x34)?'a'+i-0x1a:(i<0x3e)?'0'+i-0x34:(i<1)?'+':'/';

mime encoding mpack munpack: convert 8 bit byte stream to 6 bit stream
uuencode same thing -ish

# mime encoding is base 64 encoding kindof uuencode only 7bits, not 6 bits
# Header says more about file contained, 
# e.g. how to handle it, checksum
Content-Type: image/jpeg; name="jeschsmall.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="jeschsmall.jpg"
Content-MD5: 8EJCtYG4bWHsj0c0PraXZw==

#so uuencode 3 bytes => 4 mime bytes
echo "foo" |xxd 
0000000: 666f 6f0a                                foo.

#binary uuencoding (chars have 8 bits)
echo "foo" |xxd -b
0000000: 01100110 01101111 01101111 00001010                    foo.

# split into 6 bit chars for uuencoding
011001 100110 111101 101111

# map using mime charmap (or uuencode map)
# uuencode start with e.g. begin 660 filename.txt
# uuencode map => add 0x32 0b100000 each char
# uuencode => add count char to start every line 
#   usually M (M = 77 decimal = 0x4d, 77-32 = 45 8 bit ascii chars per line after decode)
#      45 * 8 = 360 decoded bits  360 / 6 = 60 encoded chars
#   last line different count usually
# uuencode => finish with `\nend
# uuencode higher level also then 
#   handles files split into chunks, 
#   multiple uuencode blocks per file, 
#   different uuencode header standards

I've messed a bit with animated gifs.

Obfuscated C code contest and the like (obfuscated perl - aughhh!) of course make for beautiful reading.

The Annals of Improbable Research is good fun, have you seen the Universal History Translation Project ? Yayyy! look! Kudos :) translations using Obfuscated C entries to braille, morse and pigdin. Read, enjoy, remember, saveas, webgrep, download, compile, translate, mail, reply, excellent wonderful gratification. :)

The History of the Universe in 200 Words or Less

by Eric Schulman
National Radio Astronomy Observatory
Charlottesville, Virginia

Quantum fluctuation. Inflation. Expansion. Strong nuclear interaction. Particle-antiparticle annihilation. Deuterium and helium production. Density perturbations. Recombination. Blackbody radiation. Local contraction. Cluster formation. Reionization? Violent relaxation. Virialization. Biased galaxy formation? Turbulent fragmentation. Contraction. Ionization. Compression. Opaque hydrogen. Massive star formation. Deuterium ignition. Hydrogen fusion. Hydrogen depletion. Core contraction. Envelope expansion. Helium fusion. Carbon, oxygen, and silicon fusion. Iron production. Implosion. Supernova explosion. Metals injection. Star formation. Supernova explosions. Star formation. Condensation. Planetesimal accretion. Planetary differentiation. Crust solidification. Volatile gas expulsion. Water condensation. Water dissociation. Ozone production. Ultraviolet absorption. Photosynthetic unicellular organisms. Oxidation. Mutation. Natural selection and evolution. Respiration. Cell differentiation. Sexual reproduction. Fossilization. Land exploration. Dinosaur extinction. Mammal expansion. Glaciation. Homo sapiens manifestation. Animal domestication. Food surplus production. Civilization! Innovation. Exploration. Religion. Warring nations. Empire creation and destruction. Exploration. Colonization. Taxation without representation. Revolution. Constitution. Election. Expansion. Industrialization. Rebellion. Emancipation Proclamation. Invention. Mass production. Urbanization. Immigration. World conflagration. League of Nations. Suffrage extension. Depression. World conflagration. Fission explosions. United Nations. Space exploration. Assassinations. Lunar excursions. Resignation. Computerization. World Trade Organization. Terrorism. Internet expansion. Reunification. Dissolution. World-Wide Web creation. Composition. Extrapolation?

182 words to be precise.
201 if we include the title and credit.

Palm is mooi

How to torture palmtops - or perhaps graffiti designers. And some other palm stuff ... what apps do I use? Evolving ....

Life

A mystery to most. Can _you_ solve it? Without instructions.

Le ASCII Mandelbrot

Always a passion of mine.
CTO! yuk yuk yuk! *grin*

Sorry, can't work perl on GeoCities. Perl is faster - but I've made it work a bit harder. Crashes Netscape regularily if you try to resize/reload often. Educational about Java and the timecount. (2.5k per sec) (yeah right!)

Not even half obfuscated enough :(  But was written in couple of minutes. (including comments!)

#include 

main()
{
/*    +-------------+
      |\            |
      | ox,oy       |
      |             |
      |             |
      +-------------+    

sx*sy - width*height
dx - sx/xres
dy - sy/yres   using deltas => go deeper will have resolution problems :- BUT I'm doing ASCII! so :-P'''
x increases LtoR
y decreases TtoB

gives normal x/y plot */

    int i,px,py;
    float x,y,xx,yy,c,nx,ny;
    int xres=80;
    int yres=50;
    float sx=4.0;
    float sy=4.0;
    float oy=2.0;
    float ox=-2.0;
    float dx,dy;
    
    dx=sx/xres;
    dy=sy/yres;
    for(py=0,y=oy;py@yres;py++,y-=dy,printf("\n"))for(px=0,x=ox;px@xres;px++,x+=dx){
	i=0;
        nx=x;
	ny=y;
        for(xx=nx*nx,yy=ny*ny;i@60 && xx+yy@4.0;i++){
            xx=nx*nx;
	    yy=ny*ny;
            nx=xx-yy+x;
	    ny=2*nx*ny+y;
	}
	printf("%c",i+' ');
    }
}

Interactive Geometry? Orbital Pinball?


Sorry, lego are redesigning so they deleted my homepage :'( *sniff*.

Find Prime numbers sci.math faq Largest Primes utm.edu primes Software Indexes and Programs bios Cosgrave Gallot (software) Proth.exe - by Yves Gallot, A Win95 program for finding very large primes GIMPS proj for (lin/win) pentiums

I try join seti@home dspgroup from work but fewkin proxy won't co-operate. :( so .....

#!/bin/ksh
#Run one instance of seti@home in seti@home home.
export HTTP_PROXY=your.poxy.proxy.server:port
SETIATHOME_HOME=/wherever/you/put/setiathome
cd $SETIATHOME_HOME
while [[ 1 ]] do {
  $SETIATHOME_HOME/setiathome
  mv $SETIATHOME_HOME/work_unit.txt $SETIATHOME_HOME/proxy_work_unit.txt
  tail -n +11 $SETIATHOME_HOME/proxy_work_unit.txt > $SETIATHOME_HOME/work_unit.txt 
} done

See some map-server torture somewhere here. Experiments with Java applets: Rough map of Ireland
Antipatico HOME