Skip to content

Instantly share code, notes, and snippets.

@erikankrom
erikankrom / accounts-models.py
Created September 5, 2011 22:36
Multiple Profiles for Internal/External Users
from django.db import models
from django.contrib.auth import User
from mycompany.models import Client
from userprofiles.models import Profile
class External(Profile):
#External-specific models
client = models.ForeignKey(Client)
def __unicode__(self):
@gpakosz
gpakosz / gist:2947616
Created June 18, 2012 09:18
vim - toggle between relative / absolute / no line numbering
if exists("+relativenumber")
set relativenumber " show relative line numbers
set numberwidth=3 " narrow number column
" cycles between relative / absolute / no numbering
function! RelativeNumberToggle()
if (&relativenumber == 1)
set number number?
elseif (&number == 1)
set nonumber number?
else
@miguelvm
miguelvm / ibapiexample_1.py
Last active April 16, 2017 15:25
Synchronizing IB python client to get historical data
# Download API from http://interactivebrokers.github.io/#
#
# Install python API code /IBJts/source/pythonclient $ python3 setup.py install
#
# Note: The test cases, and the documentation refer to a python package called IBApi,
# but the actual package is called ibapi. Go figure.
#
# Get the latest version of the gateway:
# https://www.interactivebrokers.com/en/?f=%2Fen%2Fcontrol%2Fsystemstandalone-ibGateway.php%3Fos%3Dunix
# (for unix: windows and mac users please find your own version)
# Download API from http://interactivebrokers.github.io/#
#
# Install python API code /IBJts/source/pythonclient $ python3 setup.py install
#
# Note: The test cases, and the documentation refer to a python package called IBApi,
# but the actual package is called ibapi. Go figure.
#
# Get the latest version of the gateway:
# https://www.interactivebrokers.com/en/?f=%2Fen%2Fcontrol%2Fsystemstandalone-ibGateway.php%3Fos%3Dunix
# (for unix: windows and mac users please find your own version)
@derekwyatt
derekwyatt / dir.sh
Created August 18, 2011 14:04
A BASH script to handle directory management
export DIRSTACK_MAX=15
DS=()
function eecho
{
echo $@ 1>&2
}
function shiftStackUp
{
@egh
egh / jabber-hipchat.el
Last active January 3, 2018 18:08
jabber.el hipchat setup
(require 's)
(require 'request)
(require 'seq)
(require 'jabber)
(defvar hipchat--user-info-for-completion nil)
(defcustom hipchat-nickname "Full name" "Hipchat real name (see see https://hipchat.com/account/xmpp)."
:type '(string)
@tribut
tribut / mosh_pc.sh
Last active June 4, 2018 11:33
wrapper for mosh to work with ssh's proxycommand directive. this only makes sense if the target machine is directly reachable from the internet using udp (but probably not via tcp). usage: mosh_pc.sh [host as mentioned in .ssh/config] [public ip of host]
#!/bin/sh
# ########################################################## #
# wrapper for mosh to work with ssh's proxycommand directive #
# this only makes sense if the machine is directly reachable #
# from the internet using udp. #
# ########################################################## #
THISSCRIPT="`basename \"$0\"`"
REMOTE="$1"
@jaymon0703
jaymon0703 / CSCV3.Rmd
Last active October 6, 2018 16:08
Marcos Lopez de Prado - CSCV_3 program from Financial Charlatanism paper- http://www.ams.org/notices/201405/rnoti-p458.pdf
---
title: A replication of the Practical Application section in 'The Probability of Backtest
Overfitting' - Bailey et al.
output:
html_notebook:
# html_document:
# df_print: paged
---
In their paper "The Probability of Backtest
======================================================
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10
======================================================
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu
8.10. The article is targeted at a production environment, but keep in mind
this is a more generalized environment. You may have different requirements,
but this article should at least provide the stepping stones.
The article will use distribution packages where nesscary. As of 8.10 the
@puffnfresh
puffnfresh / hipchat.el
Created November 2, 2012 15:34
HipChat + jabber.el
;; Connect using jabber-connect
;; My username from the HipChat configuration
;; from https://www.hipchat.com/account/xmpp
(setq jabber-account-list '(("10804_81219@chat.hipchat.com")))
;; To join HipChat rooms easily
(defvar hipchat-number "10804")
(defvar hipchat-nickname "Brian McKenna")
(defun hipchat-join (room)