Skip to content

Instantly share code, notes, and snippets.

@asciiphil
asciiphil / MPL115A2.py
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: https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code .
View MPL115A2.py
#!/usr/bin/python
# Author: Phil! Gold <phil_g@pobox.com>
# License: CC0 Waiver http://creativecommons.org/publicdomain/zero/1.0/
import time
from Adafruit_I2C import Adafruit_I2C
class _MPL115A2_Register:
@aitor
aitor / README.md
Last active Aug 3, 2016 — forked from syntagmatic/README.md
Nutrition Parallel Sets
View README.md
@zmaril
zmaril / softwarehelpskill.md
Last active Jul 17, 2017
I want to write software that helps kill people.
View softwarehelpskill.md

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
harith / shellmarks.sh
Last active Nov 8, 2018
Utilities to let you easily reach frequently visited but deeply nested directories.
View shellmarks.sh
# 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
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 = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Image URL:
allImageURLs <- c("http://media.charlesleifer.com/blog/photos/thumbnails/akira_940x700.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/402px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Official_portrait_of_Barack_Obama.jpg/441px-Official_portrait_of_Barack_Obama.jpg",
"http://cache.boston.com/universal/site_graphics/blogs/bigpicture/obama_11_05/obama22_16604051.jpg",
@hadley
hadley / advise.md
Created Feb 13, 2015
Advise for teaching an R workshop
View advise.md

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. http://www.jstatsoft.org/v59/i10/ + tidyr) and data manipulation (dplyr). These are both important for when people go off and apply

@dannguyen
dannguyen / iowa-liquor-sales-dataset.readme.md
Last active Dec 21, 2019
Cleaning, summing up the State of Iowa Liquor Sales dataset
View iowa-liquor-sales-dataset.readme.md

Iowa Liquor Sales dataset via Socrata/data.iowa.gov

(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
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
primaryobjects / script.js
Created Jul 18, 2016
Posting binary WAV file from javascript to R shiny server.
View script.js
// See also http://stackoverflow.com/a/27228544/2596404
// Blob is your binary data.
// blob = ...;
// Encode the data and post to server.
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function() {
base64data = reader.result;
@pncnmnp
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) :