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/local/bin/python | |
import openpyxl | |
from openpyxl.utils.exceptions import InvalidFileException | |
import tornado.options | |
import os.path | |
import csv | |
import sys | |
import xlrd | |
import datetime |
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 | |
# Calculate the ratio of ingredients needed for the perfect quantity of pizza dough | |
# | |
# $ pizza.py --target-oz=49 | |
# target: 49.00oz 1389gram | |
# flour: 800 grams (400 x 2) | |
# water: 520 grams | |
# salt: 16 grams | |
# sugar: 12 grams |
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
def compare(a, b): | |
""" | |
Compare two version strings. | |
:return -1, 0, 1 | |
:rtype: int | |
""" | |
a = map(_cast_int, a.split('+', 2)[0].split('.')) | |
b = map(_cast_int, b.split('+', 2)[0].split('.')) |
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
import json | |
import logging | |
import nsq | |
import sys | |
import tornado | |
import tornado.options | |
def handle_message(message): | |
print json.loads(message.body)['u'] | |
message.finish() |
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
A follow up to stats for the first 200 at https://on.jehiah.cz/29J6lIX | |
Violations Cited | |
# each ∎ represents a count of 4. total 365 | |
no passing zone - NY VTL 1126 [ 1] (0.27%) | |
(fhv) use/threat physical force - 54-12(g) [ 1] (0.27%) | |
no tint below 70% - VTL 375(12-a)(b)(2) [ 1] (0.27%) | |
(fhv) yield sign violation - 54-13(a)(3)(ix) [ 1] (0.27%) | |
(taxi) improper passing - 55-13(a)(3)(xi) [ 1] (0.27%) | |
(fhv) threats - 54-12(f) [ 1] (0.27%) |
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 | |
""" | |
Pivot a CSV file | |
$ cat <<EOF | python pivot_csv.py --numeric --headers | |
> row,column,value | |
> r1,c1,1 | |
> r1,c2,1 | |
> r1,c1,5 |
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
A follow up to stats for the first 100 at https://bit.ly/1Se07j7 | |
Violations Cited | |
# each ∎ represents a count of 3. total 221 | |
no tint below 70 % - VTL 375(12-a)(b) [ 1] (0.45%) | |
use/threat of physical force - 54-12(g) [ 1] (0.45%) | |
no passing zone - NY VTL 1126 [ 1] (0.45%) | |
(fhv) unsafe lane change - 55-13(a)(3)(xii) [ 1] (0.45%) | |
obstructed license plate - NY VTL 402(b) [ 1] (0.45%) | |
(taxi) yield sign violation - 54-13(a)(3)(ix) [ 1] (0.45%) |
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
package main | |
// This script is designed to check ruleset files in HTTPS-Everywhere for duplicate target definitions | |
import ( | |
"encoding/xml" | |
"flag" | |
"path/filepath" | |
"io/ioutil" | |
"log" |
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
package nsqutils | |
import ( | |
"sync" | |
"time" | |
"github.com/nsqio/go-nsq" | |
) | |
// Producer is an interface that nsq.Producer fulfills |
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
package main | |
import ( | |
"bufio" | |
"errors" | |
"flag" | |
"fmt" | |
"net/http" | |
"os" | |
"sync" |