Skip to content

Instantly share code, notes, and snippets.

View mturk.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@devin-petersohn
devin-petersohn / a_pandas_on_ray_blogpost_01.ipynb
Last active Oct 14, 2018
Pandas on Ray - Lessons learned Blog Post. Also introduces Modin, a project for unifying the APIs of computing engines.
View a_pandas_on_ray_blogpost_01.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Neurogami
Neurogami / plantext.txt
Created Apr 1, 2018
Bookmarklet version of javascript to get plaintext of Amazon Cloud Reader
View plantext.txt
Original code is from https://gist.github.com/aaronshaf/1346968
The instructions were to open a dev console and paste in the script.
A nicer way is to make it a bookmarklet.
1. Create a new bookmark in our browser. You should be able to edit the name and URL
2. Give it a decent name (e.g. "amz cloud plaintext")
3. Paste the following as the URL (make it all one line):
View tp_trelli.r
devtools::install_github("abresler/gdeltr2")
devtools::install_github("hafen/trelliscopejs")
library(gdeltr2)
library(dplyr)
asb_ocr <- "Brooklyn Nets"
gkg_codes <-
get_codes_gkg_themes()
imageweb_codes <- get_gdelt_codebook_ft_api(code_book = "imageweb")
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active Aug 14, 2022
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View understanding-word-vectors.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johnmyleswhite
johnmyleswhite / median.R
Created Feb 23, 2017
R's Medians as a Rabbit Hole of Type Promotions and Function Indirection
View median.R
> median(FALSE)
[1] FALSE
> median(c(TRUE, FALSE))
[1] 0.5
> median(c(TRUE, FALSE, TRUE))
[1] TRUE
> f <- factor(c('a', 'b', 'c'), levels = c('a', 'b', 'c'), ordered = TRUE)
@soodoku
soodoku / rent control
Last active Oct 18, 2016
Rent Control
View rent control
# Read the data
sf <- read.csv("sf_tenants.csv")
# Recode
sf$market_rates <- gsub("%", "", sapply(strsplit(sf$market_rate, " / "), "[", 2)) # market_rate
sf$rent_control_rates <- gsub("%", "", sapply(strsplit(sf$rent_control, " / "), "[", 2)) # market_rate
# Ratio of rent_control vs. rent_control
sf$ratio <- as.numeric(sf$rent_control_rates)/as.numeric(sf$market_rates)
@soodoku
soodoku / missing.R
Last active Apr 22, 2016
plotting missing
View missing.R
# Load libs
library(ggplot2)
# Simulate correlated data
R = matrix(cbind(1,.80, .80,1), nrow=2)
U = t(chol(R))
@soodoku
soodoku / state_various.csv
Last active Apr 12, 2016
US State name, 2 letter code, Alphabetical number, Census Region, ICPSR, ICPSR 2
View state_various.csv
state code num census icpsr icpsr2
Alabama AL 1 South 41 41 AL ALABAMA
Alaska AK 2 West 81 81 AK ALASKA
Arizona AZ 3 West 61 61 AZ ARIZONA
Arkansas AR 4 South 42 42 AR ARKANSAS
California CA 5 West 71 71 CA CALIFORNIA
Colorado CO 6 West 62 62 CO COLORADO
Connecticut CT 7 Northeast 1 01 CT CONNECTICUT
Delaware DE 8 South 11 11 DE DELAWARE
District of Columbia DC 9 Northeast 55 55 DC DISTRICT OF COLUMBIA
@soodoku
soodoku / state_abbrev_fips.txt
Created Apr 12, 2016
US State Abbreviations to FIPS crosswalk
View state_abbrev_fips.txt
1 AL
2 AK
4 AZ
5 AR
6 CA
8 CO
9 CT
10 DE
11 DC
12 FL