This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from string import Template | |
t = 45 | |
s = "test" | |
print Template("We have $t ${s}s.").substitute(locals()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import sys, os | |
import time | |
try: | |
import urllib2 as urllib # Python 2.5 | |
except ImportError: | |
import urllib.request as urllib # Python 3.0 | |
def main(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 3 | |
1 6 | |
2 12 | |
3 24 | |
4 48 | |
5 96 | |
6 192 | |
7 384 | |
8 768 | |
9 1536 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
from __future__ import division, with_statement | |
import sys, os | |
import subprocess | |
# This is a horrible little script written by someone who doesn't understand | |
# how to use tcpdumbp or subprocess well. It intends to display an allert | |
# whenever specified keywords (such as a password) are seen in network | |
# traffic. Along with the warning it sends 3 \x07 beeps to stdout, in case |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby --version | |
ruby 1.8.6 (2007-06-07 patchlevel 36) [universal-darwin9.0] | |
$ curl ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p71.tar.gz | tar xz | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 4692k 100 4692k 0 0 47090 0 0:01:42 0:01:42 --:--:-- 32309 | |
$ cd ruby-1.8.7-p71/ | |
$ ./configure | |
[...] | |
creating config.h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//&>/dev/null;x="${0%.*}";[ ! "$x" -ot "$0" ]||(rm -f "$x";cc -o "$x" "$0")&&"$x" $*;exit | |
#import <stdio.h> | |
#import <stdint.h> | |
#import <time.h> | |
// Setting two adjacent bits produce an oscillator of period six. | |
// Setting two bits seperated by another produce an oscillator of period four. | |
// Setting ever other bit produces a still life. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ $ sudo easy_install demjson | |
Searching for demjson | |
Reading http://www.python.org/pypi/demjson/ | |
Reading http://deron.meranda.us/python/demjson/ | |
Reading http://www.python.org/pypi/demjson/1.3 | |
Best match: demjson 1.3 | |
Downloading http://deron.meranda.us/python/demjson/dist/demjson-1.3.tar.gz | |
Processing demjson-1.3.tar.gz | |
Running demjson-1.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-KDLyNu/demjson-1.3/egg-dist-tmp-eaLyKU | |
zip_safe flag not set; analyzing archive contents... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import Image | |
rows = (0x18, 0x24, 0x7E, 0x81, 0x42, 0xE7) | |
image = Image.new("RGB", (8, 8), (255, 255, 255)) | |
pixels = image.load() | |
for y in range(len(rows)): | |
for x in range(8): | |
pixels[x, y + 1] = (0, 0, 0) if (rows[y] >> x) & 1 else (255, 255, 255) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du -k -d 1 | sort -n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sbclx | |
; I'd like to do this with map/reduce stuff, | |
; but I'll not get ahead of myself yet. | |
(let | |
((sum 0)) | |
(do | |
( | |
(i 1 (1+ i)) | |
(limit 1000) | |
) |