Skip to content

Instantly share code, notes, and snippets.

@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

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 / 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
@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 / 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 / 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 / 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
import sys
from RGBtoXTerm256 import rgb2short
nord_colormap = {
# Polar Night black -> grey
"___nord00":"2E3440",
"___nord01":"3B4252",
"___nord02":"434C5E",
"___nord03":"4C566A",
# Snow Storm: grey -> white
@rwev
rwev / leaflet-openweathermap.d.ts
Last active April 15, 2019 02:58
TypeScript definitions for leaflet-openweathermap
// Type definitions for leaflet-openweathermap
// By rwev <https://github.com/rwev>
import * as L from 'leaflet';
declare module 'leaflet' {
namespace OWM {
interface Clouds extends L.TileLayer {}
@rwev
rwev / econev.py
Created December 16, 2018 04:29
Python web-scraper for economic events on the Bloomberg Econoday calendar.
# -*- coding: utf-8 -*-
"""
ECONEV.PY: Economic Events
Python web-scraper for economic events on the Bloomberg Econoday calendar.
Saves result of scrape to plain text (in Eastern Time) for flexible processing by other applications.
Author: rwev (https://github.com/rwev)