Skip to content

Instantly share code, notes, and snippets.

View michelleboisson's full-sized avatar

Michelle Boisson michelleboisson

View GitHub Profile
@michelleboisson
michelleboisson / CompassBracelet.ino
Created December 19, 2012 05:36
This reads the heading from HMC6352, reads your current location (hardcoded), and your destination (hardcoded), and turns the pin high pointing to your destination
//Compass Bracelet GPS
//This reads the heading from HMC6352, reads your current location (hardcoded),
//and your destination (hardcoded), and turns the pin high pointing to
//your destination
//HMC6352 compass is hooked up this way: SDA is on analog input pin 4, and SCL is on analog pin 5
//To customize, change destinationLat, destinationLon, currentLat, currentLon
#include <SoftwareSerial.h>
@michelleboisson
michelleboisson / DigitalCompass.ino
Created December 19, 2012 05:25
Code for Compass Module test
//This reads the heading from HMC6352, spit it out via serial and lights up 1-2 lights to show North
//HMC6352 compass is hooked up this way: SDA is on analog input pin 4, and SCL is on analog pin 5
#include <Wire.h>
int HMC6352SlaveAddress = 0x42;
int HMC6352ReadAddress = 0x41; //"A" in hex, A command is:
int headingValue;
int EPin = 13;//east
@michelleboisson
michelleboisson / Grameen-Foundation.R
Created December 5, 2012 02:54
Data Without Borders Final Exploration
#Final Data Exploration
#Grameen Foundation, CKWs
ix.data = read.csv("/Users/michelleboisson/Documents/ITP/* Data without Borders/final/search_logs.csv", header=TRUE, as.is=TRUE)
head(ix.data)
dim(ix.data)
#[1] 334718 11
ckws = read.csv("/Users/michelleboisson/Documents/ITP/* Data without Borders/final/ckw.csv", header=TRUE, as.is=TRUE)
head(ckws)
@michelleboisson
michelleboisson / IPCameraControl-Android.pde
Created November 20, 2012 01:34
Controlling an IP camera with an Android device
/**
* <p>This uses the Ketai Sensor Library for Android: http://ketaiMotion.org</p>
*
*
*/
import ketai.sensors.*;
KetaiSensor sensor;
@michelleboisson
michelleboisson / homework8.R
Created November 15, 2012 03:56
Data Without Borders - Assignment 8
#Describing Distributions
snf = read.csv("http://jakeporway.com/teaching/data/snf_4.csv", head=T, as.is=T)
#Make a “height” column for your data that is the total number of inches tall each person is.
heights = apply(snf,1, function(x) { as.numeric(x['feet'])*12 + as.numeric(x['inches']) })
snf$fullheight = heights
mean(heights)
#[1] 68.57884
@michelleboisson
michelleboisson / mapping-crime.R
Created November 6, 2012 22:24
Data Without Borders - Assignment 7
# CRIME MAPPING
#We’ve done some basic analysis of our Stop and Frisk data this semester, looking at
#basic statistics (e.g. number of stops by race or most common crimes by race) and
#timeseries information. We haven’t yet touched geography though. Let’s spend this
#week’s assignment answering the question: Where are Stop n Frisks happening in New
#York?
snf = read.csv("/Users/michelleboisson/Documents/ITP/* Data without Borders/snf_3.csv", as.is=TRUE)
geo = read.csv("/Users/michelleboisson/Documents/ITP/* Data without Borders/geo.csv", as.is=TRUE)
@michelleboisson
michelleboisson / Lets-Get-Political.R
Created October 23, 2012 03:05
Data Without Borders - Assignment 6 (really 4)
# Let’s breakdown our tweets around a certain topic. How about, oh, say, Iran?
# So how do we pull tweets out that have a certain word in them?
# grep() to the rescue! If you’ve used the grep function on the command-line, this
# should look familiar. grep() takes as arguments a phrase you’re searching for, a
# set of text to look through, and optional arguments about how to search. It will
# then return the row numbers of any rows that match your search. To pull out Iran
# tweets, we can use the code:
iran.tweets <- tweets[grep(“iran”, ignore.case=TRUE, tweets$text), ]
@michelleboisson
michelleboisson / behavior_exp.ino
Created October 3, 2012 23:10
Arduino Servo and light sensor
#include <Servo.h> // include the servo library
Servo servoMotor; // creates an instance of the servo object to control a servo
int servoPin = 2; // Control pin for servo motor
int pos = 0; // variable to store the servo position
int now, previousTime, interval = 0;
//for smoothing of values
@michelleboisson
michelleboisson / behavior-data.csv
Created September 30, 2012 20:37
Behavior Experiment
video time person behavior id real_time
1 5:00 girl in white hoodie stretched shoulders 1 12:35:00
1 8:00 sean arms up stretch 2 12:38:00
1 9:30 guy in green shirt infront of sean arms up stretch 3 12:39:30
1 13:31 sean stretched back 2 12:43:31
1 15:38 plaids shirt guy brisk back bend 4 12:45:38
1 16:01 guy in green shirt in front of sean brisk back bend 3 12:46:01
1 17:57 girl in white hoodie wrist stretch 1 12:47:57
1 19:43 girl in white hoodie wrist stretch 1 12:49:43
1 20:48 guy in green hands behind neck stretch 3 12:50:48
@michelleboisson
michelleboisson / libya_tweets-pt1.r
Created September 26, 2012 22:55
Data Without Borders - Assignment 3
#How many unique users have more than 100000 followers? What are their screen names?
tweets <- read.csv("/Users/michelleboisson/Documents/ITP/* Data without Borders/hw3/libya_tweets.csv", as.is=TRUE)
unique(tweets$screen_name[which(as.numeric(tweets$followers) >= 100000)])
# [1] "detikcom" "DonLemonCNN" "HuffingtonPost" "Dputamadre" "WorldRss" "AlMasryAlYoum"
# [7] "theobscurant" "fadjroeL" "TPO_Hisself" "CAPAMAG" "TwittyAlgeria" "foxandfriends"
# [13] "PranayGupte"