Skip to content

Instantly share code, notes, and snippets.


Zev Averbach zevaverbach

View GitHub Profile
zevaverbach / gist:861aa14e438b2179937d
Created December 23, 2014 06:21
Cats in Hats True/False approach
View gist:861aa14e438b2179937d
theCats = {}
for i in range(1,101):
theCats[i] = False
for i in range(1,101):
for cats, hats in theCats.iteritems():
if cats % i == 0:
if theCats[cats] == True:
theCats[cats] = False
View gist:888ecd4bd446dee743d7
### Keybase proof
I hereby claim:
* I am zevav on github.
* I am zevav ( on keybase.
* I have a public key whose fingerprint is 96F2 1B88 D92A E682 AD9D FD59 50EB C01D 3390 FFDD
To claim this, I am signing this object:
zevaverbach /
Created January 27, 2016 22:02
Downloading .json transcripts from Speechmatics with Selenium
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
from config import username, password
"""This downloads *all* the .json transcripts from your Speechmatics account. Why didn't I use the API? The docs are down, so voila."""
fp = webdriver.FirefoxProfile()
fp.set_preference("", False)
zevaverbach /
Created September 15, 2016 21:06
Convert Ghost blog markdown files to Lektor markdown files
# coding: utf-8
import os
class Converter:
"""Converts Ghost markdown files to Lektor markdown."""
def __init__(self, from_dir, to_dir, author):
self.from_dir = from_dir
self.to_dir = to_dir = author
zevaverbach /
Last active September 28, 2016 14:19 — forked from samatjain/
Create an HTML file of all previous events for a group. Forked from
#!/usr/bin/env python3
This requires a file containing a dictionary called config.
There should be a dictionary in config for each meetup group, the key
being a shorthand title for the meetup group's name, and the values
dicts with key 'meetup_name' and 'meetup_api_key' with corresponding
values for those.
eg.: config = {'my_cool_meetup':
{'meetup_name': <the value after the '/' in your meetup URL>,
zevaverbach /
Created April 13, 2017 16:22
basic email automation proof of concept for teaching
from datetime import date
from email import encoders
from email.mime.application import MIMEApplication
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
from time import sleep
FROM_EMAIL = 'put your from email here (can be same as MAIL_USERNAME)'
zevaverbach /
Created April 14, 2017 17:05
Get the value of the first cell of a named range from Google Sheets.
import pygsheets
def get_value_of_named_range_from_google_sheet(sheet_name: str, worksheet_title: str, range_name: str) -> str:
"""return the value of the first cell from a named range
great for treating Google Sheets NamedRanges as variables in Python scripts"""
gc = pygsheets.authorize(outh_file='client_secret.json', outh_nonlocal=True)
sh =
zevaverbach / gist:0c33d4bccf413e2debdf8cd4ffc76a8f
Last active September 26, 2017 02:02
Area code to gmt mapping
View gist:0c33d4bccf413e2debdf8cd4ffc76a8f
area_code_gmt_dict = {
201: -5,
202: -5,
203: -5,
205: -6,
206: -8,
207: -5,
208: -7,
zevaverbach /
Last active July 16, 2018 13:27
Get tenders from Square, optionally from a specific location and/or time.
The star of this show is get_tenders, which will return all tenders
if there are no keyword arguments supplied, or tenders from a specific location,
and/or before/after datetimes.
For convenience, here are the fields of a Tender:
zevaverbach /
Last active August 17, 2018 11:44
Tic Tac Toe!
from time import sleep
LEFT_PAD_30 = " " * 30
LEFT_PAD_10 = " " * 10
WIN_BOXES = [(0, 1, 2),
(3, 4, 5),
(6, 7, 8),
(0, 3, 6),
(1, 4, 7),