Skip to content

Instantly share code, notes, and snippets.

@NoahTheDuke
NoahTheDuke / .vimrc
Created November 15, 2013 14:14
Error Finding in my vim set-up
" nocompatible is a must, as is utf-8
set nocompatible
filetype off " required!
set rtp+=$HOME/.vim/bundle/neobundle.vim/
call neobundle#rc(expand('~/.vim/bundle/'))
" let Vundle manage Vundle
" required!
NeoBundleFetch 'Shougo/neobundle.vim'
### Keybase proof
I hereby claim:
* I am noahtheduke on github.
* I am noahtheduke (https://keybase.io/noahtheduke) on keybase.
* I have a public key whose fingerprint is 95CA 4DE7 425D 24D8 F5E5 40F2 2DFB 7517 A037 BCBA
To claim this, I am signing this object:
# Inspiration from [http://danthedev.com/2015/09/09/lisp-in-your-language/]
# Let's see what we can do in Python, eh?
# Lisp data structures:
# * Use ( and ) to denote lists
# * Arguments are space separated
# * First item is a function
# * Remaining items are the arguments
native = {
@NoahTheDuke
NoahTheDuke / strand_sort_variations.py
Last active October 13, 2015 19:47
Testing the speed of various implementations of Strand Sort
import timeit
from random import shuffle, randrange
from statistics import mean
from functools import partial
from collections import deque
def merge_original_1(left, right):
i = 0
j = 0
merged_list = []
In [27]: %%timeit
...: result = []
...: for i in range(2000):
...: result.append(i * 2)
...:
1000 loops, best of 3: 285 µs per loop
In [28]: %%timeit
...: result = []
...: add = result.append
import random
from bisect import bisect
from itertools import accumulate
class Struct:
def __init__(self, alist):
self.alist = alist
def main():
def blocks_light(x, y):
'''my_map is a nested list() of Tile objects that have block_sight, blocked, etc as in the classic tutorial.
'''
global my_map
return my_map[x][y].block_sight
def set_visible(x, y):
'''visible_tiles is a set() of (x, y) tuples, tracking which tiles are visible.
it is reset every time fov is recalculated.
PS C:\Users\noah\Personal\roguelike> python3 .\tut.py
24 bits font.
key color : 0 0 0
24bits greyscale font. converting to 32bits
quickFOV 0.0013250349431546578
fov_algo 0.000496591807854921
quickFOV 0.0006293323388328886
fov_algo 0.0004001968984543858
quickFOV 0.0006218261778547785
fov_algo 0.00043614745892739393
@NoahTheDuke
NoahTheDuke / ack_naive.rs
Last active March 2, 2018 21:36
A bunch of extremely fast Ackermann function implementations in Rust, plus a terrible naive one
extern crate time;
use time::PreciseTime;
fn main() {
let m = 3;
// Can't go higher, cuz it runs out of stack space.
for n in 1..12 {
println!("n: {}", n);
extern crate time;
use time::PreciseTime;
fn main() {
let m = 3;
for n in 20..31 {
println!("n: {}", n);
let s = PreciseTime::now();