Log in

October 23rd, 2009

12:58 pm - PDF Concatenation
  pdftk *.pdf cat output /tmp/foo.pdf

Looks like it can do a bunch of other useful stuff too.

(2 comments | Leave a comment)

February 26th, 2009

10:21 pm
1 pt apricot nectar + 1 pt sparkling mineral water + .5 pt awesome FTW!

(1 comment | Leave a comment)

May 16th, 2008

01:26 pm
Sheep!: http://www.sl4.org/wiki/TheSimpleTruth

(1 comment | Leave a comment)

December 19th, 2007

11:41 pm
avani made me upload some user pics.

(2 comments | Leave a comment)

March 25th, 2007

10:04 am
drawing personality

Your friends and associates should generally find you a dependable and trustworthy person.
You are a direct and forthright person. You like to get to the core of the issue right away, with few signs of hesitation.
You like following the rules and being objective. You are precise and meticulous, and like to evaluate decisions before making them.
You have a sunny, cheerful disposition.

What does your drawing say about YOU?

(2 comments | Leave a comment)

September 25th, 2006

08:50 pm - Cat!
From Cat!

Safe and sound and grungy!

(6 comments | Leave a comment)

April 25th, 2006

07:55 pm
Want to have fun while picking up heavy stuff, solving discrete knapsack and bin-packing problems, then putting it down? Are you in Silicon Valley? Nothing to do Friday night?

Then you want to come to my Moving Party. Yay!
  • When: Friday, April 28th. 7pm onwards
  • Where: My Place, Mountain View, to My New Place, Sunnyvale (about 6 miles)
  • Bring: muscles, friends, handy moving equipment (although I don't expect to need it, 'cause I can lift nearly everything myself...)
  • I'll supply: Mostly packed stuff, drinks, pizza, limited vehicular space, etc.
The plan:
  1. Move stuff
  2. Repeat step 1 until done, or bored
  3. Hang out in Sunnyvale.
(Because it worked so well for patrissimo and choiceful...)

(4 comments | Leave a comment)

March 4th, 2006

01:26 am - Mucking with big datafiles in python
This version isn't exactly optimized...

import array
import struct


def csviter(file, type):
    Pseudo-parses a csv file with a single record and iterates over the
    return sepiter(file, ',', type)

# Turn a 4 byte binary string into a float
def unpackfloat(binstring):
    x = struct.unpack('f', binstring)
    return x[0]

def sepiter(file, sep, type,
            skip=str.isspace, blocksize=None):
    Iterate over elements in file seperated by sep.
      file: file-like object that supports .read(size)
      sep: single character seperator.
      type: function to call to create each item from a string
      skip: Filter function. If true, skips the given item.
            Applied to string value before type.
            Defaults to str.isspace.
      blocksize: how many bytes to read at once.
          Defaults to value of the global BLOCKSIZE at construction time.
    assert len(sep) == 1, "sep must be a single character"
    if blocksize is None: blocksize = BLOCKSIZE
    buffer = array.array('c')
    end = None # the end of the data for the current item

    # Loop over every item in the input
    while True:

        # Fill buffer until EOF or it includes sep.
        # Return if out of buffer and out of input
        while True:
                end = buffer.index(sep)
            except ValueError:
                data = file.read(blocksize)
                if not data and not buffer:
                    # Out of buffered data and file data. All done.
                if not data:
                    # EOF. Continue processing buffered data.
                    end = len(buffer)
                buffer.fromstring(data) # O(N) / O(N^2) faster than .extend

        # The buffer has some data in it. Pull and yield a single value.
        item = buffer[:end].tostring()
        # Erase item + sep. If array.index had a start argument, we could
        # avoid shifting the entire array here.
        buffer[:end + 1] = array.array('c')
        if not skip(item):
            yield type(item)

def biniter(file, recordsize, type, recordblocksize=None):
    Iterate over fixed size records in a file.
      file: File-like object that supports .read(size)
      recordsize: Number of bytes in a single record.
      type: Type constructor for each item.
      recordblocksize: Number of records to read from the input at a time.
          Defaults to the number of records that can fit in BLOCKSIZE rounded
          up to the next whole record. 
    if recordblocksize is None:
        recordblocksize = int((BLOCKSIZE / float(recordsize))+.5)
    buffer = array.array('c')
    buffer_pos = 0
    blocksize = recordsize * recordblocksize
    while True:
        while len(buffer) - buffer_pos < recordsize:
            data = file.read(blocksize)
            if not data and buffer_pos >= len(buffer):
            if buffer_pos == len(buffer):
                buffer_pos = 0
                buffer = array.array('c')
            elif len(buffer) > blocksize:
                buffer[:buffer_pos] = array.array('c')
                buffer_pos = 0
            if not data:
        yield type(buffer[buffer_pos:buffer_pos+recordsize].tostring())
        buffer_pos += recordsize

(Leave a comment)

February 26th, 2005

09:52 pm
If you're a computery person, it's likely that my dad's blog will be of interest: http://wilsond.blogspot.com/

(Leave a comment)

February 13th, 2005

08:27 pm - Ties that bind
Avani found a paper that describes tie tying in a way that's actually understandable. Yay!

(Leave a comment)

Peter Wildani

> Recent Entries
> Archive
> Friends
> Profile
> previous 10 entries

> previous 10 entries
> Go to Top