Skip to content

Instantly share code, notes, and snippets.

View sparr's full-sized avatar

Clarence "Sparr" Risher sparr

  • Amazon
  • Whitinsville, MA, USA
View GitHub Profile
@sparr
sparr / gist:6287686
Last active December 21, 2015 09:49
testing gnu grep 2.5.1 for matching leading unescaped curly braces
sparr$ grep --version
grep (GNU grep) 2.5.1
Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sparr$ echo "foo { bar" | grep "{"
foo { bar
sparr$ echo "foo { bar" | grep -E "{"
@sparr
sparr / gist:7030099
Created October 17, 2013 18:46
NECTR packing list
PACK:
home
air mattress
sleeping bag
blankets
rope
toys
clothes
camera
generator
@sparr
sparr / sched_to_guidebook_exhibitors_csv.pl
Last active December 26, 2015 11:19
convert sched.org vendor list exported csv to guidebook exhibitor list importable csv
#!/usr/bin/perl
use Text::CSV;
my @rows;
my $csv = Text::CSV->new ( { binary => 1 } ) # should set binary attribute.
or die "Cannot use CSV: ".Text::CSV->error_diag ();
# discard metadata non-rows
<>; # Sched: [nameoflist],Downloaded on 1999-09-09 9:09:09 pm,,,,,,,,,,
@sparr
sparr / gist:8409141
Last active January 3, 2016 04:29
depluralize mediawiki template parameter
{{#sub:{{lc: {{{1}}} }}|0|-3}}{{#ifeq:
{{#sub:
{{lc: {{{1}}} }}|
-3
}}|
men|
man|
{{#ifeq:
{{#sub:
{{lc: {{{1}}} }}|
@sparr
sparr / gist:9875737
Last active August 29, 2015 13:57
one bitflip per increment
A binary numerical encoding wherein sequential integers only differ from each other
by a single bit. I'm calling this "one bitflip per increment" encoding. This is my
proposal to a question posed on the Artisan's Asylum discussion mailing list, with
the topic being looking for numerical encodings that are friendly to possibly-genetic
algorithmic solutions to problems where only bitwise operations are used, and thus
finding a solution of "10000" from "01111" is unlikely, while finding "10000" from
"10001" is easy. The nth lsbit of the mask flips every 2^n increments.
bin | obpi | mask
0000 | 0000 | 0000
@sparr
sparr / dogfight_dangerzone.java
Last active August 29, 2015 14:04
Attempt at avoiding certain death situations in codegolf.se koth dogfight
// has this plane hit a wall, or is it guaranteed to?
boolean dangerZone(Plane icarus) {
// outside the arena is instant death
if (!icarus.getPosition().isInArena(arenaSize)) {
return true;
}
// adjacent to a wall?
// directly facing the wall?
// death next turn
if (
@sparr
sparr / gist:f98aa275d6055f04faf4
Created August 2, 2014 01:02
working dict up to n=64
0:
(2, -1, -1) ('[]', '0')
1:
(4, -1, -1) ('[[]]', '1')
2:
(6, -1, -1) ('[[[]]]', '2')
3:
(8, -1, -1) ('[[[[]]]]', '3')
4:
(10, -1, -1) ('[[[[[]]]]]', '4')
@sparr
sparr / controller.py
Last active August 29, 2015 14:04
programming pacman controller with patches
#!/usr/bin/env python
import math
import pygame
import random
import sys
import subprocess
import os
import shlex
import select
@sparr
sparr / fib.mbl
Last active August 29, 2015 14:04
Partially working unofficial Marbelous interpreter in Python
.. I0 .. ..
P0 /\ -- ..
.. .. =0 ++
.. P0 -- O0
.. .. =0 ++
.. .. \/ O0
-- /\ -- ..
MB .. -- ..
\\ .. MB ..
.. O0 // ..
@sparr
sparr / scopecount
Last active May 8, 2016 02:22
SublimeText theme gallery scope usage count
574 : string [std]
311 : source
278 : entity [std]
253 : keyword [std]
242 : comment [std]
236 : entity.name.tag
229 : constant [std]
212 : support.function [std]
209 : storage [std]
209 : entity.other.attribute-name