Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@timmyshen
timmyshen / springer-free-maths-books.md
Created December 29, 2015 23:23 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of books available for free, here are the direct links
@timmyshen
timmyshen / NBA_stats_mining.py
Created December 27, 2015 16:30 — forked from tonyromarock/NBA_stats_mining.py
Scrapping NBA player stats from stats.nba.com
import requests
import csv
import sys
# get me all active players
url_allPlayers = ("http://stats.nba.com/stats/commonallplayers?IsOnlyCurrentSeason"
"=0&LeagueID=00&Season=2015-16")
#request url and parse the JSON
@timmyshen
timmyshen / bobp-python.md
Created November 21, 2015 01:31 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@timmyshen
timmyshen / mice_imp.R
Created October 9, 2015 21:39 — forked from mick001/mice_imp.R
Imputing missing data with R; MICE package: Full article at http://datascienceplus.com/imputing-missing-data-with-r-mice-package/
# Using airquality dataset
data <- airquality
data[4:10,3] <- rep(NA,7)
data[1:5,4] <- NA
# Removing categorical variables
data <- airquality[-c(5,6)]
summary(data)
#-------------------------------------------------------------------------------
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
# Step 1.
seaflow <- read.csv('seaflow_21min.csv', header=T)
summary(seaflow)
# Step 2.
# a <- sample(dim(seaflow)[1], dim(seaflow)[1]*0.8)
# trainseaflow <- seaflow[a,]
# b <- 1:dim(seaflow)[1]
# test.df <- seaflow[setdiff(b, a),]
@timmyshen
timmyshen / source.cpp
Created August 29, 2014 02:49
random generator
#include <iostream>
#include <chrono>
#include <random>
int main(int argc, char* argv [])
{
auto x = 1;
std::cout << "auto variable x = " << x << std::endl;
srand(0u);
import sys
import json
def hw():
print 'Hello, world!'
def lines(fp):
print str(len(fp.readlines()))
def main():