Skip to content

Instantly share code, notes, and snippets.

View python.exe script.py --help-commands
C:\etc\Python36-32\python.exe C:/git/pythonScript.py --help-commands
Standard commands:
build build everything needed to install
build_py "build" pure Python modules (copy to build directory)
build_ext build C/C++ extensions (compile/link to build directory)
build_clib build C/C++ libraries used by Python extensions
build_scripts "build" scripts (copy and fixup #! line)
clean clean up temporary files from 'build' command
install install everything from build directory
install_lib install all Python modules (extensions and pure Python)
View bls_spending.R
library(rvest)
library(magrittr)
library(ggplot2)
library(dplyr)
library(tidyr)
library(scales)
# get page
pg <- html("http://www.bls.gov/opub/ted/2015/consumer-spending-by-age-group-in-2013.htm#tab-2")
View agentBasedModel.cpp
// http://adv-r.had.co.nz/Rcpp.html#rcpp-classes
#include <Rcpp.h>
using namespace Rcpp;
double vacc3a(double age, bool female, bool ily){
double p = 0.25 + 0.3 * 1 / (1 - exp(0.04 * age)) + 0.1 * ily;
p = p * (female ? 1.25 : 0.75);
p = std::max(p, 0.0);
p = std::min(p, 1.0);
@ttmmghmm
ttmmghmm / shiny em.Rmd
Last active Aug 29, 2015
shiny examples
View shiny em.Rmd
# https://github.com/daattali/shinyjs/blob/master/vignettes/overview.Rmd
library(shiny)
shinyApp(
ui = fluidPage(
div(id = "myapp",
h2("shinyjs demo"),
textInput("name", "Name", ""),
numericInput("age", "Age", 30),
textInput("company", "Company", ""),
p("Timestamp: ", span(date())),
View cranPkgsDepGraph.R
# http://blog.revolutionanalytics.com/2014/10/introducing-minicran.html
library("miniCRAN")
sessionInfo()
pkgs <- c("chron")
pkgDep(pkgs)
p <- makeDepGraph(pkgs, enhances = TRUE)
@ttmmghmm
ttmmghmm / ETFs via Quandl
Last active Mar 27, 2016
Quandl constituents.R, ETFs via Quandl, etfGetSymsParallel.R, iShares ETFs, TTR IKTrading .R
View ETFs via Quandl
# https://stackoverflow.com/questions/5246843/how-to-get-a-complete-list-of-ticker-symbols-from-yahoo-finance
# See also below (txt <- paste("http://www.nasdaq.com/quotes/",
library(readr)
library(dplyr)
library(magrittr) # after dpylr?
#setInternet2(TRUE)
csvQuandlUrl <- 'http://s3.amazonaws.com/quandl-static-content/Ticker+CSV%27s/'
csvQuandl <- list(
'Stock Index Constituents' = c(
'S&P 500 Index' = 'Indicies/SP500.csv',
@ttmmghmm
ttmmghmm / git commands
Last active Mar 27, 2016
packageCreate installPackage gitCmds installR
View git commands
# https://www.kernel.org/pub/software/scm/git/docs/giteveryday.html
Individual Developer (Standalone) commands are essential for anybody who makes a commit, even for somebody who works alone.
standalone developer does not exchange patches with other people, and works in a single repository, using:
git-init(1) to create a new repository.
git-log(1) to see what happened.
git-checkout(1) and git-branch(1) to switch branches.
git-add(1) to manage the index file.
git-diff(1) and git-status(1) to see what you are in the middle of doing.