Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@insom
insom / spi-matrix.ino
Created June 13, 2016 22:48
Arduino SPI / Interrupt driven matrix display
#include <TimerOne.h>
#include <SPI.h>
#define COLS 5
#define LE 10
volatile char buf[COLS] = {0x0};
void setup() {
SPI.begin();
@insom
insom / 74374n-raspberry-pi.c
Created June 11, 2016 20:21
Make pretty lights using a Raspberry Pi and a 74374N octal flip-flop
#define _BSD_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define INPUT 17
#define OE 18
#define CLK 27
@insom
insom / mod_iweb.lua
Created June 10, 2016 15:29
mod_iweb but in LUA
require "apache2"
require "socket"
suffix = ".iwebcloud.co.uk"
function strip(hn)
local v = string.gsub(hn, suffix, "")
return string.match(v, "%w+%.cms")
end
function mapper(r)
ip, t = socket.dns.toip(r.headers_in.Host)
if string.find(t.name, suffix) then
@insom
insom / hw.asm
Created March 11, 2016 09:29
Hello World for the Z80 Simulator
org 00000h
ld c, 0
start:
; fetch data+c into a
ld h, 0
ld a, data
add c
ld l, a
ld a, (hl)
@insom
insom / keybase.md
Created February 5, 2016 13:38
Keybase Proof

Keybase proof

I hereby claim:

  • I am insom on github.
  • I am insom (https://keybase.io/insom) on keybase.
  • I have a public key ASAcAW4yegnZXKSN67zYpUktROYW13zm5m5sdhBGbuG-CQo

To claim this, I am signing this object:

@insom
insom / decode-wav.py
Last active August 29, 2015 14:26
Decode a VirtualWire encoded thingy
import wave, struct, sys
sixtofour = [ 0xd, 0xe, 0x13, 0x15, 0x16, 0x19, 0x1a, 0x1c, 0x23, 0x25, 0x26, 0x29, 0x2a, 0x2c, 0x32, 0x34 ]
data = []
states = ['START', 'PREAMBLE', 'GOTMAGIC', 'GOTLENGTH']
state = states[0]
bits = []
lengthbits = []
radiodata = []
@insom
insom / my.cnf
Created June 29, 2015 08:23
Very low memory MySQL
[mysqld]
skip-innodb
default-storage-engine=myisam
default-tmp-storage-engine=myisam
query_cache_size=0
max_connections=10
key_buffer_size=8
thread_cache_size=0
host_cache_size=0
thread_stack=131072
@insom
insom / container.json
Created June 24, 2015 08:54
container.json for a vivid guest
{
"version": "0.1",
"os": "linux",
"arch": "amd64",
"processes": [
{
"tty": false,
"user": "root",
"args": [
"/doit.sh"
@insom
insom / README.md
Created June 3, 2015 21:33
Swatch Internet Time patched into strftime

Usage

Compile beat.so as above, then add it to any program with LD_PRELOAD=<absolute-path-to-so-file>, like:

LD_PRELOAD=/home/insom/beat.so irc

(And in irssi just issue /SET TIMESTAMP_FORMAT {BEAT} to switch your status bar and timestamp entries to the One True Internet Time).

@insom
insom / httpdir_latest_meta-data_index.html
Created July 17, 2014 14:12
Example UEC Build with QEMU image file support in Packer
instance-id