Skip to content

Instantly share code, notes, and snippets.

View jayeye's full-sized avatar

jayeye

View GitHub Profile
@jayeye
jayeye / clocks.c
Created February 27, 2018 05:00
demonstrate high-res timers
#include <stdio.h>
#include <time.h>
const int kSamples = 16;
int main(int argc, char* argv[]) {
struct timespec t[kSamples];
for (int i = 0; i < kSamples; ++i) {
clock_gettime(CLOCK_REALTIME, &t[i]);
}
@jayeye
jayeye / kl.json
Created September 12, 2018 20:27
kl
[
{
"name": "Stick",
"author": "JI",
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-L1Nx",
"pcb": true
},
[
@jayeye
jayeye / BUILD
Created April 27, 2017 05:00
stamping with build information. Obviously, replace _slash_ in the filenames with an actual slash!
package(default_visibility = ["//visibility:public"])
genrule(
name = "genpybuildinfo",
outs = [
"buildinfo.py",
],
stamp = 1,
cmd = "./$(location tools/mkpybuildinfo.sh) > \"$@\"",
tools = [
@jayeye
jayeye / README.md
Created October 3, 2016 21:45
Setting up ISC dhclient on debian / ubuntu for prefix delegation

My ISP (Time Warner Cable) hands out IPv6 addresses with DHCPv6; it will delegate a /56 if asked. So long as I keep refreshing the lease, it won't renumber me. I have my cable modem set to bridge, and do all the firewalling, NATing, etc., on a Debian box. In what follows, eth0 is the internal interface.

The dhclient that ships with debian/ubuntu does not support asking for a prefix delegation, so I had to build one from sources.

@jayeye
jayeye / README
Created March 11, 2018 23:50
Run chrome in its own memory-limited cgroup
Ugly hack to run chrome in a memory-limited cgroup so it does not kill your workstation
when it tries to consume all available memory.
Put this in /usr/local/bin/cchrome, add that to whatever menu system you are using.
You can verify it worked by running:
grep memory `ps ax | grep chrome | grep -v grep | awk '{printf "/proc/%s/cgroup\n", $1}'`
This has only been tested on kubuntu desktop. Obviously, if you have not enabled
passwordless-sudo for yourself, create and chmod the cgroup directory from some