Skip to content

Instantly share code, notes, and snippets.

View troglobit's full-sized avatar
🎯
Focusing

Joachim Wiberg troglobit

🎯
Focusing
View GitHub Profile
@troglobit
troglobit / u-boot.txt
Last active July 9, 2021 18:19
Marvell MacchiatoBin U-Boot
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 June 18, 2021 13:10
Sets up a complete network world inside a network namespace
#!/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 12:54 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

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 09:46
Read IPv4 routes from main routing table in Linux using netlink
/* 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 01:07
Adwaita Dark mode for Firefox when running plain Awesome
# ~/.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 01:01
.config/awesome/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 }
@troglobit
troglobit / .Xresources
Created May 3, 2021 00:55
Xterm setup on Debian 11
Xft.antialias: true
!xterm.termName: xterm-256color
xterm*metaSendsEscape: true
xterm*scrollBar: false
xterm*scrollbar.width: 8
xterm*reverseVideo: on
xterm*renderFont: default
[ 0.243765] PM: Magic number: 13:418:885
[ 0.243832] block2mtd: Using custom MTD label 'Config' for dev /dev/sda
[ 0.867417] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
[ 0.868154] block2mtd: mtd0: [0] erase_size = 4KiB [4096]
[ 0.868224] printk: console [netcon0] enabled
@troglobit
troglobit / espressobin-uboot.md
Last active January 21, 2021 11:37
EspressoBIN U-Boot defaults and HowTo

Default 1

Marvell>> printenv 
baudrate=115200
bootargs=console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000 root=/dev/mmcblk0p1 rw rootwait net.ifnames=0 biosdevname=0
bootcmd=mmc dev 0; ext4load mmc 0:1 $kernel_addr $image_name;ext4load mmc 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/mmcblk0p1 rw rootwait net.ifnames=0 biosdevname=0; booti $kernel_addr - $fdt_addr
bootdelay=2
console=console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000
eth1addr=00:51:82:11:22:01
@troglobit
troglobit / emacs-over-ssh
Last active September 10, 2020 10:03
Open file in Emacs over SSH
C-x C-f /sshx:amazon: