Skip to content

Instantly share code, notes, and snippets.

@fototo
fototo / markdown.css
Last active August 29, 2015 14:22 — forked from imjasonh/markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
import os
rfiles = os.listdir('.')
rc = []
for f in rfiles:
if '.txt' in f:
# The recipes come in 3 txt files consisting of 1 recipe per line, the
# cuisine of the recipe as the first entry in the line, and all subsequent ingredient
# entries separated by a tab
infile = open(f, 'r')
rc.append(infile.read())
recipes = readLines('recipes combined.tsv')
# Once I read it into R, I have to get rid of the /t
# characters so that it's more acceptable to the tm package
recipes.new = apply(as.matrix(recipes), 1, function (x) gsub('\t',' ', x))
recipes.corpus = Corpus(VectorSource(recipes.new))
recipes.dtm = DocumentTermMatrix(recipes.corpus)
# -*- coding: utf-8 -*-
"""
Python: 3.4.2
author: dokenzy
date: 2015. 4. 21
license: MIT License
"""
import os
library(KoNLP)
library(wordcloud)
library(plyr)
library(ggplot2)
library(scales)
tw <- read.delim('./data/NIS.csv', header=T, sep=',', stringsAsFactors=F)
tw.RT <- read.delim('./data/NIS_RT.csv', header=T, sep=',', stringsAsFactors=F)
tw.all <- read.delim('./data/NIS_withRT.csv', header=T, sep=',',
stringsAsFactors=F)
#Script for scraping Chronicling America
import requests
import re
import csv
from bs4 import BeautifulSoup, SoupStrainer
import os
from time import sleep
from datetime import date, datetime, timedelta
#search_terms is a string of words separated by spaces.
@fototo
fototo / tufte
Last active August 29, 2015 14:14 — forked from abresler/tufte
library(dplyr)
library(tidyr)
library(magrittr)
library(ggplot2)
"http://academic.udayton.edu/kissock/http/Weather/gsod95-current/NYNEWYOR.txt" %>%
read.table() %>% data.frame %>% tbl_df -> data
names(data) <- c("month", "day", "year", "temp")
data %>%
group_by(year, month) %>%
@fototo
fototo / app.R
Last active August 29, 2015 14:14 — forked from hrbrmstr/app.R
library(shiny)
library(shinydashboard)
library(sparkline)
library(httr)
library(jsonlite)
library(data.table)
library(dplyr)
library(rvest)
library(magrittr)
library(XML)
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": "",
"signature": "sha256:6eedb0030499d0d2d3e9771cf5de62fde633f5875dd94bf121c4f7f2dc2849c1"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
library(mnormt)
mycols <- topo.colors(100,0.5)
xhat <- c(0.2, -0.2)
Sigma <- matrix(c(0.4, 0.3,
0.3, 0.45), ncol=2)
x1 <- seq(-2, 4,length=151)
x2 <- seq(-4, 2,length=151)
f <- function(x1,x2, mean=xhat, varcov=Sigma)
dmnorm(cbind(x1,x2), mean,varcov)
z <- outer(x1,x2, f)