This file contains hidden or 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 re | |
from collections import defaultdict | |
from pprint import pprint | |
import requests | |
from bs4 import BeautifulSoup | |
departments = [ | |
"https://ocw.mit.edu/courses/architecture", |
This file contains hidden or 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
<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" |
This file contains hidden or 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 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). |
This file contains hidden or 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
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') |
This file contains hidden or 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
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))) + |
This file contains hidden or 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 threading | |
n = 0 | |
def foo(): | |
global n | |
n += 1 | |
This file contains hidden or 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
# 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) |
This file contains hidden or 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 re | |
import shlex | |
import requests | |
import subprocess | |
from multiprocessing import Pool | |
from bs4 import BeautifulSoup | |
reg = re.compile("http:\/\/files.*.mp3") |
This file contains hidden or 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
Radiohead | |
LCD Soundsystem | |
Lionel Richie | |
Lana Del Rey | |
J. Cole | |
Duran Duran | |
Zedd | |
Ryan Adams | |
Major Lazer | |
Air |