Skip to content

Instantly share code, notes, and snippets.

View jrwiebe's full-sized avatar

Jeremy Wiebe jrwiebe

  • University of Waterloo
  • Kitchener/Waterloo, Ontario
View GitHub Profile
@jrwiebe
jrwiebe / excerpt.xml
Created October 4, 2018 16:25
CMoS CSL modification for Zotero
<!-- Insert at line 761 to use month and year if there is an issue
number, and just year if there is no issue. If you prefer to only
ever use the year, replace the <choose> block with:
<date variable="issued" form="numeric" date-parts="year"/>
-->
<if type="article-journal" match="any">
<group delimiter=" ">
<choose>
<if variable="volume issue" match="all">
<date variable="issued" form="text" date-parts="year-month"/>
@jrwiebe
jrwiebe / 7eleven-stores-city-ca.R
Created July 7, 2018 05:29
7-Elevens by city (an exercise in learning R). Generate list of North American stores ("all-na.csv") with "getsevs.sh" before running R scripts.
ca_cities <- read.csv(url("https://simplemaps.com/static/data/country-cities/ca/ca.csv"))
# add cities to table that will be in top 10 list
missing_1 <- c("Burnaby","","","Canada","CA","British Columbia","",232755,232755)
missing_2 <- c("Surrey","","","Canada","CA","British Columbia","",517887,517887)
missing_df <- data.frame(rbind(missing_1, missing_2))
names(missing_df) <- names(ca_cities)
ca_cities <- rbind.data.frame(ca_cities,missing_df)
prov_names <- c("British Columbia", "Alberta", "Saskatchewan", "Manitoba", "Ontario", "Québec", "New Brunswick", "Nova Scotia", "Prince Edward Island", "Newfoundland and Labrador", "Nunavut", "Northwest Territories", "Yukon")
prov_abb <- c("BC", "AB", "SK", "MB", "ON", "QC", "NB", "NS", "PE", "NL", "NU", "NT", "YT")
names(prov_abb) <- prov_names
@jrwiebe
jrwiebe / 7eleven-stores-city-ca.R
Last active July 7, 2018 05:26
7-Elevens by city (an exercise in learning R). Generate list of North American stores ("all-na.csv") with "getsevs.sh".
ca_cities <- read.csv(url("https://simplemaps.com/static/data/country-cities/ca/ca.csv"))
# add cities to table that will be in top 10 list
missing_1 <- c("Burnaby","","","Canada","CA","British Columbia","",232755,232755)
missing_2 <- c("Surrey","","","Canada","CA","British Columbia","",517887,517887)
missing_df <- data.frame(rbind(missing_1, missing_2))
names(missing_df) <- names(ca_cities)
ca_cities <- rbind.data.frame(ca_cities,missing_df)
prov_names <- c("British Columbia", "Alberta", "Saskatchewan", "Manitoba", "Ontario", "Québec", "New Brunswick", "Nova Scotia", "Prince Edward Island", "Newfoundland and Labrador", "Nunavut", "Northwest Territories", "Yukon")
prov_abb <- c("BC", "AB", "SK", "MB", "ON", "QC", "NB", "NS", "PE", "NL", "NU", "NT", "YT")
names(prov_abb) <- prov_names
@jrwiebe
jrwiebe / gettweets.sh
Last active April 13, 2018 16:21
I noticed realDonaldTrump seemed to take a long time to write linked tweets, so I created this silly script to generate some stats.
#!/bin/bash
# This script requires 'wget'
current_year=`date '+%Y'`
### You can edit these values ###
start_year=2017
end_year=$current_year
outfile="condensed_all.json"
#################################