Skip to content

Instantly share code, notes, and snippets.

alfredkrohmer /
Created Nov 23, 2016
XBox One Wireless Controller Protocol

Physical layer

The dongle itself is sending out data using 802.11a (5 GHz WiFi) with OFDM and 6 Mbit/s data rate:

Radiotap Header v0, Length 38
    Header revision: 0
    Header pad: 0
    Header length: 38
    Present flags
alfredkrohmer /
Created Feb 11, 2017
List all user-installed packages on OpenWrt / LEDE
FLASH_TIME=$(opkg info busybox | grep '^Installed-Time: ')
for i in $(opkg list-installed | cut -d' ' -f1)
if [ "$(opkg info $i | grep '^Installed-Time: ')" != "$FLASH_TIME" ]
echo $i
alfredkrohmer /
Last active Jun 7, 2020
Wrapper script for an etcd cluster on AWS ECS
# This script decides if we are part of the process of bootstrapping a new etcd cluster
# or if we are joining an already existing cluster.
set -eux -o pipefail
# own IP address
own_ip=$(curl -f -s
alfredkrohmer /
Created Mar 19, 2017
Proposal: Deduplicated storage and transfer of container images

Proposal: Deduplicated storage and transfer of container images

Docker uses layers to build containers and images on top of other images. This saves storage and transfer of layers already existing on the system. Rkt uses no layers and needs to fully download any new image.

This document proposes to use deduplication to store and transfer container images. This has multiple advantages over layering:

alfredkrohmer / dmesg
Created Nov 16, 2016
dmesg output for mt7612u driver
View dmesg
Nov 16 17:56:39 desktop kernel: rtusb init mt7610u --->
Nov 16 17:56:39 desktop kernel:
=== pAd = ffffc90003e34000, size = 1371608 ===
Nov 16 17:56:39 desktop kernel: <-- RTMPAllocTxRxRingMemory, Status=0
Nov 16 17:56:39 desktop kernel: <-- RTMPAllocAdapterBlock, Status=0
Nov 16 17:56:39 desktop kernel: ==>rlt_wlan_chip_onoff(): OnOff:1, Reset= 1, pAd->WlanFunCtrl:0x0, Reg-WlanFunCtrl=0x20a
Nov 16 17:56:40 desktop kernel: RtmpChipOpsEepromHook::e2p_type=0, inf_Type=2
Nov 16 17:56:40 desktop kernel: RtmpEepromGetDefault::e2p_dafault=1
Nov 16 17:56:40 desktop kernel: NVM is EFUSE mode
alfredkrohmer /
Last active Oct 13, 2017
NetworkManager dispatcher script to add certain domains for a VPN device when using systemd-resolved (place in /etc/NetworkManager/dispatcher.d, make it executable and adapt VPN domains and connection name)
set -ex
# ----------------------------------------------------------------------------
# Configuration:
"Some VPN name") # enter name of VPN connection in NetworkManager here
alfredkrohmer / gpio-send.c
Created Aug 6, 2017
Send an arbitrary series of 0's and 1's to a GPIO with given intervals between the level change (e.g. for sending a code over a 433 MHz sender)
View gpio-send.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char **argv) {
if(argc < 4 || argc % 2) {
"Usage: %s <path to GPIO value file> <interval 1> <interval 2> ... <interval n>\n\n"
"Provide the path to the 'value' file of the GPIO in sysfs and an even number of intervals\n", argv[0]);
alfredkrohmer / server.rb
Created Aug 23, 2016
Web Terminal for Docker container with Sinatra and Websockets
View server.rb
require 'sinatra'
require 'sinatra-websocket'
require 'docker-api'
require 'pty'
set :server, 'thin'
def new_state
alfredkrohmer / synchronize_with_unique_argument.rb
Created Jul 19, 2016
Runs the given block synchronized with the argument given; i.e. for the same argument the block is never run in multiple threads simultaneously, while for different arguments the block can run in parallel in multiple threads.
View synchronize_with_unique_argument.rb
# synchronizes the given block, but only when called with the same argument
def synchronize_with_unique(arg, mutex, map, &block)
# get the lock for the supplied argument while increasing the refcount
lock_info = mutex.synchronize do
info = (map[arg] ||= { lock:, count: 0 })
info[:count] += 1
# do the actual locking
View ubuntu-systemd-nspawn-boot
–> systemd-nspawn -bD ubuntu1404_test
Spawning container ubuntu1404_test on /frzclient/images/ubuntu1404_test.
Press ^] three times within 1s to kill container.
init: Unable to create device: /dev/kmsg
* Stopping Send an event to indicate plymouth is up [ OK ]
* Starting Clean /tmp directory [ OK ]
* Stopping Clean /tmp directory [ OK ]
* Stopping Populate /dev filesystem [ OK ]
* Starting Signal sysvinit that virtual filesystems are mounted