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 difflib | |
def neighbours(table, entry): | |
neighbour_list = difflib.get_close_matches(entry, table) | |
returns = {} | |
for neighbour in neighbour_list: | |
returns[neighbour] = difflib.SequenceMatcher(None, entry, neighbour).ratio() | |
return returns |
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
fi = open ('vizallas.txt', 'r') | |
fo = open ('vizallas.tsv', 'w') | |
year = '' | |
for li in fi: | |
# fixup days not existing in a given month | |
it = li.strip().replace(' ',' ... ').split(' ') | |
if len(it) < 2: |
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
# to export your miso history | |
# register an app at http://gomiso.com/oauth_clients | |
# gain your consumer_key and consumer_secret | |
# grab Gomiso Python from https://github.com/metabaron/Gomiso-Python | |
# and your ready to go | |
# | |
# cc 2013 soobrosa | |
from gomiso import gomiso | |
import json |
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
# input is unicode | |
import unicodedata | |
def homogenize (text): | |
text = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore') | |
text = text.lower() | |
return text |
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 clean(sentence): | |
stopchars = ['.', ',', '?', '!', '"', '-'] | |
gain = [] | |
sentence = sentence.lower() | |
for char in stopchars: | |
sentence = sentence.replace(char,' ') | |
words = sentence.split(' ') | |
for word in words: | |
if word <> '': |
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
for number in `jot - 10 73`; do wget http://qzprod.files.wordpress.com/2013/11/2013-11-mobile-eating-the-world-$number.jpg; done | |
for number in `jot - 0 9`; do wget http://qzprod.files.wordpress.com/2013/11/2013-11-mobile-eating-the-world-0$number.jpg; done |
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 csv | |
import sys | |
infile = sys.argv[1] | |
outfile = sys.argv[2] | |
with open(infile) as f: | |
reader = csv.reader(f) | |
cols = [] | |
for row in reader: | |
cols.append(row) |
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
### Keybase proof | |
I hereby claim: | |
* I am soobrosa on github. | |
* I am soobrosa (https://keybase.io/soobrosa) on keybase. | |
* I have a public key whose fingerprint is 19DA 1DE2 BEBD F91F 3EEA A264 30F5 64DE 4D6E 279F | |
To claim this, I am signing this object: |
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 daterange(start_date, end_date): | |
for n in range(int ((end_date - start_date).days)): | |
yield start_date + timedelta(n) |
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
# Usage: | |
# python push_to_google_sheets.py filename.csv sheet_name | |
# | |
# In case your Google Account protected | |
# with Two Factor Authorization, | |
# you have to create an application-specific password | |
# and use your email to login as usual. | |
# https://accounts.google.com/b/0/IssuedAuthSubTokens?hl=en_GB | |
# | |
# Dependency: |
OlderNewer