Skip to content

Instantly share code, notes, and snippets.

Avatar

Clarence "Sparr" Risher sparr

View GitHub Profile
@sparr
sparr / gist:6287686
Last active Dec 21, 2015
testing gnu grep 2.5.1 for matching leading unescaped curly braces
View gist:6287686
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 Oct 17, 2013
NECTR packing list
View gist:7030099
PACK:
home
air mattress
sleeping bag
blankets
rope
toys
clothes
camera
generator
@sparr
sparr / sched_to_guidebook_exhibitors_csv.pl
Last active Dec 26, 2015
convert sched.org vendor list exported csv to guidebook exhibitor list importable csv
View sched_to_guidebook_exhibitors_csv.pl
#!/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 Jan 3, 2016
depluralize mediawiki template parameter
View gist:8409141
{{#sub:{{lc: {{{1}}} }}|0|-3}}{{#ifeq:
{{#sub:
{{lc: {{{1}}} }}|
-3
}}|
men|
man|
{{#ifeq:
{{#sub:
{{lc: {{{1}}} }}|
@sparr
sparr / gist:9875737
Last active Aug 29, 2015
one bitflip per increment
View gist:9875737
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 Aug 29, 2015
Attempt at avoiding certain death situations in codegolf.se koth dogfight
View dogfight_dangerzone.java
// 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 (
View gist:f98aa275d6055f04faf4
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 Aug 29, 2015
programming pacman controller with patches
View controller.py
#!/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 Aug 29, 2015
Partially working unofficial Marbelous interpreter in Python
View fib.mbl
.. I0 .. ..
P0 /\ -- ..
.. .. =0 ++
.. P0 -- O0
.. .. =0 ++
.. .. \/ O0
-- /\ -- ..
MB .. -- ..
\\ .. MB ..
.. O0 // ..
@sparr
sparr / scopecount
Last active May 8, 2016
SublimeText theme gallery scope usage count
View scopecount
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
You can’t perform that action at this time.