View battery.sh
#!/bin/sh
# * * * * * battery.sh /home/brb/Dropbox/battery-stats.txt
set -eu
for b in /sys/class/power_supply/BAT*; do
echo "$(basename "$b") $(date +%s) $(cat ${b}/power_now) $(cat ${b}/energy_now)" >> $1
done
View tshark-esp.sh
#!/bin/sh
set -eu
HOST=$1
PCAP=$2
AWK_CMD='{print "\"IPv4\",\"" $2 "\",\"" substr($4, 1, length($4)-1) "\",\"" $8 "\",\"AES-GCM [RFC4106]\",\"" $19 "\",\"ANY 128 bit authentication [no checking]\",\"\""}'
ssh $HOST "sudo ip -o xfrm state" | awk "$AWK_CMD" >> $HOME/.config/wireshark/esp_sa
tshark -o esp.enable_encryption_decode:TRUE -d udp.port==6784,vxlan -nr $PCAP esp
View 2016.md

In 2016 I thoroughly logged most of my days (302/366 days; didn't log on climbing trips). Some stats:

  • 183 days when I took a cold shower in the morning.
  • 113 sessions of pilates in the morning.
  • 106 days when I meditated >5min.
  • Ran 339.39km (46 sessions).
  • Commuted 63 days by bike.
  • 114 sessions of climbing; 159hr spent indoors.
  • 65 days when I had at least one meal with meat.
  • Consumed 483 caffeine units (>20mg).
View README.md

HOWTO

  1. Get a token from Weave Cloud and set it in prometheus.yaml.
  2. Install Prometheus on Kubernetes: kubectl apply -f prometheus.yaml
  3. Goto http://NODE_IP:30900/targets to check status.
View fetch.sh
#!/bin/bash
set -ue
API_URL="https://circleci.com/api/v1.1"
VCS_TYPE="github"
CACHE_DIR="/tmp/.circleci-grep"
PROJECT=""
BUILD=""
View ftrace.sh
echo 0 > /sys/kernel/debug/tracing/tracing_on
echo > /sys/kernel/debug/tracing/trace
echo function_graph > /sys/kernel/debug/tracing/current_tracer
echo $KERNEL_FUNCTION > /sys/kernel/debug/tracing/set_graph_function
echo 1 > /sys/kernel/debug/tracing/tracing_on
$DO_STUFF
echo 0 > /sys/kernel/debug/tracing/tracing_on
echo > /sys/kernel/debug/tracing/set_graph_function
View widen-gh-code-sections.user.js
// ==UserScript==
// @name widen-gh-issues
// @description Widens code sections at Github issues pages
// @version 0.0.1
//
// @match https://github.com/*/*/issues/*
// @match https://github.com/*/*/pull/*
// ==/UserScript==
WIDEN = "WIDEN";
View withnetns_strace.log
This file has been truncated, but you can view the full file.
execve("./prog/weaveutil/weaveutil", ["./prog/weaveutil/weaveutil", "container-addrs", "weave", "09a29216781c", "859174e2a134", "6f1b45b7ca7f", "84ce7a1efba9", "4b78fdc29e51", "69dd95e85c99", "3b6f18e9cf59", "7266af2ad316", "77f96221b996", "f2cc8f7ba6fd", "44be62695f69", "6caa9c024124", "ee1a86ede15b", "b8cf2435ed46", "f352eaf0ac97", "09fc9dca3e9e", "5c9799078a84", "660ba4a51ef9", "4f2930f97dde", "2a8034422ae8", "21ca7c97d883", "754c0571e48c", "8281423c6b3b", "19328cdafdb8", "36027a3b2639", "e75efc9eae56", "625fd8775652", "86bb47219417", "2da4dd07188b", "4b7ef00a3dac", "a9cdbd956012", "44e62ebb4194", "fc06dddedbbb", "256f08324429", "6b9825a7542a"], [/* 17 vars */]) = 0
uname({sysname="Linux", nodename="fitzroy", ...}) = 0
brk(NULL) = 0x16c7000
brk(0x16c81c0) = 0x16c81c0
arch_prctl(ARCH_SET_FS, 0x16c7880) = 0
set_tid_address(0x16c7b50) = 3357
set_robust_list(0x16c7b60, 24) = 0
View menu.lst
timeout 0
# spawnd is used to control which cpus are booted
#
# "spawnd boot" will use the skb and pci to figure out and
# boot all cores in the machine
#
# "spawnd boot bootapic-x86_64=1-5" will not use the skb and
# boot the list of cores passed as argument.
# The APIC id of the cores to boot should be specified.
View ec2-update-etchosts.sh
#!/bin/bash
# Update /etc/hosts with public non-elastic IPs of EC2 instances.
# Assumes that a name is set for each instance and there is only one value inside tags section.
PREFIX="aws_"
FILTER=".Reservations[].Instances[] |
select(.PublicIpAddress != null) |
.PublicIpAddress + \" $PREFIX\" + .Tags[].Value"