Skip to content

Instantly share code, notes, and snippets.

@samarthbhaskar
samarthbhaskar / gist:5489848
Created April 30, 2013 16:24
unicode sucks
import csv
reader = csv.reader(open("/Users/sbhaskar/Dropbox/All_out/french_results/CSV/Sheet_1.csv","rU"))
for r in reader:
print r
import unicodedata
source = r
output=[]
for s in r:
t=unicodedata.normalize('NFKD', unicode(s)).encode('ascii', 'ignore')
library(stringr)
a <- c("Windows NT", "Windows NT 4.0", "L4", "Nokia OS", "Linux - Fedora", "Windows 2000","LG proprietary","Linux - Debian", "Windows 8")
b <- ifelse(str_detect(a, "Window"), "Window", a)
@samarthbhaskar
samarthbhaskar / youtube.md
Last active September 10, 2015 20:02
All YouTube, all the time

YouTube has a lot of great stuff. I go on binges often. These are people for whom I've seen almost all YouTube content. I've been more completist about some than others.

  • Oliver Sacks
  • Robin Williams
  • Jonathan Franzen
  • Zadie Smith
  • Toni Morrison
  • Michel Foucault
  • Noam Chomski
@samarthbhaskar
samarthbhaskar / xml_to_csv.R
Last active January 20, 2016 18:05
Youtube subs as of 2016-01-20
library(xml2)
# save this from your youtube subscription manager (RSS feed at the bottom)
d <- "~/Desktop/subscriptions.xml"
data <- read_xml(d)
child <- xml_children(xml_children(data))
res <- as.data.frame(matrix(nrow=163,
ncol=2))