A few years ago I reinvented Naor and Shamir's visual one-time pad
system, although I didn't get all the way to their k-of-n secret sharing
scheme. The interesting thing about this scheme is that it allows you
to decrypt the image by placing the key on top of the ciphertext and
looking at it --- n
I thought I'd try implementing a Bloom filter in Python, just for fun,
since Python does have a nice abstraction for large bit vectors: the
long int, or bignum. Turns out it's grossly inefficient to use a single
long int for a Bloom filter because there's no way to set or clear bits
in it.
I wrot
This bot has a lot of bugs, but here it is:
#!/usr/bin/python
from __future__ import nested_scopes
### backward compatibility stuff
if not globals().has_key('file'): file = open
if not globals().has_key('True'): True = 1; False = 0
import sys
sys.path.insert(0, '/home/kragen/lib/python')
from t
Now it graphs. http://pobox.com/ragen/sw/js-calc.html
Javascript/DHTML Reverse Polish Calculator
#output div, input { padding: 1px; width: 60% }
#output div { border: 1px solid lightslategrey; margin: 1px 0 }
.instructions { float: right; width: 35%; color: darkslategrey;
backgr
// Fading cellular automaton. Inspired by George Dyson's work showing
// elementary-rule-110 executions on the IAS machine. Intended to run
// on Limor Fried's minipov2 computer, in which the PORTB of an
// ATtiny2313 is connected to 8 LEDs in a row, but will probably run
// on any AVR microcontr
I wanted to arrange a get-together among some of my busy friends, so I
wrote this little program to help.
If this were http://example.com/foo.cgi, you could send people links
such as http://example.com/foo.cgi?who=brian, and then they can check
the boxes to indicate what days they're available.
D
Was pondering drag-and-drop, so I thought I'd put together a magnetic
poetry kit in DHTML --- the simplest possible use of drag-and-drop.
I took some time selecting words --- by hand, from the most common words
in the British National Corpus, and from actual poetry --- and removing
words I thought
#!/usr/bin/python
"""Yet another curses-based directory tree browser, in Python.
I thought I could use something like this for filename entry, kind of
like the old 4DOS 'select' command --- cd $(cursoutline.py). So you
navigate and hit Enter, and it exits and spits out the file you're on.
"""
#
I was thinking last night about how an election can fail to have a
Condorcet winner, and I wondered what fraction of all possible
elections had that property.
Rather than spending half an hour looking up the answer on Google and
reading it (finding e.g. http://arxiv.org/abs/math.ST/0511140 for
thr
assert_equal(freevars([['a', 'b', 'C']]), ['C'])
assert_equal(freevars([['A', 'B', 'C']]), ['A', 'B', 'C'])
assert_equal(freevars([['A', 'A', 'A']]),
x27;,
'require that you type in the guidewords you see on ',
'up to six pages before you get to the correct page: ',
T.form(method='POST', action='page/1')[
T.input(name='q'
#!/usr/bin/python
"""Pretty-print object-calculus expressions with various bits of shorthand.
In particular, elide 'self' names on method definitions that don't
need them; use () instead of {}.'()' in ObjectDerivation expressions
enclosed in a MethodCall(x, '()'); and elide 'arg1', 'arg2', etc., i
#!/usr/bin/python
# Finite multi-mappings, like the stuff I wrote about "mvfs:
# multivalued functions" in 2003, using + and * for (commutative,
# associative) union and (non-commutative, associative) composition,
# and supporting transitive closure.
# This code only supports finite mvfs, and unl
#!/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
# Twi
#!/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 gen
# I wrote this on Beatrice's birthday, but didn't get around to posting
# it until now.
#!/usr/bin/python
# 5-dimensional hypercube with 32 vertices for Bea's 32nd birthday
# Written in Python with list-comprehensions and "sum"; works in
# Python 2.3, might work in 2.2
import random, math
def vec
/* buf.c: copyright relinquished by Kragen Sitaker, sole author */
/*
* My first mail-message-buffering strategy turned out fiendishly
* complex. So I thought maybe I'd make a better design with a couple
* of layers: one that doesn't know anything about messages and From_
* lines
#!/usr/bin/python
# I wanted to play with Ajax Push with Twisted Python, so I thought
# I'd start with the old standby: a chat app. The first step is to
# see what happens when you hold a connection open for an arbitrarily
# long time with Twisted Web: how do you tell when the connection
# closes
http://pobox.com/~kragen/sw/js-calc.html
Javascript/DHTML Reverse Polish Calculator
#output div, input { padding: 1px; width: 60% }
#output div { border: 1px solid lightslategrey; margin: 1px 0 }
.instructions { float: right; width: 35%; color: darkslategrey;
background-color: wheat; padding:
is
held entirely by Kragen Sitaker; pursuant to US law, California law,
and Kragen's employment contract with CommerceNet, this software
developed entirely on Kragen's time, with Kragen's equipment, not on
CommerceNet premises, and not related to CommerceNet's business, is
not
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 sti
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 eventuall
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 is
rsync is a remarkably versatile program. Here are some of the recent
uses I have for it.
Downloading mail
I download my mail with rsync these days. Here's my mail-downloading script:
#!/bin/sh
set -e
ssh [EMAIL PROTECTED] tail --bytes=15000 /var/mail/kragen \> tmp.mboxtail
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
kind
ether it was before
for:, I defined an initialize method that just did "self inform:
'initialize called', (textEntryList asString)." Then when I popped open
the dialog again, it told me when initialize was called, and it also
told me what textEntryList was at the time -- nil.
#!/usr/bin/python
import struct, socket, sys
# network block device server, substitute for nbd-server. Probably slower.
# But it works! And it's probably a lot easier to improve the
# performance of this Python version than of the C version. This
# Python version is 14% of the size and perhaps 2
This evaluates expressions and displays their results as you type
them. It's like some hack I posted a year ago, except that it doesn't
look quite as ugly and it has noticeably better updating behavior.
Still, it doesn't limit the time to evaluate an expression, and
doesn't effectively let you def
/*
* hash tries.
*
* Herewith a program that can dynamically construct and run a
* deterministic finite state machine, such as for matching to a trie
* or a regular expression, over a sequence of bytes, at under 100
* clock cycles per byte, and under 50 (potentially 25) bytes of
* memory per
#!/usr/bin/python
# relational algebra in Python 2.3
# Allows you to construct simple relational algebra queries in Python
# and translates them on the fly to SQL. Then you can iterate over
# the query results, which are Python dictionaries. I've tried this
# in Python 2.3, but maybe it might wo
Compatible with previously-posted Python programs, but it's a bit
fiddly to get them to work together still. Much faster. May be
enjoyable if you like optimization.
/*
maildex: find words, index by mail message byte offset
This program computes an inverted index for a mailbox file, in the
same
The Python text indexer I posted here last weekend (and, I think,
again yesterday) is too slow. Friday, after work, I hacked out
something in C to see if I could get it to be faster. It's about 10
times faster than the Python version, but it lacks some features:
- it doesn't yet do the case-insen
Thursday afternoon, after work, I hacked the full-text mail indexing
program from last weekend so it could handle arbitrarily large
mailboxes. It generates N small indices, each small enough to easily
fit into memory, then does an N-way merge on them. On Gentle, which
is a 500MHz AMD K6 with 64kB
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, am
y down to like
kind of awkward around her, and really quiet
did she visit his hometown?
/*kragen sitaker*/
(function() {
var map = function(array, cb) {
var rv = [];
for (var i = 0; i < array.length; i++) { rv[rv.length] = cb(array[i]) }
return rv;
};
var maptblrows =
Festival has a Sable XML DTD you can use to adjust the speed of
utterances, but it doesn't seem to adjust the lengths of pauses. The
default speech speed is far too slow for pleasant use. Here's a
little hack to speed up text-to-speech output a bit, with little
leftover bits in the middle to try
I implemented this BER decoder in order to help me understand SNMP
packets and debug an SNMP implementation I've been working on.
Itself, it's too slow to be useful in the implementation, but it's
great as a debugging tool. Feed it e.g. SNMP packets.
It is guaranteed to break on BER-encoded thing
It occurred to me that quadtree compression would probably work really
well for screenshots and possibly even sequences of screenshots. So I
hacked together something one night to do quadtree compression of
small arrays of values in Python.
#!/usr/bin/python
"""Quadtree image compression library.
Like other things posted here without notices to the contrary, this
code is in the public domain.
This is a relatively responsive pager program for text files, much
like 'more' or 'less', but in a GUI, so it zooms in and out with the +
and - keys.
It's written in Python with PyQt.
#!/usr/bin/pyt
Like other things posted here without notices to the contrary, this
code is in the public domain.
This program depends on a recent Python and PyQt.
I was experimenting with incremental full-text filesystem search.
This program is probably a little too clever about caching, and
clearly not clever
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 metadata
Like other things posted here without notices to the contrary, this
code is in the public domain.
I recently posted a prototype pie-menu-based input method that
included the cryptic message:
# some research from mine in June, redone with a better wordlist
# in October, suggested '
Like other things posted here without notices to the contrary, this
code is in the public domain.
So some LiveJournal meme was going around --- this list of 100 movies
where you'd bold the ones you'd seen and post it on your journal. So
I wrote a CGI script to make it easier, which was pretty sil
Like other things posted here without notices to the contrary, this
code is in the public domain.
#!/usr/bin/python
# I'd use the MetaPy dict mixin if I had one handy
"""A crude dictionary backed up by log-structured file storage.
This hack is just a proof of concept. The concept is that it's re
Like other things posted here without notices to the contrary, this
code is in the public domain.
So lately I've been using this program to read my email. It's
intended as a quick-and-dirty prototype of query-based mailreading.
Apparently there's a program called 'mboxgrep' that does something
si
Like other things posted here without notices to the contrary, this
code is in the public domain.
Here's qd.py:
def chomp(text):
while text[-1:] in ['\r', '\n']: text = text[:-1]
return text
assert chomp('a\n') == 'a'
assert chomp('\n') == ''
assert chomp('') == ''
def untabify(text):
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 tha
This is a GUI version of the two-key input method I prototyped last
summer, with an eight-way pie menu. It needs a reasonable word list
to run reasonably. It's written in Python with PyQt, so you'll need
those installed in order to use it, and it might require a recent
version of Python, too.
A
(b(b d) a)', str(insttree)
### comparison
assert atom('a') == atom('a')
assert atom('a') != atom('b')
assert integer(1) == integer(1)
assert integer(1) < integer(2)
assert integer(2) > integer(1)
assert variable('
#!/usr/local/bin/perl -w
use strict;
# This script turns a table from a web page into a list of hash refs,
# according to whatever headers it finds on the first row of the
# table. You'll need libwww-perl an HTML::TableExtract installed to
# make it run; this implies also the URI, MIME::Base64, D
TWOKEY
--
This is a crude prototype of a five-key input method based roughly on
Tegic T9, PBX extension directories, and various Chinese and Japanese
input methods for Chinese characters that I've used. Basically, to
enter text written with a large alphabet, you enter the text with a
small al
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
I described some of the problems I have with file and backup
management in a kragen-tol post in March 2002, entitled "file
catalogs and backups":
http://lists.canonical.org/pipermail/kragen-tol/2002-March/000691.html
http://www.mail-archive.com/[EMAIL PROTECTED]/msg00037.html
Now, spurred by recen
I just got Apache and perl running inside a chroot jail; this required
that I make some libraries and also all of /usr/lib/perl5 available
inside the chroot jail. So I wrote one program to hardlink libraries
into the jail, and another to hardlink all of /usr/lib/perl5. (Some
people prefer to copy
;, '76'),
('powerful', 'rejection of: somebody'),
('following', ''),
(),
('eof')], tw.output
test()
def setup_mailbox(clist):
dbroot = conn.root()
elist = gtk.GtkCList(2, ["From", "Subject"])
thelist.append(['[EMAIL PROTECTED]', 'I have a book you might like'])
thelist.append(['[EMAIL PROTECTED]', 'How are you?'])
thelist.columns_autosize()
vbox.pack_start(thelist)
window.show_all()
th
;Inputs: ");
for (ii = 0; ii < ninputs; ii++)
printf("%c ", varname(ii));
printf("\n");
}
maxgates = max_gates_for_inputs(ninputs);
done = 0;
for (ngates = 0; ngates <= maxgates; ngates++) {
printf("Trying with %d gates...\n", ngates);
free(cp);
cp = newci
Q"(7W:.J%@G
M9S+@L4;;2M4Z6H\+>@%?GRL$%&;^/2RWI76T[XG3`P\*SJ&N(@O!-R.7Y$GN
M1U[3/DJA@*[4K^IP.1$PRH>#W879WC=,V[,[V=I\B)Z[/"_8%K((5NNHBENO
M@GL('5>'8$)'*D*9A-MQK-`4RG5I+L9<`L.US0.\FQ7&K9XO[#G'+I.B7OGD@UY;BIX),V&NW,8
MN(-"M!$O0'LTR\5[>
if char in '123':
c.shrink(int(char))
elif char in [backspace, delete]:
c.expand()
elif char == '?':
msg = c.dump() + ' '
else:
msg = "unknown
= rvdict[item] + 1
except KeyError:
rvdict[item] = 1
rvlist = []
for item in lists[0]:
if rvdict[item] == len(lists):
rvlist.append(item)
return rvlist
def uniq(alist):
rvdict = {}
for item in alist:
rvdict[item] = 1
return rv
ubstr($word, -2));
}
sub miellpssed {
my ($line) = @_;
my @chnuks = split /\b([a-zA-Z]+)\b/, $line;
return map { misspell_word $_ } @chnuks;
}
if (defined $ARGV[0] and $ARGV[0] eq '-a') {
shift;
$trafnosrm = \&alabehiptze;
}
while (<>) {
print miellpssed $_;
}
--
<
v
def __call__(self, *args):
rv = instance()
for (field, value) in zip(self.args, args):
rv.__dict__[field] = value
rv.__dict__['fields'] = self.args
rv.__dict__['primary_key_fields'] = self.kwargs['primary_key']
rv.__dict__[&
x27;a(b(a d) a)', str(insttree)
insttree = atree.instantiate({'c': atom('b'), 'e': atoma})
assert str(insttree) == 'a(b(b d) a)', str(insttree)
### comparison
assert atom('a') == atom('a')
assert atom('a') !=
onnector, reason): connector.connect()
def clientConnectionFailed(self, connector, reason): reactor.stop()
def main():
irccf = blogbotfactory()
reactor.connectTCP("localhost", 6667, irccf)
reactor.run()
if __name__ == "__main__": main()
--
<[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://advogato.org/person/raph/diary.html?start=252 and
http://www.kode-fu.com/geek/2002_08_04_archive.shtml for details.
', str(insttree)
### comparison
assert atom('a') == atom('a')
assert atom('a') != atom('b')
assert integer(1) == integer(1)
assert integer(1) < integer(2)
assert integer(2) > integer(1)
assert variable('a') ==
assert atom('a') != atom('b')
assert integer(1) == integer(1)
assert integer(1) < integer(2)
assert integer(2) > integer(1)
assert variable('a') == variable('a')
assert variable('a') != variable('b')
assert a
Now it features a /moron command to translate a certain dialect into
English and a /shorten command to toggle automatic shortening of URLs.
I added the /shorten feature because people kept pasting these annoying
shortened URLs into ICB; I couldn't tell if I'd visited them or not, or
whether they
ssert that says the strings must
# differ at min_newcommonlen if they had different numbers of chars in
# common with their common parent was using the previous value of
# curlens[which] rather than its current value. This was wrong.
# read_locatedb didn't always take initial_curlen and in
persists, either your
browser doesn't support JavaScript or this page is broken for you.
Note that, as of this writing (2002-08-01), the underlying mediator
software doesn't do a very good job with words containing '"' (the
double-quote character), '/' (the slash c
e.redirect(url)
return REQUEST.response
return redirect
# stupid Zope overhead
def addForm(dummy):
"""Add a ShortURLs object."""
return """Add ShortURLs
id
Submit this!""" % (`dummy`,)
def addFunction
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
M'XL(`'&=T``^
ixed-bug log:
# - forgot \n on usage message
# - wrote 'else return astring' without 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 t
pixels in the output.
My intuition tells me this will not work for N < 3.
The saturation problem
--
Although I haven't tried it, I think this process will tend to
desaturate color images. I'm not sure how to fix that.
One general technique that might reduce the
't chdir $indir: $!";
die "zip failed" if system "zip", "-qr", $zipfile, $subdirname;
}
# delete everything under some possibly-maliciously-named directories
sub cleanup_dirs {
system 'rm', '-rf', @_;
}
sub main {
my ($script, $zipfilena
os.readlink(os.path.join(self.docsdir(), filename))
def main(argv):
if len(argv) < 2:
sys.stderr.write(usage + "\n")
return 1
if not os.path.exists(argv[1]):
sys.stderr.write("No such indexdir: " + argv[1] + "\n")
return 2
I thought I'd posted this before, but it doesn't look like I did. icb
is a chat system that helps people waste their time by typing inane
comments at each other, similar to IRC; its primary advantage is that
it is technically more primitive than IRC, so most people don't bother
to use it.
Rather
se:
sys.stderr.write("Usage: %s remotehost remotemaildir localmaildir\n" %
sys.argv[0])
sys.exit(1)
# fixed bug log:
# - forgot \n on usage message
# - wrote 'else return astring' without a ':' after 'else'
# - forgot
duce (filterer (lambda (x) (zerop (mod x 3 '(1 2 3 4 5 6 7 8 9 10)
:from-end t :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;i
nteresting words like 'adherent'
* too. */
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://
t/product.asp?entity=CableWorld&pf_ID=7A2ACA71-FAAD-41FC-A100-0B8A11C30373";.
Similarly, diff output is incomprehensible, because the line
boundaries that are so important to its semantics get lost; embedded
quotes and parenthetical remarks of any kind are difficult to
understand, bec
-
<[EMAIL 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
/* 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 that
uot;
(interactive "r")
(save-excursion
(goto-char end)
(let ((endm (point-marker)))
(unwind-protect
(progn
(goto-char start)
(while (and (<= (end-of-next-word) endm) (< (point) endm))
(pig-latin-next-word)))
(set-marke
length == 1) {
finger(arguments[0]);
} else if (arguments.length == 2) {
finger(arguments[0], arguments[1]);
} else {
System.out.println(USAGE_MSG);
}
}
}
--
<[EMAIL PROTECTED]> Kragen Sitaker <http://www.pobox.com/~kr
/* a simple oscilloscope program I wrote between 14:30 and 19:00 one
* afternoon while sitting in a mixing studio watching _K-19: The
* Widowmaker_ being made. We had just walked into a junk store where
* I had resisted buying a real oscilloscope, and I thought it would
* be really nice to ha
skippedit, newstring,
# bitindexofdifference)
def first_bit_difference(string1, string2):
for charindex in xrange(min(len(string1), len(string2))):
if string1[charindex] != string2[charindex]:
bitstart = charindex * 8
for bitindex in range(bitstart, bitstar
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 f
uot;)\n"
"Home dir: " 6 "\n"
"Shell: " 7 "\n")
forms-field-sep ":"
forms-multi-line ",")
--
<[EMAIL PROTECTED]> Kragen Sitaker <http://www.pobox.com/~kra
nless $echo =~ /^at#pbokr=$i/;
my $line = ;
if ($line eq "OK\r\n") {
print "No phonebook entry $i\n";
} else {
print $line;
expect_ok;
}
}
cleanup;
--
<[EMAIL PROTECTED]> 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
0;
while (not $brokenpipe and defined($_ = <$outsocket>)) {
$gotstuff++;
print ".";
print $socket $_;
}
print "\n";
if (not $gotstuff) {
print "No data; brokenpipe is $brokenpipe and errno is $!\n";
}
close $outsocket;
close $socket;
}
--
&l
F7S,^_WG/MX5SV$\#[G-,;[G*,4[P_=*7N7VN0N\N[R9P3>U38X
MWD7;#J_T1Z67WJ?2,2_+%:==V@B*L4ZC@+8,767A`&B/OD@$W('^.,\B9=+G
M?86Y.4O]KIIE>;_S8L&[6NKD_3\D-GG\I\TJ?8AR'3@^$?\;NWO[L^__]IM\
M_WNWM;>._U^B'#X[>O3\'?;).Q_HNF?G=0M[I=+1B\?<=E1/35)O-YMO]^MT
MX+03X1U_AZ52ICCW
me(mainwin)
areaframe.pack(expand='1', fill='both', side='top')
arealabel = Tkinter.Label(areaframe, text='Max area:')
asl = Tkinter.Scale(areaframe, orient='horizontal', command=setthreshold,
to='1000')
arealabel.pack(side='left')
asl.pack(expand='1', fill='both', side='top')
#wiggle(c)
areashorten(c)
angleshorten(c)
Tkinter.mainloop()
--
<[EMAIL PROTECTED]> Kragen Sitaker <http://www.pobox.com/~kragen/>
We have always been quite clear that Win95 and Win98 are not the systems to
use if you are in a hostile security environment. -- Paul Leach
The Internet is hostile.-- Paul Leach <[EMAIL PROTECTED]>
eturn map(lambda item: item[1], rv)
class filterdata:
"Return only data items matching a filter."
def __init__(self, datasource, filter):
self.datasource = datasource
self.filter = filter
def next(self):
while 1:
next = self.datasource.n
o "-- $NICK joins" >> "$CHANNEL"
perl -pe '$|=1; s/^/<'"$NICK"'> /' >> "$CHANNEL"
echo "-- $NICK quits" >> "$CHANNEL"
--
<[EMAIL PROTECTED]> Kragen Sitaker <http://www.pobox.com/~kragen/>
A good conversation and even lengthy and heated conversations are probably
some of the most important pointful things I can think of. They are the
antithesis of pointlessness! -- Matt O'Connor <[EMAIL PROTECTED]>
import sys, getopt
__author__ = "Kragen Sitaker <[EMAIL PROTECTED]>"
__version__ = "2"
def ruler(width, ansi=0):
"""Return an ASCII ruler for counting columns."""
rv = ''
for i in range(1, width+1):
i
uot;~" nil t) (replace-match "~t" nil t)
; maybe I should use tempo.el for this?
(defun start-message ()
"Start a new mailmsg.py message at the end of the buffer."
(interactive)
(end-of-buffer)
(insert "~m\n")
(save-excursion
(insert-s
The simplest useful XML parser application is one that copies an input
XML document, or at least copies interesting parts of it, to some
output. Here's an implementation of that application using Python's
standard XML support modules.
#!/usr/local/bin/python
# simplest useful XML application
imp
Python includes a zipfile module, which uses zlib to give you read and
write access to zipfiles. Info-ZIP unzip, the standard unzip for
Unix, is in Debian non-free for some reason, probably because its
license doesn't meet the Debian Free Software Guidelines; this is a
free-software alternative.
This is pretty lame, even for kragen-hacks. But it might tell someone
how to do something actually useful at some point.
#!/usr/local/bin/python
# 'tkcat'
# How to handle asynchronous filehandle (stdin/stdout) I/O (on Unix)
# from the Tk event loop in Python --- mostly in the nature of an
# exec
I wrote this script to tell me what files seemed likely to need
backing up. It doesn't work nearly as well as I'd like, mostly
because dpkg doesn't manage all the files I wish it did.
Here's the rationale:
To make my laptop easy to back up, I will segregate things that need
backing up and thing
1 - 100 of 128 matches
Mail list logo