Skip to content

Instantly share code, notes, and snippets.

Ted Han knowtheory

Block or report user

Report or block knowtheory

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View lftp example
$ lftp -d newftp.epa.gov
> user anonymous
> set ftp:ssl-allow false
> ls
> cd GKM_DOCUMENTS
> mirror -c FOIA_PROD_7.29.16
View elision.js
var elide = function(arr) {
// assume arr is sorted, or put it through a sort right here.
var tokens = []; // this'll be what gets output at the end.
var startOfRun = arr[0]; // pretend we have a stack. This is the first value pushed onto the stack.
var currentEndOfRun = startOfRun; // this is the top of our pretend stack.
var coalesce = function(start, end){ return "" + ((start != end) ? ""+start+"-"+end : start); }
// Consider each number in the array and it's relationship to the current run on the stack.
for (var i=1; i < arr.length; i++) {
// If the nextNumber is adjacent to the value at the top of the stack
View gist:4cfb42ee09317f53a059

No it's not always given, but that itself is a complicated issue.

This particular topic has been approached from a variety of different angles in reporting. I've seen reporting focused on the misery/impact on individuals and the way that even tiny fines snowball. I know of at least one township in Ohio that was dissolved by state courts because it was essentially just a speed trap scam along I-70 (New Rome). I've seen people talk about filling budget gaps with tickets & fines.

I worry that Ryan's right that this is the kind of issue that's too big or ultimately too rooted policy to bring to the ground w/o a hook like tragic consequences of what is ultimately shitty ad hoc policing, judicial and tax policy.

So, the question of whether the public is responsible for paying attention is also a complicated topic... because citizens don't have a systemic understanding of governance or things like how police departments are funded.

When Chief Belmar says that thi

View openssl_20150319.txt
OpenSSL Security Advisory [19 Mar 2015]
=======================================
OpenSSL 1.0.2 ClientHello sigalgs DoS (CVE-2015-0291)
=====================================================
Severity: High
If a client connects to an OpenSSL 1.0.2 server and renegotiates with an
invalid signature algorithms extension a NULL pointer dereference will occur.
@knowtheory
knowtheory / google_docs_scraper.js
Created Jan 13, 2015
Google Drive has an in document javascript API which allows you to do powerful and crazy things like build a web scraper that runs on a timer. When in a google spreadsheet, go to the tools menu and select "script editor".
View google_docs_scraper.js
// Fetch and append the current temperature
function fetchAndAppendWeather() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getActiveSheet();
// All the actual work is done in the top row.
// We get the link stored in cell A1 (say http://www.wunderground.com/cgi-bin/findweather/getForecast?query=02217 )
var weatherLink = sheet.getRange("A1").getValue();
// we set a formula importing a targeted portion of the web page
View 4syllables.rb
# You can get cmudict, a phonetic dictionary of english used for speech recognition purposes, here: http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict.0.7a
entries = File.open('/Users/ted/data/cmudict.0.7a.txt').read.split("\n"); ''
dict = entries.map{ |e| e.split }.reject{ |e| e.first =~ /^;;;/}; ''
results = dict.map do |entry|
char_count = entry.first.size
phonemes = entry.slice(1,entry.size)
phonemes.select{ |p| p =~ /\d/ }.size == 4 ? [entry, char_count] : nil;
end.compact.sort_by{ |e| e.last }; results.size
@knowtheory
knowtheory / describe_instances.txt
Created Sep 10, 2014
Documentation for the AWS ruby gem in a format that's actually comprehensible for humans to read.
View describe_instances.txt
"Calls the DescribeInstances API operation.\n
@param [Hash] options\n
* `:dry_run` - (Boolean) \n
* `:instance_ids` - (Array&lt;<String>) One or more instance IDs. Default: Describes all your instances.\n
* `:filters` - (Array&lt;<Hash>) One or more filters.
architecture - The instance architecture (i386 | x86_64).
availability-zone - The Availability Zone of the instance.
block-device-mapping.attach-time - The attach time for an Amazon EBS volume mapped to the instance.
block-device-mapping.delete-on-termination - A Boolean that indicates whether the Amazon EBS volume is deleted on instance termination.
block-device-mapping.device-name - The device name for the Amazon EBS volume (for example, /dev/sdh). block-device-mapping.status - The status for the Amazon EBS volume (attaching | attached | detaching | detached).
View keybase.md

Keybase proof

I hereby claim:

  • I am knowtheory on github.
  • I am knowtheory (https://keybase.io/knowtheory) on keybase.
  • I have a public key whose fingerprint is FEC1 0FEA F6E0 2ED4 B402 8629 B8FB F68F BD05 6639

To claim this, I am signing this object:

View gist:0a4a62eb46e32d47bbfe
  • Ninja Tune
    • ColdCut
    • Chris Bowden
    • the Heritage Orchestra
    • Mr. Scruff
  • BT
  • Paul van Dyk
  • Above & Beyond
  • Alarm Will Sound
  • Art of Trance
View tesseract_homebrew_formula.rb
require "formula"
class Tesseract < Formula
homepage 'http://code.google.com/p/tesseract-ocr/'
url 'https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz'
sha1 'a950acf7b75cf851de2de787e9abb62c58ca1827'
revision 2
bottle do
sha1 "5949807031e5d1a5c4382ed93afa06e684be104f" => :mavericks
You can’t perform that action at this time.