Skip to content

Instantly share code, notes, and snippets.

@technocrat
technocrat / NOAAScrape
Last active August 22, 2021 21:41
Utility Python script to download NOAA temperature time series data into a single CSV file
#!/usr/bin/python
"""
Author: Richard Careaga
Date: 2014-07-10
Title: NOAAscrape.py
Description: Download temperature time series data and save to CSV file
Example results (date, temperature, difference from 1901-2000 mean for month):
"1895-01-15",26.69,-3.43
"1896-01-15",31.48,1.36
Data Science
http://radar.oreilly.com/2010/06/what-is-data-science.html,What is data science? (oreilly.com)
http://hortonworks.com/blog/how-to-get-started-in-data-science/,How To Get Started In Data Science (hortonworks.com)
http://www.insidephilanthropy.com/home/2014/4/14/whos-getting-the-big-bucks-for-data-science-and-why.html,Who's Getting The Big Bucks? (insidephilanthropy.com)
http://www.citeworld.com/article/2139987/big-data-analytics/heres-how-one-company-built-its-data-science-operation.html,How To Build A data Science Team (citeworld.com)
http://www.computerworld.com/s/article/9248050/Cornell_Tech_funded_startup_launching_bootcamp_for_data_scientists,Data Science Bootcamp (computerworld.com)
http://www.datasciencetoolkit.org/,Data Science Toolkit (datasciencetoolkit.org)
http://blog.stephenwolfram.com/2013/04/data-science-of-the-facebook-world/,Data Science of the Facebook World (blog.stephenwolfram.com)
http://strata.oreilly.com/2011/05/data-science-terminology.html,Why The Term “Data Scien
@bhoung
bhoung / k-fold CV.r
Created April 24, 2014 00:52
starter code for k fold cross validation using the iris dataset
# original example from Digg Data website (Takashi J. OZAKI, Ph. D.)
# http://diggdata.in/post/58333540883/k-fold-cross-validation-in-r
library(plyr)
library(randomForest)
data <- iris
# in this cross validation example, we use the iris data set to
@dsparks
dsparks / update R.R
Created April 12, 2014 12:02
Updating to a new version of R
# installing/loading the latest installr package:
install.packages("installr"); require(installr) #load / install+load installr
updateR()
# Then just follow the prompts...
@ramnathv
ramnathv / Makefile
Last active January 16, 2021 13:47
R Markdown to IPython Notebook
example.md: example.Rmd
./knit
example.ipynb: example.md
notedown example.md | sed 's/%%r/%%R/' > example.ipynb
@wch
wch / demo.r
Last active March 25, 2024 13:02
mcmapply demonstration
m <- matrix(1:12, nrow=3)
# Double every element
# ===================
# Method 1: nested for loop
for(i in seq_len(nrow(m))) {
for(j in seq_len(ncol(m))) {
m2[i, j] <- m[i, j] * 2
}
@catherinedevlin
catherinedevlin / gist:6588378
Last active December 23, 2015 05:39
IPython Notebook: your new SQL Client (lightning talk from PostgresOpen 2013)
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@tedmiston
tedmiston / webcam-cv2.py
Last active May 4, 2023 11:56
Display the webcam in Python using OpenCV (cv2)
"""
Simply display the contents of the webcam with optional mirroring using OpenCV
via the new Pythonic cv2 interface. Press <esc> to quit.
"""
import cv2
def show_webcam(mirror=False):
cam = cv2.VideoCapture(0)
@timelyportfolio
timelyportfolio / code.R
Last active May 26, 2024 00:41
rCharts Implements d3.js Sankey Plugin
require(rCharts)
require(rjson)
#get source from original example
#this is a JSON, so will need to translate
#this is complicated and unnecessary but feel I need to replicate
#for completeness
#expect most data to come straight from R
#in form of source, target, value
@stephenturner
stephenturner / .Rprofile.r
Last active January 3, 2025 12:36
My .Rprofile
## See http://gettinggeneticsdone.blogspot.com/2013/06/customize-rprofile.html
## Load packages
library(BiocInstaller)
## Don't show those silly significanct stars
options(show.signif.stars=FALSE)
## Do you want to automatically convert strings to factor variables in a data.frame?
## WARNING!!! This makes your code less portable/reproducible.