Skip to content

Instantly share code, notes, and snippets.

View rvaiya's full-sized avatar

rvaiya

View GitHub Profile
@rvaiya
rvaiya / keysym_to_keyd.txt
Last active September 17, 2023 13:25
A list of X keysyms and their corresponding keyd codes on a standard US layout.
esc Escape
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
#!/usr/bin/python3
# Generates a keyd config consisting of modifier layers in which each modified keycode is
# mapped to its identity. This is a proof of concept and not intended to be used
# in practice. See https://github.com/rvaiya/keyd/issues/119
from itertools import combinations
mods = ['meta', 'alt', 'shift', 'control']
@rvaiya
rvaiya / zip.js
Last active July 5, 2023 08:13
tinyzip.js - A tiny zip file generator in 70 lines of javascript.
// Author: Raheman Vaiya
// License: WTFPL
//
// A tiny zip generator in < 70 lines of javascript.
// Produces an uncompressed zip blob when fed an array
// of the form:
//
// [{name: 'filename', data: <Uint8Array>}]
//
// Useful for bookmarklets, don't use this in production :P.
@rvaiya
rvaiya / zip-anatomy.go
Last active November 30, 2021 06:54
An overview and sample implementation of the zip format.
package main
import "os"
import "hash/crc32"
// Basically an annotated runnable hex dump :P. See zip-implementation.go for an
// overview of the format and a barebones implementation.
func main() {
name := "test file.txt"
@rvaiya
rvaiya / orbit.c
Created February 9, 2019 03:20
Kensington Orbit scrollwheel as scroll toggle (x11).
/*
* Author: Raheman Vaiya
* License: WTFPL (do you really need one?)
* */
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>