Skip to content

Instantly share code, notes, and snippets.

Avatar

Joachim Wiberg troglobit

View GitHub Profile
@troglobit
troglobit / mping-howto.md
Created May 23, 2022
Using mping to script multicast switching/routing verification
View mping-howto.md

HowTo: using mping for (fun and) profit

Ever since I started working with multicast back in the early 2000's, I've had to make my own tools. There weren't that many useful ones available, at least not in the Open Source space where I worked.

The first tool made, mcjoin, was based on an example an IBM'er had made public. I used that, the standard ping(1) tool, and tcpdump(1), to check my multicast flows.

@troglobit
troglobit / libnl-debug.md
Last active Apr 22, 2022
Developing and debugging libnl
View libnl-debug.md

Developing & debugging libnl

When I started out learning about libnl, around 10 years ago, I did not fully understand it. Mostly because I didn't (want to) understand Netlink. A great way to learn something is to try to fix a bug, or develop a new feature, because then you will want to write both tests and demo applications, which you may end up having to debug! Debuggers give you backtraces, which will help you understand how your program works.

> Note: for debugging embedded systems using gdb-server, see the following blog post I wrote

@troglobit
troglobit / local.mk
Created Apr 5, 2022
Buildroot local.mk extensions and overrides
View local.mk
#BR2_ROOTFS_OVERLAY := $(BR2_ROOTFS_OVERLAY) $(BR2_EXTERNAL_NETBOX_PATH)/jocke
LINUX_OVERRIDE_SRCDIR = /home/jocke/src/linux
#IPROUTE2_OVERRIDE_SRCDIR = /home/jocke/src/iproute2
#MDIO_TOOLS_OVERRIDE_SRCDIR = /home/jocke/src/github.com/jocke/mdio-tools
#MDIO_TOOLS_AUTORECONF = YES
#PLY_OVERRIDE_SRCDIR = /home/jocke/src/github.com/jocke/ply
#PLY_AUTORECONF = YES
#TCPDUMP_OVERRIDE_SRCDIR = /home/jocke/src/github.com/the-tcpdump-group/tcpdump
#LIBPCAP_OVERRIDE_SRCDIR = /home/jocke/src/github.com/the-tcpdump-group/libpcap
@troglobit
troglobit / ANSI.md
Created Jan 18, 2022 — forked from fnky/ANSI.md
ANSI Escape Codes
View ANSI.md

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@troglobit
troglobit / u-boot.txt
Last active Jul 9, 2021
Marvell MacchiatoBin U-Boot
View u-boot.txt
Marvell>> printenv
baudrate=115200
bootargs=console=ttyS0,115200 root=/dev/nfs rw ip=0.0.0.0:0.0.0.0:10.4.50.254:255.255.255.0:marvell:eth0:none nfsroot=0.0.0.0:/srv/nfs/
bootcmd=run get_env; run get_images; run set_bootargs; booti $kernel_addr $ramfs_addr $fdt_addr
bootdelay=2
console=console=ttyS0,115200
eth1addr=00:51:82:11:22:01
eth2addr=00:51:82:11:22:02
eth3addr=00:51:82:11:22:03
ethact=mvpp2-0
@troglobit
troglobit / world.sh
Created Jun 18, 2021
Sets up a complete network world inside a network namespace
View world.sh
#!/bin/sh -x
# Sets up a complete network world inside a network namespace
ns=world
ip netns add $ns
for i in 1 2 3 4; do
ip netns exec $ns ip link add eth$i type veth peer p$i
done
@troglobit
troglobit / expecting.md
Created May 28, 2021 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts
View expecting.md

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@troglobit
troglobit / rtdump.c
Last active May 3, 2021
Read IPv4 routes from main routing table in Linux using netlink
View rtdump.c
/* Read kernel IPv4 routes from main routing table
*
* Copyright (c) 2021 Joachim Wiberg <troglobit@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
@troglobit
troglobit / settings.ini
Created May 3, 2021
Adwaita Dark mode for Firefox when running plain Awesome
View settings.ini
# ~/.config/gtk-3.0/settings.ini
[Settings]
gtk-icon-theme-name = Adwaita-dark
gtk-theme-name = Adwaita-dark
gtk-font-name = DejaVu Sans 11
@troglobit
troglobit / rc.lua
Created May 3, 2021
.config/awesome/rc.lua
View rc.lua
-- Copy from /etc/xdg/awesome/rc.lua to .config/awesome/rc.lua
--
-- My additions
local r = require("runonce")
...
-beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
+beautiful.init(gears.filesystem.get_themes_dir() .. "zenburn/theme.lua")
...
- }, properties = { titlebars_enabled = true }