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
| // $ 6g echo.go && 6l -o echo echo.6 | |
| // $ ./echo | |
| // | |
| // ~ in another terminal ~ | |
| // | |
| // $ nc localhost 3540 | |
| package main | |
| import ( |
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
| """ | |
| Helpful utilities for running a standard POSIX daemon. | |
| - daemonize() - creates a proper POSIX daemon | |
| - already_running() - ensures a single instance of the daemon | |
| - get_logger() - sets up logging to syslog for the daemon | |
| - drop_privileges() - change user if started with superuser | |
| Reference: Advanced Programming in the UNIX Environment, 2nd Ed., | |
| Stevens, pg. 426, 432, 454. |
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
| #!/bin/sh -e | |
| # | |
| # ~ liberty.sh ~ | |
| # | |
| # Linux port of the Freedom network-disabling software for Mac & Win: | |
| # http://macfreedom.com/ | |
| # | |
| # It is a Linux version of beloved Mac/Win software, therefore it is | |
| # appropriately obscure and hard to use (but free!). | |
| # |
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 urllib, os, time, glob, urlparse, errno, sys, getpass, re | |
| from xml.dom.minidom import parseString as parse | |
| API_PATH = '/api/read' | |
| MAX_NUM_PER_REQUEST = 50 | |
| class BadLogin(Exception): pass | |
| def make_api_url(tumblr): |
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 | |
| """ | |
| Tallies up the geocoded tweets and geo-enabled users in your Twitter social graph / friend | |
| timeline, at most for the last 3,200 friend tweets (as rate-limited by the Twitter API) | |
| Prints some stats to stderr, the geocoded tweets in JSON format to stdout | |
| I would execute it like so: | |
| $ ./geo_tweet_stats.py username password | tee geotweets.json |
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
| #!/bin/bash | |
| set -e -x | |
| export DEBIAN_FRONTEND=noninteractive | |
| apt-get update && apt-get install -y siege | |
| siege -c 100 --time=10m --user-agent="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.2pre) Gecko/20100207 Ubuntu/9.10 (karmic) Namoroka/3.6.2pre" http://ec2-174-129-96-143.compute-1.amazonaws.com/index.html | |
| shutdown -h now |
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 urllib, re | |
| from pprint import pprint as pp | |
| from datetime import datetime, timedelta | |
| from geopy.geocoders import Google | |
| import MySQLdb | |
| from time import sleep | |
| bcpd_arc_url = "http://maps.baltimorepolice.org/servlet/com.esri.esrimap.Esrimap?ServiceName=BaltimorePolice&CustomService=Query&ClientVersion=3.1&Form=True&Encode=False" | |
| districts={"Northwest": |
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
| FF 3.5 | |
| | Run | String(fn) | fn + "" | | |
| |-----+-------------+-----------| | |
| | 1 | 0.658 | 0.617 | (time in sec.) | |
| | 2 | 0.666 | 0.617 | | |
| | 3 | 0.651 | 0.61 | | |
| | 4 | 0.651 | 0.611 | | |
| | 5 | 0.653 | 0.621 | | |
| |-----+-------------+-----------| |
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
| (def state (ref {})) | |
| (def nonword "\n") | |
| (defn get-words | |
| [] | |
| (loop [words []] | |
| (let [line (read-line)] | |
| (if (nil? line) | |
| words |
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
| Rush Limbaugh all tore into him as nominee, could completely | |
| alter the structure of her considerable enthusiasm into | |
| persuading even the rare greater red horse that make solar cells, | |
| a Ways and Means they are also, by and large ways, in gentler, | |
| politer interactions with ministers and churches. That's really | |
| how I first came into this thinking it was easy to surmise that | |
| the mainstream of his shot-up airplane that paralyzed his right | |
| arm paralyzed. Or the story of the world over, and scapegoating | |
| the brown-skinned Other who is seeking an exemption in the | |
| country--and board chair Hank Dittmar, an expert on ... |