Skip to content

Instantly share code, notes, and snippets.

View FireyFly's full-sized avatar

FireFly FireyFly

View GitHub Profile
@FireyFly
FireyFly / gist:5365694
Created April 11, 2013 18:02
Brainfuck implementation in `sed`
#!/bin/sed -rf
# Sedfuck - brainfuck interpreter in sed.
# Written by Jonas Höglund (FireFly, firefly.nu).
h
s/^(.|[^.])*$/0/
# Setup some memory.
s/0/0000000000/g
#s/0/0000000000/g
@FireyFly
FireyFly / code.catena.sh
Last active December 16, 2015 03:39
Catena scratchpad
#### Library definitions ########################
#### drop
drop2 := drop drop;
drop3 := drop drop2;
drop4 := drop drop3;
drop5 := drop drop4;
#### nip
nip := dip [drop];
@FireyFly
FireyFly / rps.js
Last active December 16, 2015 11:19 — forked from yorickvP/rps.js
function RPS(count) {
this.players = count
this.score = range(count).map(Const(0))
this.moves = range(count).map(limit(Array,0))
}
RPS.prototype.beats = { "rock": "scissors",
"paper": "rock",
"scissors": "paper" }
@FireyFly
FireyFly / fun.js
Created April 23, 2013 18:53
JS obfustring stuff
console.log((
$=([]+!+[]),_=([]+[][(![]+[])[+[]]+([][[]]+[])[!![]+!+[]+!+[]+!+[]+!+[]]+(![]+[]
)[!![]+!+[]]+$[+[]]+$[!![]+!+[]+!+[]]+$[+!![]]]),$_=([]+[][(![]+[])[+[]]+([][[]]
+[])[!![]+!+[]+!+[]+!+[]+!+[]]+(![]+[])[!![]+!+[]]+$[+[]]+$[!![]+!+[]+!+[]]+$[+!
![]]])[!![]+!+[]+!+[]]+_[!![]+!+[]+!+[]+!+[]+!+[]+!+[]]+_[!![]+!+[]]+(![]+[])[!!
[]+!+[]+!+[]]+$[+[]]+$[+!![]]+$[!![]+!+[]]+([]+[][(![]+[])[+[]]+([][[]]+[])[!![]
+!+[]+!+[]+!+[]+!+[]]+(![]+[])[!![]+!+[]]+$[+[]]+$[!![]+!+[]+!+[]]+$[+!![]]])[!!
[]+!+[]+!+[]]+$[+[]]+([]+[][(![]+[])[+[]]+([][[]]+[])[!![]+!+[]+!+[]+!+[]+!+[]]+
(![]+[])[!![]+!+[]]+$[+[]]+$[!![]+!+[]+!+[]]+$[+!![]]])[!![]+!+[]+!+[]+!+[]+!+[]
+!+[]]+$[+!![]],_=$_[$_][$_]("$",$[+!![]]+$[!![]+!+[]+!+[]]+$[+[]]+$[!![]+!+[]]+
@FireyFly
FireyFly / thisless.js
Last active December 17, 2015 00:38
Get rid of `this` thing
"use strict"
// Attempt to shoehorn Lua's (or Python's) "first parameter is `this`" model
// into JS's object model. Makes us not have to worry about `this` at all.
Function.prototype.applyW = function (args) {
return this.apply(null, args)
}
function wrap(fn) {
NB. I7 bits
1
1111
1 101 1
0 101 001
----
{-
f . g x . h $ y f . g x . h y
($) (.)
/ \ / \
/ \ / \
(.) y f (.)
/ \ .´ `.
/ \ .´ `.
f (.) (appl) (appl)
@FireyFly
FireyFly / gtb.js
Created February 13, 2014 23:02
GTB compiler thing
// Use \ to escape []%
var map = { "\\[": "[",
"\\]": "]",
"\\%": "%",
"[": ":Lbl 0:",
"]": ":Goto 0:",
"@": ":If ",
"#": ":Else",
"$": ":Then:",
-- for testing
function server(url)
return function (tbl)
print(url)
for k,v in pairs(tbl) do
print(k,v)
end
end
end
@FireyFly
FireyFly / keybase.md
Last active August 29, 2015 14:23
Keybase proof

Keybase proof

I hereby claim:

  • I am FireyFly on github.
  • I am firefly (https://keybase.io/firefly) on keybase.
  • I have a public key whose fingerprint is 1FB1 834E EDE9 D1AA 38F3 9BEA 45FF FB70 B372 5D5C

To claim this, I am signing this object: