Skip to content

Instantly share code, notes, and snippets.

View Artiavis's full-sized avatar

Jeff Rabinowitz Artiavis

View GitHub Profile
@Artiavis
Artiavis / binomial_option_pricing.py
Last active December 25, 2015 03:29
A little script for evaluating and solving the binomial tree method of pricing vanilla European and American options. Takes parameters for specifying American/European call/put, number of periods, underlying price, u, d, strike, and interest.
from math import exp
from itertools import islice
import argparse
def window(seq, n=2):
it = iter(seq)
result = tuple(islice(it, n))
if len(result) == n:
yield result
for elem in it:
@Artiavis
Artiavis / GPA Calculator.py
Last active December 20, 2015 22:29
Simple command-line utility to help calculate a GPA.
import signal, sys
class _Getch:
"""Gets a single character from standard input. Does not echo to the
screen."""
def __init__(self):
try:
self.impl = _GetchWindows()
except ImportError:
self.impl = _GetchUnix()
@Artiavis
Artiavis / rmtex.py
Last active December 17, 2015 22:29
My first gist, a (hopefully) safe version of rmtex.
import os
import sys
import re
import argparse
def create_regex(reglist):
regopts = ['toc','bbl','aux','gz','blg','dvi','log','out']
filtlist = [exp for exp in reglist if exp in regopts]
if not filtlist:
raise TypeError('Invalid Regex')