Skip to content

Instantly share code, notes, and snippets.

@pope
pope / mp
Created March 24, 2009 03:35
#!/usr/bin/env python
import mp
import multiprocessing
if __name__ == "__main__":
multiprocessing.freeze_support()
mp.main()
def repeater(str):
return str + str
def hello():
return repeater("Hello")
import os
import gzip
import zlib
from urlparse import urlparse
from httplib import HTTPConnection
def workding_download_gzip_file(url, filename):
"""Download a gzip file and decompress it
Save the gzip file, then read it in and re-save it
from httplib.HTTPConnection
from urlparse import urlparse
def get_size_of_page(url):
o = urlparse(url)
conn = HTTPConnection(o.netloc)
conn.request("HEAD", o.path)
resp = conn.getresponse()
if resp.status == 200:
return long(resp.getheader("Content-Lenght"))
// tb.js
// TweetBackRedux 0.2 JS code
// Copyright (c) 2009 Jeremy Hilton < @jeremyhilton >
// This file is part of TweetBackRedux.
//
// TweetBackRedux is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class FileReadTest {
public static void main(String[] args) {
BufferedReader br = null;
import java.util.List;
import java.util.ArrayList;
public class Bah {
public static void main(String[] args) {
final Foo foo = new Foo();
final List<FunctionPointer<Object>> fps = new ArrayList<FunctionPointer<Object>>();
fps.add(new FunctionPointer<String>() {
@Override
o--o starting_branch_one
o--o--o--o starting_branch_two
what I want:
o--o starting_branch
\
o--o--o--o starting_branch_two
eth0 Link encap:Ethernet HWaddr 08:00:27:c3:b9:89
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:58 errors:0 dropped:0 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9690 (9.6 KB) TX bytes:3078 (3.0 KB)
Interrupt:11 Base address:0xc020
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
eth0 Link encap:Ethernet HWaddr 08:00:27:c3:b9:89
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1698 (1.6 KB) TX bytes:3428 (3.4 KB)
Interrupt:11 Base address:0xc020
eth1 Link encap:Ethernet HWaddr 08:00:27:c3:62:0c
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1