Skip to content

Instantly share code, notes, and snippets.

View nicolashahn's full-sized avatar

Nicolas Hahn nicolashahn

View GitHub Profile
ssh LRCKwVFbt8K5zA3gkZHj5sAcB@sfo2.tmate.io
class NotIn:
def __repr__(self):
return "<not in dict>"
NOT_IN = NotIn()
def ddiff(A, B):
""" Create a dict that shows the difference between two dicts. """
use std::collections::HashMap;
use std::fmt::Debug;
use std::hash::Hash;
use KeyDiff::{Added, Changed, Removed};
#[derive(Debug)]
enum KeyDiff<V: PartialEq> {
Added(V),
Removed(V),
Changed(V, V),
@nicolashahn
nicolashahn / alacritty.recording
Last active May 23, 2019 13:52
Reproduce rendering bug in alacritty and vim without tmux
]0;fish /home/nhahn(BWelcome to fish, the friendly interactive shell
[?2004h]0;fish /home/nhahn(B⏎(B
❰nhahn❙~❱✔≻(B vv(Bim(Bim(Bvim(Bm  .tmux.conf(B.tmux.conf(B.tmux.conf(Bv(Bimrc(Bimrc(Bmrc(Brc(Bc(B
(B[?2004l]0;vim /home/nhahn(B
[?1006h[?1002h[?2004h[?1049h[?1h=[?2004h[?12h[?12l[
]0;fish /Users/nhahn(BWelcome to fish, the friendly interactive shell
[?2004h]0;fish /Users/nhahn(B⏎(B
❰nhahn❙~❱✔≻(B tt(Bm(Bux(Bux(Bx(Btmux(B (B -V(B
(B[?2004l]0;tmux /Users/nhahn(B
[?1049h[?1h=[?12l[?25h[?1000l[?1002l[?1006l[?1005l(B[?12;25h[?12l[?25h[?1003l[?1006l[?2004l]112[?1006h[?1002h[?25l




alert();
@nicolashahn
nicolashahn / computer.glsl
Created June 15, 2018 17:34 — forked from bdon/computer.glsl
rc computer
//https://thebookofshaders.com/edit.php
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
import sys
import numpy as np
import operator
# def discriminant(a,b,c):
# return (b**2) - 4*a*c
# def quadratic(a,b,c):
# """Compute roots from a polynomial of the form ax^2 + bx + c."""
# ops = [operator.add, operator.sub]
@nicolashahn
nicolashahn / lisp.py
Created March 6, 2018 08:12
lisp parser
def token_to_atom(token):
''' ints, floats converted, everything else string '''
if token[0] in '1234567890':
if '.' in token:
return float(token)
return int(token)
return token
def tokens_to_tree(tokens):
''' take out parens, nest lists '''

Keybase proof

I hereby claim:

  • I am nicolashahn on github.
  • I am nickhahn (https://keybase.io/nickhahn) on keybase.
  • I have a public key ASDQvw94Kfz_5xNcpmsFEZ61JZpmvWvO-pyBTjFC2MWD1Ao

To claim this, I am signing this object: