Skip to content

Instantly share code, notes, and snippets.

View hgn's full-sized avatar

Hagen Paul Pfeifer hgn

View GitHub Profile
@hgn
hgn / builddriver.py
Last active June 19, 2019 08:38
Python Builddriver API Brainstorming
import builddriver
result = builddriver.execute("make debug")
result.status()
# can be True or False
result.log()
# return a path where the output is captured (/tmp/foo.log)
@hgn
hgn / example.conf
Last active February 27, 2021 01:11
Simple Python aiohttp Server with Configuration Parsing and Logging
server_addr = "127.0.0.1"
server_port = 8888
# debug level, can be debug, error, info, ...
loglevel = "debug"
paths = {
"route_set" : "/",
"interface_get" : "/",
function alex_hash() {
var hash = 0;
if (this.length == 0) return hash;
for (i = 0; i < this.length; i++) {
char = this.charCodeAt(i);
hash1 = ((char)-hash)+char;
hash2 = ((char<<8)-hash)+char;
hash3 = ((char<<16)-hash)+char;
hash4 = ((char<<24)-hash)+char;
hash = (hash1 ^ hash2 ^ hash3 ^ hash4) & 0xFFFFFF;
@hgn
hgn / python-json-types.py
Created August 25, 2016 11:19 — forked from NelsonMinar/python-json-types.py
Testing various dict wrappers for Python JSON
"""
Various options for a JSON type for Python.
My best effort at using these libraries naturally for reading and writing JSON.
https://nelsonslog.wordpress.com/2016/01/08/a-better-python-object-for-json/
"""
import json, copy
import dotmap, attrdict, easydict, addict
sudo mount /dev/sda2 /
# mounting sda2 is boot time related via fstab:
# UUID=01e804ec-cc93-44c9-8b92-8fcd41c95aff / btrfs rw,relatime,space_cache 0 0
# now add sdb1 to /
sudo btrfs device add /dev/sdb1 /
sudo btrfs filesystem show
# Label: none uuid: 01e804ec-cc93-44c9-8b92-8fcd41c95aff
@hgn
hgn / gist:485f6c5c1b5ac69719db
Created April 2, 2015 20:31
OpenWRT New Client Signal Generator for Arduino LED
#!/usr/bin/perl
# Nexus 4
$db{'10:68:ff:ff:ff:ff'} = 0;
# Nexus 5
$db{'c4:43:ff:ff:ff:ff'} = 0;
sub worker {
$scan=`(iw dev wlan1 station dump; iw dev wlan0 station dump) | grep Station`;
foreach $key (keys(%db)) {
@hgn
hgn / gist:9666ef57df9b3525c712
Created March 29, 2015 15:31
Dropbear login
@virgo:/tmp $ ssh -vvvv [email protected]
OpenSSH_6.7p1 Debian-3, OpenSSL 1.0.1k 8 Jan 2015
debug1: Reading configuration data /home/pfeifer/.ssh/config
debug1: /home/pfeifer/.ssh/config line 101: Applying options for *
debug3: macs ok: [hmac-sha1,hmac-ripemd160]
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.10.10.1 [10.10.10.1] port 22.
debug1: Connection established.
@hgn
hgn / tcpdump IPv6 router advertisement
Created March 16, 2015 18:59
Capture of IPv6 advertisement message via tcpdump
@virgo:~ $ sudo tcpdump -vvvv -ttt -i eth1 icmp6 and 'ip6[40] = 134'
00:00:00.000000 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 200) fe80::b675:eff:fefa:1cb > ip6-allnodes: [icmp6 sum ok] ICMP6, router advertisement, length 200
hop limit 0, Flags [managed, other stateful], pref medium, router lifetime 1800s, reachable time 0s, retrans time 0s
source link-address option (1), length 8 (1): b4:75:0e:fa:01:cb
0x0000: b475 0efa 01cb
mtu option (5), length 8 (1): 1280
0x0000: 0000 0000 0500
prefix info option (3), length 32 (4): 2a01:ffff:43f::/64, Flags [onlink, auto], valid time 7200s, pref. time 1800s
0x0000: 40c0 0000 1c20 0000 0708 0000 0000 2a01
0x0010: ffff 043f 0000 0000 0000 0000 0000
@hgn
hgn / ping-rtt-to-gnuplot
Last active March 26, 2018 08:39
Ping based RTT Measurement with Gnuplot for IPv4 and IPv6
ping heise.de -c 300 -ni 0.5 | awk -F '[= ]' {'print $(NF-1)'} | grep -E '[0-9]' > /tmp/ipv4.dat
ping6 heise.de -c 300 -ni 0.5 | awk -F '[= ]' {'print $(NF-1)'} | grep -E '[0-9]' > /tmp/ipv6.dat
cat << EOF > /tmp/ping-rtt.gpi
#!/usr/bin/gnuplot
set terminal svg size 1000,600 fname "Gill Sans" fsize 14 rounded dashed
set style line 80 lt 0
set style line 80 lt rgb "#808080"
set style line 81 lt 3
set style line 81 lt rgb "#808080" lw 0.5
@hgn
hgn / munich.json
Created May 14, 2014 08:45
munich
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.