Skip to content

Instantly share code, notes, and snippets.

Joshua Ulrich joshuaulrich

Block or report user

Report or block joshuaulrich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joshuaulrich
joshuaulrich / objSize.R
Created Dec 16, 2012
List objects from current scope by size
View objSize.R
objSize <- function(n=10, decreasing=TRUE) {
# list 'n' objects, sorted by size
l <- ls(envir=parent.frame())
N <- seq(min(length(l),n))
x <- setNames(lapply(l, object.size), l)
y <- x[order(unlist(x),decreasing=decreasing)]
z <- sapply(y, function(a) capture.output(print(a, units="auto")))
return(z[N])
}
@joshuaulrich
joshuaulrich / CBOE_csv_to_xts
Created Oct 19, 2012 — forked from jaredwoodard/CBOE_csv_to_xts
pulls csv files from the CBOE and converts them to xts
View CBOE_csv_to_xts
library(quantmod)
# we're pulling the Google VIX index (VXGOG) but this also works for VXAPL, VXGS etc.
# see http://www.cboe.com/micro/equityvix/introduction.aspx
url <- "http://www.cboe.com/publish/ScheduledTask/mktdata/datahouse/VXGOGDailyPrices.csv"
# use read.zoo to read the data directly into a zoo object
z <- read.zoo(url, header=TRUE, sep=",", skip=1, FUN=as.Date, format="%m/%d/%Y")
# convert to xts
View world indexes since 2008-06.r
require(quantmod)
#get index tickers without the ^ which we will add in the getSymbols
tckrs=c("GSPC","TNX","DJUBS","W3DOW","W5DOW")
#name the indexes
names(tckrs) <- c("S&P 500","US 10y Yld","DJ Commodity","Developed","Developing")
#use paste to add the ^ to the index tickers
getSymbols(paste("^",tckrs,sep=""), from="1986-01-01", to=Sys.Date())
View nPri.C
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main ( int argc, char *argv[] )
{
int n, r, k;
n = atoi(argv[1]); // # of available elements
k = atoi(argv[2]); // # of permutation index
r = atoi(argv[3]); // # of elements to be selected
You can’t perform that action at this time.