Skip to content

Instantly share code, notes, and snippets.

@insom
insom / pi-dac.c
Created Mar 1, 2021
Quick and Dirty Pi 256x256 Raster Display using a TLC7528CN DAC
View pi-dac.c
#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/gpio.h"
#include "test.h"
#define FIRST_GPIO 0
char frame[256][256] = {0};
int main() {
@insom
insom / scrolling.c
Created Jan 2, 2021
experiments with vt100 scrolling
View scrolling.c
/* vim:ts=2:sw=2:expandtab
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios orig_termios;
@insom
insom / libvirtnovnc.py
Created Nov 8, 2012
Libvirt NoVNC Proxy
View libvirtnovnc.py
#!/usr/bin/python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Based on work Copyright (c) 2012 Openstack, LLC.
import Cookie
import os
import socket
import sys
import websockify
@insom
insom / mod_space_core.c
Created Feb 8, 2012
Space Core Apache Module
View mod_space_core.c
/* ====================================================================
* Copyright (c) 2012 The Apache Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
@insom
insom / glacier.py
Created Aug 22, 2012 — forked from almost/glacier.py
Amazon Glacier from Python. Based on Boto, will contribute to Boto when it's a little more finished if it's any good at that point :)
View glacier.py
# Thomas Parslow http://almostobsolete.net
# Just a work in progress and adapted to what I need right now.
# It does uploads (via a file-like object that you write to) and
# I've started on downloads. Needs the development version of Boto from Github.
#
# Example:
#
# glacierconn = GlacierConnection(AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY)
# writer = GlacierWriter(glacierconn, GLACIER_VAULT)
# writer.write(somedata)
@insom
insom / despair.cpp
Created Feb 6, 2020
MySQL Session Tracking for ALL_GTIDS
View despair.cpp
#include <cstdio>
#include <mysql.h>
void retrieve_session_track_data(MYSQL *m) {
const char *data;
size_t length;
for(int type=0; type <= 255; type++) {
if (mysql_session_track_get_first(m, (enum enum_session_state_type) type, &data, &length) == 0) {
do {
View wg-config.bash
#!/bin/bash
modprobe ipv6
modprobe udp_tunnel
modprobe ip6_udp_tunnel
ip link add dev wg0 type wireguard
wg setconf wg0 /etc/wireguard/config
wg showconf wg0
brctl addbr internet
brctl stp internet on
ip link set up dev wg0
@insom
insom / keymap.c
Created Feb 27, 2018
Nyquist Keymap File
View keymap.c
#include "nyquist.h"
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
@insom
insom / pthread_test.c
Created May 8, 2017
Let's make a lot of threads!
View pthread_test.c
// gcc -D_GNU_SOURCE=1 -std=c99 a.c
#include <sched.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int f(void *p) {
sleep(2);
}
@insom
insom / mastodon-experiment.py
Created Apr 23, 2017
Teensy Tiny OStatus / Mastodon server
View mastodon-experiment.py
import json
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route("/.well-known/host-meta")
def hostmeta():