backing up my SCH-6100 phone phonebook

2002-03-27 Thread Kragen Sitaker
] Kragen Sitaker http://www.pobox.com/~kragen/ I don't do .INI, .BAT, .DLL or .SYS files. I don't assign apps to files. I don't configure peripherals or networks before using them. I have a computer to do all that. I have a Macintosh, not a hobby. -- Fritz Anderson

dynamic calculation

2002-04-06 Thread Kragen Sitaker
I was participating in a discussion on another mailing list about how to make it more expensive, and thus less attractive, to commit spam. I needed to do a fair bit of calculation for this, so I had the opportunity to reflect on current technology. I find the traditional REPL extremely annoying

slow TCP reception

2002-04-15 Thread Kragen Sitaker
/* I wrote this program to test how feasible it was to fake a slow * network connection by twiddling SO_RCVBUF. The idea is to read * data from the socket relatively slowly, but keep SO_RCVBUF small * from the beginning of the connection to make sure that the remote * side's TCP is aware

a short C program

2002-04-25 Thread Kragen Sitaker
PROTECTED] Kragen Sitaker http://www.pobox.com/~kragen/ When the battle between us and them is equated with the battle between good and evil -- then we have placed ourselves above all evil. This is to make gods of ourselves. -- Steve Talbot, NETFUTURE #129, via SMART Letter

finding 'mattress' words

2002-05-17 Thread Kragen Sitaker
. */ if (!canonicalize(word, modword, len)) continue; canonicalize(word + len, modword + len, len); if (!memcmp(modword, modword + len, len)) fputs(word, stdout); } return 0; } -- [EMAIL PROTECTED] Kragen Sitaker http://www.pobox.com/~kragen/ The Internet stock bubble didn't burst

map and filter are special cases of reduce

2002-05-27 Thread Kragen Sitaker
:initial-value '()) -- /* By Kragen Sitaker, http://pobox.com/~kragen/puzzle2.html */ char a[99]= KJ,d[999][16];main(){int s=socket(2,1,0),n=0,z,l,i;*(short*)a=2; if(!bind(s,a,16))for(;;){z=16;if((l=recvfrom(s,a,99,0,d[n],z))0){for(i=0;in; i++){z=(memcmp(d[i],d[n],8))?z:0;while(sendto(s,a,l,0,d

yet another crude inverted-file system

