Skip to content

Instantly share code, notes, and snippets.

@rwev
rwev / tsc-gruntfile.js
Last active June 13, 2019 05:55
Grunt configuration for on-change compilation and execution TypeScript files.
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON(
'package.json'),
watcher: {
options: {
dateFormat: function(
time) {
grunt.log
@rwev
rwev / fib.py
Created October 16, 2019 16:26
Compare fibonacci calculation speed in Python and Cython
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import pyximport; pyximport.install()
import fib
from time import time
@rwev
rwev / fib.pyx
Created October 16, 2019 16:27
Fibonacci calculation in Cython
cpdef fibcy(int n):
cdef int i
cdef double a=0.0, b=1.0
for i in range(n):
a, b = a + b, a
return a
@rwev
rwev / cybaw-test.py
Created October 16, 2019 16:31
Test speed of BAW option pricing calculations in Cython.
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import pyximport; pyximport.install()
import baw, cybaw
from time import time
from collections import namedtuple
@rwev
rwev / 3d-corr-vis.py
Created November 14, 2019 17:44
Visualize 3D correlations, inspired by Paul Graham's analysis in _Why Nerds Are Unpopular_
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pylab as pl
from mpl_toolkits.mplot3d import Axes3D
xx = np.array([0, 10]) # smart
yy = np.array([0, 10]) # nerd
zz = np.array([0, 10]) # unpopular

Keybase proof

I hereby claim:

  • I am rwev on github.
  • I am rwev (https://keybase.io/rwev) on keybase.
  • I have a public key whose fingerprint is 3D0A 484B 0D60 1C04 90E4 9AB2 F348 9370 83D4 EEB8

To claim this, I am signing this object:

@rwev
rwev / .aliases
Created May 27, 2021 22:20 — forked from nscornia/.aliases
# colored highlighting is awesome
if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then
eval `dircolors ~/.dircolors`
alias ls='ls -hF --color=auto'
alias grep='grep --color=always'
alias fgrep='fgrep --color=always'
alias egrep='egrep --color=always'
fi