Skip to content

Instantly share code, notes, and snippets.

View samuelcolvin's full-sized avatar

Samuel Colvin samuelcolvin

View GitHub Profile
@samuelcolvin
samuelcolvin / cmongo.c
Created November 15, 2013 18:30
csv printer extension for python
#ifdef PYTHON
#include <Python.h>
#endif
#include "cmongo.h"
typedef int (*debug_func)(const char *, ...);
#define BLOCK 20000000
struct BigStr {
size_t buffer_size;
@samuelcolvin
samuelcolvin / compile_fortran.sh
Last active August 25, 2021 15:46
Vortex Performance comparison if Julia (Julia-lang), Fortran and Python
#!/bin/bash
gfortran -o $2 -fno-underscoring $1 libhgraph.a libg2c.so -L/usr/X11R6/lib64 -lX11
@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.