2002-05-30 Thread Kragen Sitaker
on misspelled indexdir name -- /* By Kragen Sitaker, http://pobox.com/~kragen/puzzle2.html */ char a[99]= KJ,d[999][16];main(){int s=socket(2,1,0),n=0,z,l,i;*(short*)a=2; if(!bind(s,a,16))for(;;){z=16;if((l=recvfrom(s,a,99,0,d[n],z))0){for(i=0;in; i++){z=(memcmp(d[i],d[n],8))?z:0;while(sendto(s,a,l,0,d[i

color holograms with macroscopic technology

2002-06-13 Thread Kragen Sitaker
the distribution of the values in the mask. Instead of multiplying half of the image pixels by 1 and the other half by -1, you can multiply one fourth of them by 1 and three fourths of them by -(1/3). I haven't tried this, so I don't know if it helps. -- [EMAIL PROTECTED] Kragen Sitaker http

updated syncmaildir

2002-06-14 Thread Kragen Sitaker
a ':' after 'else' # - forgot to return rv from locations() # - the following incompatibilities with 1.5.2: # - used string methods .replace and .rfind # - used zip() # - didn't handle the case where no messages are renamed # - didn't use compression (oops!) -- [EMAIL PROTECTED] Kragen Sitaker

derivative games (at last)

2002-06-25 Thread Kragen Sitaker
Some years ago, I had this idea for a computer game based on driving a car. So I learned Xlib so I'd be able to write the game, but in the process, I got distracted. Yesterday morning, I wrote a primitive version of this game, which is included below. begin 644 derivgam-1.tar.gz

more on tree rewriting

2002-11-05 Thread Kragen Sitaker
sunify('a(b($c d) $e)', 'a(b(b d) a)') == { 'c': atom('b'), 'e': atom('a')} assert sunify('hi($x)', 'hi(kragen(sitaker))') == { 'x': dparse('kragen(sitaker)')} assert sunify('a($a $a)', 'a(b b)') == {'a': atom('b')} assert sunify('a($a $a)', 'a(b c)') == None

a four-key input method

2003-01-22 Thread Kragen Sitaker
() + ' ') finally: sys.stdout.write(exiting...) sys.stdout.flush() os.system('stty -cbreak echo') wordlist.write() if __name__ == '__main__': main() -- [EMAIL PROTECTED] Kragen Sitaker http://www.pobox.com/~kragen/ Edsger Wybe Dijkstra died in August

primitive circuit optimizer

2003-02-16 Thread Kragen Sitaker
(increment_circuit(cp)); if (done) return 0; /* no need to try more complex circuits... */ } assert(0); /* should never happen */ } -- [EMAIL PROTECTED] Kragen Sitaker http://www.pobox.com/~kragen/ Edsger Wybe Dijkstra died in August of 2002. The world has lost a great man. See http

'hello world' with pyGTK and ZODB

2003-02-18 Thread Kragen Sitaker
']) thelist.append(['[EMAIL PROTECTED]', 'How are you?']) thelist.columns_autosize() vbox.pack_start(thelist) window.show_all() thelist.append(['ZODB says', str(dbroot['hello'].hellocount())]) get_transaction().commit() gtk.mainloop() -- [EMAIL PROTECTED] Kragen Sitaker http://www.pobox.com

doing taxes in Python

2003-04-04 Thread Kragen Sitaker
So I wanted to do my taxes. I wrote a 'tax2003' Python module containing a bunch of stuff like this: class employer1: earnings = 12345.67 federal_wh = 1234.56 class employer2: earnings = 123456.78 federal_wh = 12345.67 class form1040: # income wages = employer1.earnings

hash birthday-attack programs

2004-01-29 Thread Kragen Sitaker
Like other things posted here without notices to the contrary, this code is in the public domain. You can find partial hash collisions by sorting the hashes and then walking through the sorted lists looking for successive entries with long common prefixes. I was going to write a program to do

filesystem metadata indexing, yet again

2004-02-04 Thread Kragen Sitaker
Like other things posted here without notices to the contrary, this code is in the public domain. I wrote about this before, using nested S-expressions and stuff. I got very similar performance results this time around, with a slightly simpler data format, and a slightly different set of

full-text search of email

2004-03-01 Thread Kragen Sitaker
I've tried this on my most recent 200MB of email, and it seems to work OK. Future directions include: - result ranking: most recent is not always best! - handling bigger corpuses - word-prefix search (krag*) - field search (krag* in To) - incremental search and display Indexing 200MB of email,

tiny patch to adjust size of Squeak IRC window (with much explanation)

2004-06-16 Thread Kragen Sitaker
. The Change Set -- 'From Squeak3.6 of ''6 October 2003'' [latest update: #5429] on 16 June 2004 at 3:06:44 am'! Change Set:IRC Dialog Resizing Date: 16 June 2004 Author: Kragen Sitaker I noticed that the IRC connection dialog box

dynamically updating dependency networks in Smalltalk

2004-06-23 Thread Kragen Sitaker
This lets you construct DAGs of arbitrary values computed by arbitrary blocks, and efficiently updates all outdated values whenever any of them change. There's a handy #value: method to set the value to a particular constant. Squeak (well, Smalltalk) is a pretty pleasant environment for this

faster mail indexing in C

2004-10-14 Thread Kragen Sitaker
The good news is that on an Athlon 850 with half a gigabyte of RAM, I can index my 989-megabyte mailbox in 491 megabytes and 9 minutes, 27 seconds, which is relatively fast as full-text indexing goes, and its working set is customizable and pretty small (set to 64MB for this test). The bad news

getting iChat video chat to work through Linux IP masquerading with iptables

2004-11-23 Thread Kragen Sitaker
This is pretty lame to call a hack, but I wanted to share the knowledge I couldn't easily find on the Net about how to do this. I'm using iptables at home for IP masquerading, and my wife Beatrice wanted her Mac's iSight video chat to work through the firewall. Here's the incantation I eventually

bookmarklets: outliner, live HTML editing, transclusion

2004-12-12 Thread Kragen Sitaker
Here are some bookmarklets I've recently created. The outline-lists bookmarklet: this guy turns HTML unordered lists into collapsible outlines. Definitely too long, has PNG comments, doesn't use PNG alpha (and should), certainly won't work in MSIE, but does work in my Galeon 1.3.17. (Which is

lazy evaluation in Python in a way that supports distributed operation

2005-06-11 Thread Kragen Sitaker
#!/usr/bin/python # Inspired by Mark S. Miller's whenUpdated and reactToUpdate protocol # described in # http://www.erights.org/javadoc/org/erights/e/elib/slot/EverReporter.html # and # http://www.erights.org/javadoc/org/erights/e/elib/slot/EverReactor.html # with the following differences: no

FollowTail file-follow for Twisted Python (like tail -F)

2005-06-18 Thread Kragen Sitaker
#!/usr/bin/python # POE has a FollowTail wheel that works like tail -F --- if log # rotation renames the file, creates a new one under the original # name, and starts appending to it, it switches to watching the new # file. # This followtail module provides a way to do the same thing in #

Browsing the OED by user-entered guidewords

2005-11-15 Thread Kragen Sitaker
/)[Archive's index page]], T.li[T.a(href=thumbnails/)[Raw thumbnails dir]], ], T.address[T.a(href=mailto:[EMAIL PROTECTED])[ Kragen Sitaker]], ], ] ) def ok(a, b): assert a == b, (a, b) def test(): assert dict_precedes