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
# Process all JPEG files in the current dir and apply timestamp, using imagemagick | |
import glob | |
import re | |
import os | |
jpgs = glob.glob('*.jpeg') | |
for j in jpgs: | |
newfile = re.sub('\\.jpeg$', '_stamp.jpeg', j) | |
im_command = f'convert {j} -undercolor Black -fill white -pointsize 100 -auto-orient -gravity NorthWest -annotate 0 "%[EXIF:DateTimeOriginal]" {newfile}' | |
print(f'Processing {j}') |
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(tidycensus) | |
library(tidyverse) | |
# find the variables we care about | |
acs5_2019 <- tidycensus::load_variables(year = 2019, dataset = 'acs5', cache = T) | |
# ok here they are | |
my_vars <- paste0("B08006_", sprintf('%03d', 1:17)) | |
# select just the most important top level responses | |
# (e.g. no public transportation break out) |
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
options(tigris_use_cache = TRUE) | |
library(tigris) | |
library(sf) | |
# get shapefiles (coarse resolution) | |
sd_sf <- school_districts(state = 'CA', cb = T) | |
zip_sf <- zctas(cb=T, state='CA') | |
# which zips overlap OUSD? |
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(tidycensus) | |
library(tidyverse) | |
census_api_key(Sys.getenv('CENSUS_API_KEY')) | |
vars <- load_variables(2017, "acs5", cache = TRUE) | |
il <- get_acs(geography = "county", | |
variables = "B00001_001", | |
state = "IL", geometry = TRUE) | |
ggplot(il) + | |
geom_sf(aes(fill=estimate/1000), size=0.4, color='black') + | |
scale_fill_viridis_c() + |
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(tidyverse) | |
streak_len <- 7 | |
ref_denom <- 276 | |
tibble(x=1:streak_len, | |
y=(1/6)^x) %>% | |
ggplot(aes(x=x+1, y=y)) + | |
geom_point() + | |
geom_line() + |
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(tidyverse) | |
# data ---- | |
"JonPear6 10:21 AM | |
1 8 9 | |
plättyjö:plattyjo: 10:22 AM | |
3 1 8 | |
swirving 10:22 AM |
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
# survey of crank beauty | |
# https://forms.gle/CNqHkmeQa6n1cJxL7 | |
library(tidyverse) | |
library(data.table) | |
library(patchwork) | |
# data ---- | |
"DA 7400 DA 7700 DA 7800 DA 7900 DA 9000 DA 9100 | |
8 7 6 2 5 4 |
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(ggplot2) | |
library(data.table) | |
dat <- fread( | |
'name, delegates | |
"BUTTIGIEG", 22 | |
"SANDERS", 21 | |
"WARREN", 8 | |
"KLOBUCHAR", 7 | |
"BIDEN", 6 | |
"Still\nremaining", 3915') |
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(babynames) | |
library(tidyverse) | |
bab <- babynames %>% filter(sex=="F" & year >= 1945) | |
bab$rgx_match <- as.character(NA) | |
for(i in c('Amy', 'Beth', 'Meg', 'Jo')) { | |
rgx <- paste0('^', i, '.*$') | |
bab$rgx_match <- coalesce( | |
ifelse(grepl(rgx, bab$name), rgx, NA), |
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(data.table) | |
library(tidyverse) | |
library(ggrepel) | |
"Model, reach, drop, grams | |
Zipp sl88, 88, 130, 275 | |
Fizik r3 snake, 85, 140, 245 | |
RH Maes P, 115, 125, 298 | |
VO course, 115, 125, 395 | |
Ritchey NeoClassic, 73, 128, 260 |
NewerOlder