Skip to content

Instantly share code, notes, and snippets.

@insom
insom / web-safe.glsl
Created April 18, 2024 00:26
A shader to make the world use 216 web-safe colours.
#version 330
in vec2 texcoord;
uniform sampler2D tex;
uniform float opacity;
vec4 default_post_processing(vec4 c);
vec4 window_shader() {
vec2 texsize = textureSize(tex, 0);
@insom
insom / ppp.md
Created October 9, 2023 21:02
Running PPPoE in its own network namespace.

Problem

I don't want a single router, I want a pair. But I also don't want two dedicated pieces of equipment, which is wasteful.

I already have two machines I could use, but their network namespace is polluted with all sorts of stuff (unauthenticated Redis etc.). I don't want to put them "on" the Internet.

I tried running VyOS VMs but couldn't get a full 1 gigabit out of them on the hardware that I have.

Solution

@insom
insom / glacier.py
Created August 22, 2012 09:51 — 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 :)
# 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 / render.py
Created April 28, 2023 03:16
Render a UF2 file (from 100r) on the terminal.
#!/usr/bin/env python3
import sys
f = open(sys.argv[1], 'rb')
print(sys.argv[1])
across = 0
for q in sys.argv[2]:
c = ord(q)
f.seek(0, 0)
widths = f.read(256)
#!/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 / docker-compose-eccles.yml
Created January 2, 2023 18:36
Docker Compose for Mastodon
version: '3'
services:
web:
build: .
image: tootsuite/mastodon
network_mode: host
ulimits:
as:
hard: 6192000000
soft: 6048000000
@insom
insom / Makefile
Last active March 8, 2022 17:05
Add new statement-based replication records to a MySQL binary log
.PHONY: all
all: main
./main
mysqlbinlog --verify-binlog-checksum --start-position 711 output
main: main.c
gcc main.c -o main
@insom
insom / sortish.cc
Created September 11, 2021 03:21
Kind of sort two products in C++
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>
#include <utility>
#include <string>
using namespace std;
typedef pair<string,int> product;
@insom
insom / shader.sh
Created June 23, 2021 01:19
Amber Screen Shader
#!/bin/bash
# original b&w version from gemini://perso.pw/blog//articles/xorg-black-and-white.gmi
# which was itself inspired by https://github.com/bubbleguuum/toggle-monitor-grayscale
picom --backend glx --glx-fshader-win "uniform sampler2D tex;
uniform float opacity;
void main() {
vec4 c = texture2D(tex, gl_TexCoord[0].xy);
float y = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722));
@insom
insom / despair.cpp
Created February 6, 2020 13:04
MySQL Session Tracking for ALL_GTIDS
#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 {