Skip to content

Instantly share code, notes, and snippets.

asciiphil /
Last active Dec 20, 2015
Python class for communicating with a MPL115A2 I2C digital barometer/temperature sensor. Uses the Adafruit_I2C class from the Adafruit Raspberry Pi Python Code: .
# Author: Phil! Gold <>
# License: CC0 Waiver
import time
from Adafruit_I2C import Adafruit_I2C
class _MPL115A2_Register:
aitor /
Last active Aug 3, 2016 — forked from syntagmatic/
Nutrition Parallel Sets
zmaril /
Last active Jul 17, 2017
I want to write software that helps kill people.

I want to write software that helps kill people.

Please, before you call the police and get my github account put on lockdown, allow me a moment to explain. What I really want to do is work on projects that advance the human condition and improve people's lives. I've been in a mad dash to learn how to program for the past four or five years exactly because I realized how much good I could do for the world with a computer.

harith /
Last active Nov 8, 2018
Utilities to let you easily reach frequently visited but deeply nested directories.
# Utilities for quickly accessing frequently used directories in bash.
# Usage:
# $ cd /path/to/project/src/
# $ mark code # Will create a new shortcut.
# # Becomes interactive if a shortcut already exists
# # m is an alias for mark. You can also `m code`
# $ code # From now on, running this anywhere in the shell
# # will put you in /path/to/project/src/code
dsparks / kmeans_palette.R
Last active Jun 27, 2019
Image Manipulation, Part 2
View kmeans_palette.R
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("jpeg", "reshape2", "ggplot2")
if(doInstall){install.packages(toInstall, repos = "")}
lapply(toInstall, library, character.only = TRUE)
# Image URL:
allImageURLs <- c("",
hadley /
Created Feb 13, 2015
Advise for teaching an R workshop

I think the two most important messages that people can get from a short course are:

a) the material is important and worthwhile to learn (even if it's challenging), and b) it's possible to learn it!

For those reasons, I usually start by diving as quickly as possible into visualisation. I think it's a bad idea to start by explicitly teaching programming concepts (like data structures), because the pay off isn't obvious. If you start with visualisation, the pay off is really obvious and people are more motivated to push past any initial teething problems. In stat405, I used to start with some very basic templates that got people up and running with scatterplots and histograms - they wouldn't necessary understand the code, but they'd know which bits could be varied for different effects.

Apart from visualisation, I think the two most important topics to cover are tidy data (i.e. + tidyr) and data manipulation (dplyr). These are both important for when people go off and apply

dannguyen /
Last active Dec 21, 2019
Cleaning, summing up the State of Iowa Liquor Sales dataset

Iowa Liquor Sales dataset via Socrata/

(preliminary exploration)

The state of Iowa has released an 800MB+ dataset of more than 3 million rows showing weekly liquor sales, broken down by liquor category, vendor, and product name, e.g. STRAIGHT BOURBON WHISKIES, Jim Beam Brands, Maker's Mark

This dataset contains the spirits purchase information of Iowa Class “E” liquor licensees by product and date of purchase from January 1, 2014 to current. The dataset can be used to analyze total spirits sales in Iowa of individual products at the store level.

You can view the dataset via Socrata

stevebowman / AWSLambdaSimpleSMS.js
Last active Feb 27, 2020
AWS Lambda Function to send an SMS message via the Twilio API
View AWSLambdaSimpleSMS.js
console.log('Loading event');
// Twilio Credentials
var accountSid = '';
var authToken = '';
var fromNumber = '';
var https = require('https');
var queryString = require('querystring');
primaryobjects / script.js
Created Jul 18, 2016
Posting binary WAV file from javascript to R shiny server.
View script.js
// See also
// Blob is your binary data.
// blob = ...;
// Encode the data and post to server.
var reader = new FileReader();
reader.onloadend = function() {
base64data = reader.result;
pncnmnp / news_corpus.txt
Last active Jun 10, 2020
22 years ( 1995 - 2017 ) worth of news scrapped from Wikipedia ( with dates )
View news_corpus.txt
This file has been truncated, but you can view the full file.
Current events of September 3, 1995 (1995-09-03) (Sunday) :
eBay is founded.
Current events of September 6, 1995 (1995-09-06) (Wednesday) :
NATO air strikes against Bosnian Serb forces continue, after repeated attempts at a solution to the Bosnian War fail.
Current events of September 19, 1995 (1995-09-19) (Tuesday) :
The Washington Post and The New York Times publish the Unabomber's manifesto.
Current events of September 22, 1995 (1995-09-22) (Friday) :
American millionaire Steve Forbes announces his candidacy for the 1996 Republican presidential nomination.
Current events of September 23, 1995 (1995-09-23) (Saturday) :