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
| # [string] -> [[path component]] | |
| components = lambda lines: map(lambda s: s.split('/')[1:], map(lambda s: s.strip(), lines)) | |
| # [component] -> {c1: {c2: {c3: ...}}} | |
| rawtree = lambda x: reduce(lambda l,k: {k:l if type(l) is dict else {l:{}}}, x[::-1], {}) | |
| # [{c1: {c2: a}, {c1: {c3: a}] -> {c1: {c2: a c3: a}} | |
| reducefn = lambda t,e: (lambda key=e.keys()[0]: (lambda oval=t.get(key): \ | |
| dict( \ | |
| filter(lambda i: i[0] != key, t.items()) + [ \ |
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
| #include <sys/types.h> | |
| #include <sys/sendfile.h> | |
| #include <sys/socket.h> | |
| #include <arpa/inet.h> | |
| #include <netinet/in.h> | |
| #include <netinet/tcp.h> | |
| #include <errno.h> | |
| #include <unistd.h> | |
| #include <limits.h> | |
| #include <fcntl.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
| sky ~ 0 % at 06:30 | |
| mpc play | |
| commands will be executed using /usr/local/bin/zsh | |
| job 1309318200.c at Wed Jun 29 06:30:00 2011 | |
| sky ~ 0 % mpc stop | |
| volume: 99% repeat: on random: on single: off consume: off | |
| sky ~ 0 % atq | |
| no files in queue. | |
| sky ~ 0 % at 06:45 | |
| mpc play |
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
| /* | |
| * Disables hfs+ journal | |
| * origin: http://dmunsie.wordpress.com/code/hacks/ | |
| * | |
| * compiles on linux | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.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
| // | |
| // VKBlockSelector.h | |
| // | |
| #include <objc/runtime.h> | |
| #import <Foundation/Foundation.h> | |
| /* | |
| * note: each file has its own! | |
| */ |
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
| import os, sys, socket, time | |
| socket.setdefaulttimeout(10) | |
| r,w = socket.socketpair() | |
| def child(): | |
| try: | |
| print r.recv(10) | |
| except socket.timeout: |
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
| socketpair(PF_FILE, SOCK_STREAM, 0, [3, 5]) = 0 | |
| fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) | |
| fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 | |
| fcntl(5, F_GETFL) = 0x2 (flags O_RDWR) | |
| fcntl(5, F_SETFL, O_RDWR|O_NONBLOCK) = 0 | |
| clone(Process 11378 attached | |
| child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f09b91b59d0) = 11378 | |
| [pid 11377] select(0, NULL, NULL, NULL, {1, 0} <unfinished ...> | |
| [pid 11378] poll([{fd=3, events=POLLIN}], 1, 10000 <unfinished ...> | |
| [pid 11377] <... select resumed> ) = ? ERESTARTNOHAND (To be restarted) |
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
| import sys | |
| import pdb | |
| import socket | |
| class Rdb(pdb.Pdb): | |
| def __init__(self, port=4444): | |
| self.old_stdout = sys.stdout | |
| self.old_stdin = sys.stdin | |
| self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
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 macruby | |
| framework 'Cocoa' | |
| framework 'CoreData' | |
| def path(p) NSURL.fileURLWithPath p end | |
| def moc_init(mompath, sqlitedbpath) | |
| mom = NSManagedObjectModel.alloc.initWithContentsOfURL mompath |
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
| oictl% cat /usr/bin/nroff | |
| #!/bin/sh | |
| echo $* >&2 | |
| arg=$(eval echo \$$#) | |
| [ $arg = "-" ] && exec /opt/local/bin/mandoc < /dev/stdin || exec /opt/local/bin/mandoc $arg |