Skip to content

Instantly share code, notes, and snippets.

View samuelcolvin's full-sized avatar

Samuel Colvin samuelcolvin

View GitHub Profile
@samuelcolvin
samuelcolvin / git_commands.md
Last active August 29, 2015 13:57
Git commands

Standard commands

git clone git@github.com:[username]/[project-name].git
git pull
git fetch
git push
git status
git log
git diff file...

git commit -a -m "msg"

@samuelcolvin
samuelcolvin / Betwise_smart_markets_PandL.py
Created April 19, 2014 11:55
Betwise Smart Market Performance Analysis
import os
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from datetime import datetime as dtdt
pd.set_option('display.width', 160)
pd.set_option('display.max_rows', 50)
pd.set_option('display.max_info_rows', 20)
pd.set_option('display.max_info_columns', 20)
@samuelcolvin
samuelcolvin / json_performance.jl
Last active August 29, 2015 14:00
Julia vs. Python JSON Performance comparison
versioninfo()
using JSON
tic()
fio = open("test_data.json", "r")
text = readall(fio)
print("file loaded and read: ")
toc()
print("Parsing JSON from string: ")
@time jjson_data = JSON.parse(text)
fio = open("test_data.json", "r")
@samuelcolvin
samuelcolvin / json_indent_performance.jl
Created May 25, 2014 09:17
JSON print performance with indent
Previous performance:
elapsed time: 7.237158689 seconds (2688899208 bytes allocated)
Performance with indent implemented:
elapsed time: 10.58000847 seconds (2789486440 bytes allocated) - indent set to 0
elapsed time: 11.382926355 seconds (3966498496 bytes allocated) - indent set to 2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="bokeh.css" type="text/css" />
<script type="text/javascript" src="bokeh.js"></script>
<script type="text/javascript">
$(function() {
@samuelcolvin
samuelcolvin / py_vs_jl.jl
Created July 3, 2014 11:51
rand, cumprod Julia vs. Python
x = rand(1000,100)
repeats = 1000
f1 = () -> cumprod(x,1)
print(" f1: ")
@time [f1() for i in 1:repeats]
f2() = cumprod(x, 1)
print(" f2: ")
@time [f2() for i in 1:repeats]
@samuelcolvin
samuelcolvin / .bashrc
Last active August 29, 2015 14:10
bashrc
# history length:
HISTSIZE=10000
HISTFILESIZE=20000
# set by me
export PS1='\u:\W || '
alias shortp="export PS1='\u:\W || '"
alias longp="export PS1='\u@\h:\# \w || '"
alias gs="git status"
alias gl="git log"
@samuelcolvin
samuelcolvin / Buy Rate Equations.ipynb
Created February 21, 2015 12:24
Buy Rate Equations.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@samuelcolvin
samuelcolvin / dt
Created April 11, 2015 17:16
datetime util
#! /usr/bin/python
import argparse
import subprocess
import os
import datetime
import re
from dateutil.parser import parse as du_parse
from dateutil import tz
from termcolor import colored
@samuelcolvin
samuelcolvin / config.log
Created June 4, 2015 20:59
GnuTLS build error
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by nettle configure 2.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ /home/samuel/.julia/v0.3/GnuTLS/deps/src/nettle-2.7/configure --prefix=/home/samuel/.julia/v0.3/GnuTLS/deps/usr
## --------- ##
## Platform. ##