Skip to content

Instantly share code, notes, and snippets.

View kragen's full-sized avatar

Kragen Javier Sitaker kragen

View GitHub Profile

Some people have serious difficulty with some naturally occurring levels of heat. The CEO of Singapore, Lee Kuan Yew, has credited air conditioning with allowing his (tropical) country to develop economically; and in recent years, as I age, I find myself suffering increasing levels of impairment and ill-being from the Buenos Aires summer. But air conditioning has some disadvantages. It requires large, capital-intensive machinery; it consumes a lot of energy to cool large spaces, and a lot of power to cool spaces with a lot of surface area to a hot outdoors; and it isn’t portable to many places people would like to go.

@kragen
kragen / ideas.md
Last active January 23, 2019 02:03

What I have most of are ideas, that and paranoia about evildoers imperiling their realization with patents, or using patents to force them to be realized in ways that strengthen the existing structures of oppression. So here are a few ideas, in case anyone else is interested.

  • Programmable self-reproducing robots from inorganic raw materials, of course, are the absolute most important thing that anyone could be working on right now. This is the crucial missing piece that keeps us constrained to a political structure where the owners of
@kragen
kragen / gist:4b8644be70871c829448676900507c7d
Created November 30, 2017 20:35
how Hypothesis found a bug in my Adler-32 implementation
user@debian ~/dumpulse $ make test
cc -fPIC -g -Os -Wall -Wpedantic -std=c89 -o dumpulse.o -c dumpulse.c
cc -shared dumpulse_so.o dumpulse.o -o dumpulse.so
py.test-3 test.py
===================================== test session starts =====================================
platform linux -- Python 3.5.2, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /home/user/dumpulse, inifile:
plugins: hypothesis-3.0.1
collected 1 items

The World-Wide Web, for apps

-- Other candidates

--

Content-addressable blob stores for persistent, self-certifying trees

--

test 0046...[HTTP, get cookies and store in cookie jar]
46: protocol FAILED:
--- log/check-expected 2015-08-11 20:26:26.601137712 +0000
+++ log/check-generated 2015-08-11 20:26:26.601137712 +0000
@@ -1,5 +1,5 @@
GET /want/46 HTTP/1.1[CR][LF]
Host: 127.0.0.1:8990[CR][LF]
Accept: */*[CR][LF]
-Cookie: empty=; mooo2=indeed2; mooo=indeed[CR][LF]
private Flaunch(OrderManager om,
List<Duration> taus,
List<Duration> futureTimes,
long samplingInterval) {
this.om = om;
this.samplingInterval = samplingInterval;
for (Duration tau : taus) {
filters.add(ExponentialFilter.create(tau));
}
forwardDeltas = new long[futureTimes.size()];
@kragen
kragen / gist:dc93d2756747f63f333d
Created August 9, 2015 00:29
guix 0.8.1 failing
patch-shebang: /gnu/store/p5k561811xx6ipqqiz5anz5qjqhfdaa4-gzip-1.6/bin/znew: changing `/gnu/store/nx4zd42igyb7ghmv4mxv6ncg8wr7ypa1-bash-4.3.33/gnu/store/nx4zd42igyb7ghmv4mxv6ncg8wr7ypa1-bash-4.3.33/bin/bash' to `/gnu/store/nx4zd42igyb7ghmv4mxv6ncg8wr7ypa1-bash-4.3.33/bin/bash'
phase `patch-shebangs' succeeded after 0 seconds
starting phase `strip'
stripping binaries in "/gnu/store/p5k561811xx6ipqqiz5anz5qjqhfdaa4-gzip-1.6/bin" with "strip" and flags ("--strip-debug")
phase `strip' succeeded after 0 seconds
starting phase `validate-documentation-location'
phase `validate-documentation-location' succeeded after 0 seconds
starting phase `compress-documentation'
compressing documentation in '/gnu/store/p5k561811xx6ipqqiz5anz5qjqhfdaa4-gzip-1.6/share/man' with "gzip" and flags ("--best" "--no-name")
compressing documentation in '/gnu/store/p5k561811xx6ipqqiz5anz5qjqhfdaa4-gzip-1.6/share/info' with "gzip" and flags ("--best" "--no-name")
: user@debian:~/devel/dev3; cat modtree.py
#!/usr/bin/python
import sys
def main((_, modname,)):
showed = set()
for depth, name, filename in mod_tree(__import__(modname)):
print ' ' * 4 * depth, name, filename if name not in showed else ''
showed.add(name)
@kragen
kragen / gist:cbf6ddc77826a8c47591
Created June 9, 2015 09:22
a command-line game
: user@debian:~/devel/dev3; ./guess
I’ve chosen a number from 0 to 100. Try to guess it.
: user@debian:~/devel/dev3; ./guess 50
Your guess is too big!
: user@debian:~/devel/dev3; ./guess 25
Your guess is too small!
: user@debian:~/devel/dev3; ./guess 37
Your guess is too big!
: user@debian:~/devel/dev3; ./guess 31
@kragen
kragen / micromousetrap.js
Created June 8, 2015 23:20
A JavaScript micro-library for cross-browser keyboard event handling.
// This is an attempt to paper over the keycode differences between
// Gecko and WebKit (e.g. Iceweasel or Firefox and Chrome or
// Chromium), somewhat following the model of Mousetrap:
// <https://github.com/ccampbell/mousetrap>.
// The mapping tables herein are far from comprehensive, implementing
// more or less only what I need for this calculator.
function decodeKeyEvent(event) {
return decodeKeyEventProperties(event.key, event.keyCode, event.shiftKey);
}