Skip to content

Instantly share code, notes, and snippets.

@benthor
benthor / freebsd-compat.patch
Created June 9, 2011 18:23
proper freebsd support for djb's nacl-20110221
Only in nacl-20110221-patched: build
diff -aur nacl-20110221/curvecp/socket_bind.c nacl-20110221-patched/curvecp/socket_bind.c
--- nacl-20110221/curvecp/socket_bind.c 2011-02-21 01:49:34.000000000 +0000
+++ nacl-20110221-patched/curvecp/socket_bind.c 2011-06-09 16:50:33.000000000 +0000
@@ -9,6 +9,7 @@
{
struct sockaddr_in sa;
byte_zero(&sa,sizeof sa);
+ sa.sin_family = PF_INET;
byte_copy(&sa.sin_addr,4,ip);
@benthor
benthor / hyperboria.sh
Created October 13, 2012 11:20 — forked from cantor/hyperboria.sh
cjdns Init Script (start|stop|restart|status|flush|update|install|delete)
#!/bin/sh -e
### BEGIN INIT INFO
# hyperboria.sh - An init script (/etc/init.d/) for cjdns
# Provides: cjdroute
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Cjdns router
# Description: A routing engine designed for security, scalability, speed and ease of use.
@benthor
benthor / AnswerToExercise_1_22.lua
Created February 25, 2013 00:01
My off-hand Lua implementation of a solution to Exercise 1.22 in MIT SICP book. (see http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_thm_1.22) In "reply" to https://github.com/aknrdureegaesr/sicp_clj/blob/master/chapter1/src/chapter1/AnswerToExercise_1_22.clj where some possible Java JIT effects were observed. Usefulness is probab…
require 'os'
-- reimplementation of SICP section 1.2.6
function smallest_divisor(n)
return find_divisor(n,2)
end
function find_divisor(n, test_divisor)
if (test_divisor * test_divisor > n) then
return n
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"path/filepath"
"strings"
@benthor
benthor / prime.exs
Created May 10, 2016 13:42
Brief test if I got the gist of elixir.
defmodule Prime do
def checksieve([], _) do
true
end
def checksieve([head | tail], candidate) do
if rem(candidate, head) == 0 do
false
else
checksieve(tail, candidate)
@benthor
benthor / descriptors.txt
Created October 21, 2017 17:41
Huion GT-191 lsusb -v -d 256c:006e
Bus 001 Device 013: ID 256c:006e
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
@benthor
benthor / hid_report_descriptors.txt
Created October 21, 2017 17:44
Huion GT-191 usbhid-dump -ed -m 256c:006e
001:013:001:DESCRIPTOR 1508607113.084405
05 0D 09 02 A1 01 85 0A 09 20 A1 00 09 42 09 44
09 45 09 3C 09 43 09 44 15 00 25 01 75 01 95 06
81 02 09 32 75 01 95 01 81 02 81 03 05 01 09 30
09 31 55 0D 65 33 26 FF 7F 35 00 46 00 08 75 10
95 02 81 02 05 0D 09 30 26 FF 1F 75 10 95 01 81
02 C0 C0
001:013:000:DESCRIPTOR 1508607113.086466
06 00 FF 09 01 A1 01 85 08 75 58 95 01 09 01 81
@benthor
benthor / pen_buttons.txt
Created October 21, 2017 17:47
Huion GT-191 (256c:006e) usbhid-dumps
001:013:000:STREAM 1508607510.340793
08 80 F2 A3 0B 5D 00 00 00 00 00 00
001:013:000:STREAM 1508607510.358549
08 80 F2 A3 0B 5D 00 00 00 00 00 00
001:013:000:STREAM 1508607510.378585
08 80 F2 A3 0B 5D 00 00 00 00 00 00
001:013:000:STREAM 1508607510.396542
@benthor
benthor / pen_pressure.txt
Created October 21, 2017 17:49
Huion GT-191 (256c:006e) usbhid-dumps
001:013:000:STREAM 1508607393.570738
08 80 12 A3 1A 54 00 00 00 00 00 00
001:013:000:STREAM 1508607393.590702
08 80 12 A3 1A 54 00 00 00 00 00 00
001:013:000:STREAM 1508607393.608542
08 80 12 A3 1A 54 00 00 00 00 00 00
001:013:000:STREAM 1508607393.626710
@benthor
benthor / pen_coords.txt
Created October 21, 2017 17:54
Huion GT-191 (256c:006e) usbhid-dumps Raw
001:013:000:STREAM 1508607215.882507
08 80 00 00 00 00 00 00 00 00 00 00
001:013:000:STREAM 1508607216.582698
08 80 00 00 00 00 00 00 00 00 00 00
001:013:000:STREAM 1508607216.600520
08 80 00 00 00 00 00 00 00 00 00 00
001:013:000:STREAM 1508607216.618510