Skip to content

Instantly share code, notes, and snippets.

@evanemolo
evanemolo / dwb-Final.R
Created December 3, 2012 23:31
dwb final
# Data Without Borders: Final Project
# Multi-dimensional Scaling of Google Products in Relation to Goverment Takedown Requests
gov.requests = read.csv("/Users/evanemolo/Dropbox/_ITP/_Fall_2012/DWB/Final/datasets/Google transparency report - GOV REQUESTS.csv", header=TRUE, as.is=TRUE)
# Basic summary statistics
# Which countries are making the most removal requests?
rev(sort(table(gov.requests$Country)))
# How many Google products are targeted?
@evanemolo
evanemolo / google-gov.R
Created December 3, 2012 20:20
google gov - counting product per country
unique.vals <- sort(unique(gov.requests$Product))
blank.frame <- data.frame(product=unique.vals, counts=rep(0, length(unique.vals)))
unique.countries <- unique(gov.requests$Country)
results <- matrix(0, nrow=length(unique.countries), ncol=length(unique.vals))
colnames(results) <- unique.vals
rownames(results) <- unique.countries
# You'll have to do this for each country
i <- 0
@evanemolo
evanemolo / gist:4192720
Created December 3, 2012 04:35
Python - extract .csv row
MyValues = [] #create an empty list
values = csv.reader(open('data.csv', 'rb'), delimiter=' ')
for row in values:
MyValues.append(row[5])
@evanemolo
evanemolo / grep-find.md
Last active October 13, 2015 07:58
grep and find CLI examples

grep examples

case insensitive, search recursively in present directory for "modules", and list file names only

grep -irl "modules" .

search recursively in present directory, for "mod" file name, with any extension, list files only

grep -rl mod.* .

@evanemolo
evanemolo / SublimeBlockCursor.py
Created October 27, 2012 22:49 — forked from kellishaver/SublimeBlockCursor.py
Sublime Text 2 Block Cursor - outside of Vintage Mode
# Add this file to a directory called SublimeBlockCursor in the Packages directory.
import sublime
import sublime_plugin
class SublimeBlockCursor(sublime_plugin.EventListener):
def view_is_widget(view):
settings = view.settings()
return bool(settings.get('is_widget'))
@evanemolo
evanemolo / launch_sublime_from_terminal.markdown
Created October 27, 2012 15:13 — forked from artero/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@evanemolo
evanemolo / Side Bar.sublime-settings
Created October 25, 2012 22:13
Sublime Text 2 Side Bar Enhancement Settings -- default browser: chrome
{
"statusbar_modified_time" : false,
"statusbar_modified_time_format" : "%A %b %d %H:%M:%S %Y",
"statusbar_file_size" : false,
"close_affected_buffers_when_deleting_even_if_dirty" : false,
"hide_open_with_entries_when_there_are_no_applicable" : false,
@evanemolo
evanemolo / DWB-6.R
Created October 24, 2012 19:02
Data Without Borders Assignment 6, Part 2
# Import the data and TTR library:
#tweets = read.csv("http://jakeporway.com/teaching/data/tweets2009.csv", header=FALSE, as.is=TRUE)
tweets = read.csv("/Users/evanemolo/Dropbox/_ITP/_Fall_2012/DWB/HW/WK6/tweets2009.csv", as.is=TRUE, header=FALSE)
library(TTR)
# Assign a vector to the names() function to name the columns
names(tweets) = c("time", "seconds", "screen_name", "text")
# Let's search the tweets for "Iran" using grep()
iran.tweets = tweets[grep("iran", ignore.case=TRUE, tweets$text), ]
# Plot the time series for iran.tweets
iran.tweets.hist = hist(iran.tweets$seconds, breaks=100)
@evanemolo
evanemolo / .zshrc
Created October 23, 2012 19:04
zshconfig .zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Example aliases
@evanemolo
evanemolo / .gitconfig
Created October 23, 2012 19:03
.gitconfig
[user]
name = Evan Emolo
email = i_am@evanemolo.com
[core]
excludesfile = ~/.gitignore
editor = sublime -n -w
[color]
branch = auto
diff = auto