Skip to content

Instantly share code, notes, and snippets.

@insom
insom / martian.honey
Created Nov 16, 2016
Exploring (void)variable for supressing warnings
View martian.honey
lappy:~ aaron$ cat a.C
int main(void) {
int a = 1 + 1;
}
lappy:~ aaron$ clang a.C -Wall
a.C:2:9: warning: unused variable 'a' [-Wunused-variable]
int a = 1 + 1;
^
1 warning generated.
lappy:~ aaron$ vim a.C
@insom
insom / spi-matrix.ino
Created Jun 13, 2016
Arduino SPI / Interrupt driven matrix display
View spi-matrix.ino
#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 Jun 11, 2016
Make pretty lights using a Raspberry Pi and a 74374N octal flip-flop
View 74374n-raspberry-pi.c
#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 Jun 10, 2016
mod_iweb but in LUA
View mod_iweb.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 Mar 11, 2016
Hello World for the Z80 Simulator
View hw.asm
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)
View keybase.md

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 Aug 29, 2015
Decode a VirtualWire encoded thingy
View decode-wav.py
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 Jun 29, 2015
Very low memory MySQL
View my.cnf
[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 Jun 24, 2015
container.json for a vivid guest
View container.json
{
"version": "0.1",
"os": "linux",
"arch": "amd64",
"processes": [
{
"tty": false,
"user": "root",
"args": [
"/doit.sh"
@insom
insom / README.md
Created Jun 3, 2015
Swatch Internet Time patched into strftime
View README.md

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).

You can’t perform that action at this time.