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 python3 | |
# Calculates expected time that Biden will overtake Trump in Pennsylvania | |
# base on time series data: margin over time. | |
# | |
# Example usage: | |
# $ curl "https://raw.githubusercontent.com/alex/nyt-2020-election-scraper/master/battleground-state-changes.csv" | ./calculate_margin_intercept.py | |
import csv | |
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
# hello world |
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 scala_jar(name, srcs, visibility=None): | |
native.genrule( | |
name = name, | |
srcs = srcs, | |
outs = ['%s.jar' % name], | |
cmd = 'touch $@ && scalac -d $@ $(SRCS)', | |
visibility = visibility | |
) |
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 main(): | |
print 'hello' | |
if __name__ == '__main__': | |
main() |
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 HTMLParser | |
class LinkParser(HTMLParser.HTMLParser): | |
def __init__(self): | |
HTMLParser.HTMLParser.__init__(self) | |
self.hrefs = [] |
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 | |
"""Utility to archive files by hash. | |
Gets the shasum of each file and copies the file to the specified dest_dir | |
with the hash inserted into the name. For example, IMG_011.JPG would become | |
IMG_011.ab98feb.JPG, etc This is useful for image files that might share the | |
same filename but have differing contents (such as after editing). | |
""" |
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 os | |
import logging | |
import subprocess | |
import tempfile | |
import shutil | |
def convert(src, dest): | |
_, temp_dest = tempfile.mkstemp(suffix='.mp4') | |
assert os.path.exists(src), src + ' does not exist' |
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 xml.dom | |
import os | |
import re | |
import urllib2 | |
import logging | |
import urllib | |
import mechanize | |
import getpass | |
import html5lib | |
import string |