This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Generate a random array of bytes, with some redundancy (via sorting). | |
function gen_int_array(limit) | |
limit = limit or 10000 | |
local ri = lunatest.random_int | |
local length = ri(1, limit) | |
local ints = {} | |
for i=1,length do | |
-- keep them small, to increase duplication | |
ints[i] = ri(0, 2^8 - 1) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Use literal zero for escape before compression data | |
local esc = 0 | |
-- Run-length-encode an array of ints. | |
function encode(ints) | |
local res, i, ct = {}, 1, 1 -- result, index, count | |
while i <= #ints do | |
local v = ints[i] | |
while ints[i+1] == v do | |
ct = ct + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shift-and / shift-or | |
def to_bin(n, width=32): | |
"Pad a binary number to WIDTH bits wide" | |
s = bin(n).replace("0b", "") | |
return (("%0" + str(width) + "d") % int(s)) | |
# pg 20 | |
def shift_and(pattern, text, trace=False): | |
m = len(pattern) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat space_padness.c | |
/* | |
* Copyright (c) 2016 Scott Vokes <vokes.s@gmail.com> | |
* | |
* Permission to use, copy, modify, and/or distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2014 Scott Vokes <vokes.s@gmail.com> | |
* | |
* Permission to use, copy, modify, and/or distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local NONE = setmetatable({}, {['__tostring'] = function() return "NONE" end}) | |
local Array = { | |
['__newindex'] = function(a, k, v) | |
if type(k) ~= "number" then error("bad index") end | |
if k < 1 then error("out of bounds") end | |
if a._lim ~= NONE and k <= a._lim then | |
a._v[k] = v | |
elseif a._lim == NONE then | |
if k > a._len then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2014 Scott Vokes <vokes.s@gmail.com> | |
* | |
* Permission to use, copy, modify, and/or distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Setlist for The Mountain Goats at the Ladies Literary Club, | |
Grand Rapids, MI, 2009-11-04 | |
https://dl.dropboxusercontent.com/u/76615635/tmg-2009-11-04-GRMI-LLC.mp3 | |
Handball | |
Old College Try | |
Psalms 40:2 | |
Has Thou Considered the Tetrapod | |
Genesis 3:23 | |
Genesis 30:3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$eye = chop($eyes); | |
$the_cow = <<"EOC"; | |
$thoughts A__^ | |
$thoughts ($eye#)\\_______ | |
(__)\\ )\\/\\ | |
$tongue ||----w | | |
J| |V | |
EOC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sed -e "s/must/MUST/" \ | |
-e "s/must not/MUST NOT/" \ | |
-e "s/required/REQUIRED/" \ | |
-e "s/shall/SHALL/" \ | |
-e "s/shall not/SHALL NOT/" \ | |
-e "s/should/SHOULD/" \ | |
-e "s/should not/SHOULD NOT/" \ | |
-e "s/recommended/RECOMMENDED/" \ | |
-e "s/may/MAY/" \ |
NewerOlder