Skip to content

Instantly share code, notes, and snippets.

View pschmied's full-sized avatar

Peter Schmiedeskamp pschmied

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pschmied
pschmied / super-literate.org
Last active September 22, 2017 23:09
Emacs / Org-mode demo

In the beginning, there was text… and it was good.

We didn’t have need for high falutin rich text hypermedia science fiction mumbo jumbo. At its core, org-mode is just exactly this: text. Org-mode may be daunting, but when you feel overwhelmed, breathe and know that org-mode’s lowest common denominator is just plain text.

Sometimes, however, text alone doesn’t adequately convey intent. Occasionally we need to be bold or otherwise add emphasis

@pschmied
pschmied / snap-year-change.r
Last active July 29, 2017 15:51
Plotting month-over-month change in snap users
library(tidyverse) # Start with the tidyverse, yo!
library(lubridate) # Hey mate, use lubridate!
df <- tibble( # Like data.frame, but tidyverse...ier
month = month(1:12, label = 12),
cases = c(
2291999, 2295025, 2305049, 2298570,
2312778, 2322623, 2323876, 2335145,
2324974, 2327760, 2363594, 2394956)
) %>% # Pipes are part of tidyverse / common in modern R
@pschmied
pschmied / salary-explore.r
Last active July 10, 2017 15:41
Playing with predicting gender / race from names
library(tidyverse)
library(readr)
library(stringr)
library(scales)
library(wru) # Predict race
library(gender) # Predict gender
## Employees / salary info for Chicago
df_sal <- read_csv("https://data.cityofchicago.org/api/views/xzkq-xp2w/rows.csv?accessType=DOWNLOAD")
@pschmied
pschmied / *scratch*.el
Created June 29, 2017 23:36
Vega-lite example
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {"url": "https://data.seattle.gov/api/views/mags-97de/rows.csv"},
"selection": {
"grid": {
"type": "interval", "bind": "scales"
}
},
"mark": "circle",
"encoding": {
@pschmied
pschmied / dsmpapi.org
Last active June 21, 2017 20:48
Using DSMP API from R

Publishing a dataset using DSMP API from R

These are some notes I made to reason through / illustrate usage of the new DSMP API. Usage here is presented as a linear set of steps for pedagogical purposes rather than attempting to create a reusable set of functions or a library.

Creating a new R client library based around the DSMP API is a task for the hopefully-not-too-distant future.

@pschmied
pschmied / voting-power.png
Last active November 20, 2016 09:25
Relative voting power by state
voting-power.png
@pschmied
pschmied / devify-osx.sh
Created December 25, 2014 19:55
Make modern OSX make me not want to stab my own eyes out.
#!/usr/bin/env bash
# With apologies to:
# ~/.osx — https://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@pschmied
pschmied / devifyosx
Created December 19, 2014 17:57
OS X config fixes
#!/usr/bin/env bash
# With apologies to:
# ~/.osx — https://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@pschmied
pschmied / poisson-gamma-postpred.ipynb
Last active July 4, 2016 13:57
Sampling from a posterior predictive distribution in IJulia. See http://nbviewer.ipython.org/gist/pschmied/b443e5e2d876b5ce9627 for rendered version.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.