Skip to content

Instantly share code, notes, and snippets.

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())
@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;
}
@fototo
fototo / README.md
Last active August 29, 2015 14:23 — forked from e9t/README.md
@fototo
fototo / us_states_hexgrid.geojson
Last active August 29, 2015 14:25 — forked from hrbrmstr/us_states_hexgrid.geojson
hexbin faceted choropleths in R
library(rgdal)
library(rgeos)
library(ggplot2)
library(readr)
library(tidyr)
library(dplyr)
library(grid)
us <- readOGR("us_states_hexgrid.geojson", "OGRGeoJSON")
@fototo
fototo / sna_example.R
Last active August 29, 2015 14:25 — forked from dsparks/sna_example.R
Flag similarity network
# Drawing a scatter plot of raster images
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("png", "sna")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Go to https://www.gosquared.com/resources/2400-flags, download the ZIP,
# and put the 64 x 64 files into a directory of your choosing.
# Then setwd() to that directory:
setwd("C:/Dropbox/isDotR_Files/flagIcons")
@fototo
fototo / Rakefile
Last active September 14, 2015 00:06 — forked from jerodsanto/Rakefile
A code dump showing how we generate "The Changelog Weekly" using the Trello API
require "rubygems"
require "bundler"
require_relative "lib/importer"
Bundler.setup
desc "Import from Trello board"
task :import do
Importer.new(File.dirname(__FILE__)).import ENV["ISSUE"]
end
@fototo
fototo / customer-segmentation.py
Last active September 14, 2015 23:49 — forked from glamp/customer-segmentation.py
Analysis for customer segmentation blog post
import pandas as pd
# http://blog.yhathq.com/static/misc/data/WineKMC.xlsx
df_offers = pd.read_excel("./WineKMC.xlsx", sheetname=0)
df_offers.columns = ["offer_id", "campaign", "varietal", "min_qty", "discount", "origin", "past_peak"]
df_offers.head()
df_transactions = pd.read_excel("./WineKMC.xlsx", sheetname=1)
df_transactions.columns = ["customer_name", "offer_id"]
df_transactions['n'] = 1
df_transactions.head()
belief y2015 y2014
Improves the security posture of my organization 0.75 0.71
Improves the security posture of the nations critical infrastructure 0.63 0.64
Reduces the cost of detecting and preventing cyber attacks 0.22 0.21
Improves situational awareness 0.60 0.54
Fosters collaboration among peers and industry groups 0.48 0.51
Enhances the timeliness of threat data 0.11 0.16
Makes threat data more actionable 0.21 0.24
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fototo
fototo / copulas_example.R
Created January 3, 2016 06:28 — forked from mick001/copulas_example.R
Modelling dependence with copulas. Full article at: http://datascienceplus.com/modelling-dependence-with-copulas/
#Load library mass and set seed
library(MASS)
set.seed(100)
# We are going to use 3 random variables
m <- 3
# Number of samples to be drawn
n <- 2000