Skip to content

Instantly share code, notes, and snippets.

View avyfain's full-sized avatar

Avy Faingezicht avyfain

View GitHub Profile
Radiohead
LCD Soundsystem
Lionel Richie
Lana Del Rey
J. Cole
Duran Duran
Zedd
Ryan Adams
Major Lazer
Air
@avyfain
avyfain / econtalk.py
Created October 28, 2016 01:55
Scrape econtalk episodes, and speed them up!
import os
import re
import shlex
import requests
import subprocess
from multiprocessing import Pool
from bs4 import BeautifulSoup
reg = re.compile("http:\/\/files.*.mp3")
@avyfain
avyfain / means.py
Last active December 25, 2016 21:57
Calculating averages efficiently, using Python
# Timing script to compare various ways to compute the mean of list of ints
# Short explanation, and results of the experiment can be found here:
# www.faingezicht.com/articles/2016/12/25/means/
import random
import timeit
import statistics
import numpy as np
random.seed(1)
@avyfain
avyfain / grok.py
Created June 15, 2017 16:27
A quick demo based on A. Jesse Jiryu Davis' PyCon 2017 "Grok the Gil" talk (https://www.youtube.com/watch?v=7SSYhuk5hmc)
import threading
n = 0
def foo():
global n
n += 1
library(XML)
library(ggplot2)
df <- readHTMLTable("http://projects.dailycal.org/paychecker")[[1]]
colnames(df)[4] <- "Salary"
df$Salary <- as.numeric(gsub('[$,]', '', df$Salary))
p <- ggplot(df, aes(x=Department, y=Salary)) + coord_flip()
p + geom_boxplot(aes(color=Rank,
x=reorder(Department, Salary, FUN=max))) +
rm(list=ls())
library(ggplot2)
library(ggmap)
library(plotKML)
cityMap <- qmap(location = 'san francisco', extent = 'device', zoom=12, source="google", maptype="terrain")
cityMap
kinds <- c('transport', 'walking', 'cycling')
colors <- c('#FF7400', '#1240AB', '#FFD300')
@avyfain
avyfain / ff.py
Last active January 2, 2023 02:45 — forked from elaineo/ff.py
Follow Friday
import json
import os
from collections import Counter
# pip install TwitterAPI
from TwitterAPI import TwitterAPI
# Edit ff.py for your account. Go to https://apps.twitter.com/ to get API keys
# Don't forget to fill in your screen name (or someone else's).
<img srcset="{{ site.image_path }}{{page.bucket}}/{{img.sizes[0]}}.xs.{{img.sizes[1]}} 600w,
{{ site.image_path }}{{page.bucket}}/{{img.sizes[0]}}.s.{{img.sizes[1]}} 800w,
{{ site.image_path }}{{page.bucket}}/{{img.sizes[0]}}.{{img.sizes[1]}} 1280w,
{{ site.image_path }}{{page.bucket}}/{{img.sizes[0]}}.m.{{img.sizes[1]}} 2000w,
{{ site.image_path }}{{page.bucket}}/{{img.sizes[0]}}.l.{{img.sizes[1]}} 3000w"
sizes="(max-width: 800px) 600px,
(max-width: 1064px) 800px,
(max-width: 1700px) 1280px,
(max-width: 3000px) 2000px,
3000px"
@avyfain
avyfain / mitocw.py
Created September 26, 2020 05:39
mitocw.py
import re
from collections import defaultdict
from pprint import pprint
import requests
from bs4 import BeautifulSoup
departments = [
"https://ocw.mit.edu/courses/architecture",