Skip to content

Instantly share code, notes, and snippets.

View sushpa's full-sized avatar

sushpa

  • ETH Zürich
  • Zurich, Switzerland
View GitHub Profile
@rainyear
rainyear / lispy.py
Last active August 4, 2017 17:51 — forked from mnicky/lispy.py
################ Scheme Interpreter in Python
## (c) Peter Norvig, 2010; See http://norvig.com/lispy2.html
################ Symbol, Procedure, classes
from __future__ import division
import re, sys, StringIO
class Symbol(str): pass
anonymous
anonymous / rpn-jit.c
Created March 20, 2015 14:30
RPN JIT Compiler
/* http://redd.it/2zna5q
* Fibonacci example:
* (1) (2) +
* 0:0
* 1:1
* 20
*/
#define _BSD_SOURCE // MAP_ANONYMOUS
#include <stdio.h>
#include <stdlib.h>
@skeeto
skeeto / jit.c
Last active August 18, 2024 16:51
Basic JIT
/* http://redd.it/2z68di */
#define _BSD_SOURCE // MAP_ANONYMOUS
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/mman.h>
#define PAGE_SIZE 4096
@smhanov
smhanov / dawg.py
Last active February 23, 2026 22:18
Use a DAWG as a map
#!/usr/bin/python3
# By Steve Hanov, 2011. Released to the public domain.
# Please see http://stevehanov.ca/blog/index.php?id=115 for the accompanying article.
#
# Based on Daciuk, Jan, et al. "Incremental construction of minimal acyclic finite-state automata."
# Computational linguistics 26.1 (2000): 3-16.
#
# Updated 2014 to use DAWG as a mapping; see
# Kowaltowski, T.; CL. Lucchesi (1993), "Applications of finite automata representing large vocabularies",
# Software-Practice and Experience 1993
@jiahao
jiahao / bicgstabell.jl
Last active October 12, 2017 19:51
A transcription of the BiCGSTAB(ell) algorithm (Sleijpen and Fokkema, 1993, http://igitur-archive.library.uu.nl/math/2006-1214-210728/sleijpen_93_bicgstab.pdf)
function bicgstabell(K::KrylovSubspace; tol::Real, l::Int=1)
k=-l
initrand!(K)
#XXX Choose r̃[0]
r[0]=b-nextvec(K)
u[-1]=0
x[0]=K.v0
ρ₀=1
α=0
ω=1
// Answer to https://github.com/ry/http-parser/issues/#issue/1
// UNTESTED
struct line {
char *field;
size_t field_len;
char *value;
size_t value_len;
};