This file contains 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 | |
# -*- coding: utf-8 -*- | |
print "While:", | |
n = range(3) | |
while n: | |
print n.pop(), | |
else: | |
print "else!", | |
This file contains 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
# udp2log: | |
# separate hosts | |
cd /a/otto/mobile-sleuth.2/udp2log.orig | |
for host in cp104{1,2,3,4}; do | |
grep -P "^$host" mobile.2013-01-13_11.45.00-13.15.00.log | awk '{print $2 " " $3}' | sort -n > ../$host.udp2log.seq | |
done | |
# hdfs: | |
# separate hosts |
This file contains 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
#!/bin/bash | |
for host in cp104{1,2,3,4}; do | |
first_seq=$(head -n 1 $host.udp2log.seq | awk '{print $1}') # && echo $first_seq | |
last_seq=$(tail -n 1 $host.hdfs.seq | awk '{print $1}') # && echo $last_seq | |
should_be=$(echo "$last_seq - $first_seq + 1" | bc) #&& echo $should_be | |
# count lines in blog.hdfs.seq file between $first_seq and $last_seq | |
hdfs_count=$(sed -n -e "/^$first_seq/,/^$last_seq/p" $host.udp2log.seq | wc -l) #&& echo $hdfs_count |
This file contains 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
fs = require 'fs' | |
files1 = files2 = null | |
unless process.argv[2] | |
err, files1 <- fs.readdir '/Users' | |
err, files2 <- fs.readdir '/usr' | |
console.log err, files1, files2 |
This file contains 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 node | |
// Listens for UDP packets, sending the stream to stdout and | |
// also teeing it to another port on the local machine. | |
// | |
// Usage: teegram.js LISTEN_PORT TEE_PORT | |
var dgram = require('dgram'); |
This file contains 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
Arg Name or Optional Flags: | |
positional : str = "foo" | |
options : str = "-f", "--foo" | |
Standard: | |
action : str = [store], append, store_true, store_false, store_const, append_const, version | |
default : * = [None] | |
type : callable = [str], argparse.FileType(mode='wb', bufsize=0) | |
Exotic: |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
""" Prints image dimensions. | |
""" | |
__author__ = 'David Schoonover <[email protected]>' | |
import sys, re, argparse | |
from subprocess import Popen, PIPE, STDOUT, check_output | |
from path import path | |
from bunch import * |
This file contains 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
svg { | |
font: 10px sans-serif; | |
} | |
.axis path, .axis line { | |
fill: none; | |
stroke: #000; | |
shape-rendering: crispEdges; | |
} |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
# TextMate command to correct block indentation for languages with | |
# semantic whitespace (like Python or CoffeeScript). | |
# | |
# Command settings: | |
# input: Selected Text or Document | |
# output: Replace Selected Text | |
# activation: cmd+shift+R |
This file contains 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
# Technically, this is Coco, not CoffeeScript, but close enough. | |
{ toString:objToString } = Object:: | |
isArray = Array.isArray or (o) -> objToString.call(o) is '[object Array]' | |
slice = [].slice | |
class exports.EventEmitter | |