Skip to content

Instantly share code, notes, and snippets.

Avatar

Robin Smidsrød robinsmidsrod

View GitHub Profile
@robinsmidsrod
robinsmidsrod / debug.out.strace
Last active Mar 15, 2022
Perl 5.34.1 test suite failure with Time::HiRes on Ubuntu 18.04 on Azure VM
View debug.out.strace
execve("/home/portfolio/perlbrew/perls/perl-5.34.1/bin/perl", ["perl", "t/stat.t"], 0x7ffdd9beab48 /* 48 vars */) = 0
brk(NULL) = 0x563492d8d000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd57eb6b000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/portfolio/perlbrew/perls/perl-5.34.1/lib/5.34.1/x86_64-linux-thread-multi/CORE/tls/haswell/avx512_1/x86_64/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/portfolio/perlbrew/perls/perl-5.34.1/lib/5.34.1/x86_64-linux-thread-multi/CORE/tls/haswell/avx512_1/x86_64", 0x7ffe2d377500) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/portfolio/perlbrew/perls/perl-5.34.1/lib/5.34.1/x86_64-linux-thread-multi/CORE/tls/haswell/avx512_1/libperl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/portfolio
@robinsmidsrod
robinsmidsrod / userns.sls
Created Nov 4, 2021
userns.sls subuid subgid podman-compatible saltstack formula
View userns.sls
# Only supported on Ubuntu 18.04 and newer
{% if grains.osmajorrelease >= 18 %}
userns.uidmap:
file.touch:
- name: /etc/subuid
- unless: test -f /etc/subuid
userns.gidmap:
file.touch:
@robinsmidsrod
robinsmidsrod / read-omnikey.pl
Created Sep 29, 2021
OMNIKey chipcard reader Perl
View read-omnikey.pl
#!/usr/bin/perl
use strict;
use warnings;
use Chipcard::PCSC;
use Data::Dumper qw(Dumper);
use HTTP::Tiny ();
my $http = HTTP::Tiny->new();
@robinsmidsrod
robinsmidsrod / my-network
Created Aug 1, 2021
Home Assistant OS Wi-Fi configuration file
View my-network
# File /config/network/my-network in hassos-boot partition
[connection]
id=my-network
# Must be unique
uuid=YOUR_UUID_NUMBER
type=802-11-wireless
[802-11-wireless]
mode=infrastructure
ssid=YOUR_WIFI_NAME
@robinsmidsrod
robinsmidsrod / ubuntu-autoinstall.ipxe
Last active May 19, 2022
Ubuntu 20.04 autoinstall (casper/subiquity/curtin) to iPXE - work-in-progress (not fully working for iSCSI)
View ubuntu-autoinstall.ipxe
:ubuntu-autoinstall
echo Starting Ubuntu ${ubuntu-version} ${archl} autoinstaller for ${initiator-iqn}
sanhook ${base-iscsi}:${hostname}.boot.ubuntu || sleep 1
#sanhook ${base-iscsi}:${hostname}.boot.ubuntu && set ubuntu-cc-iscsi storage: { layout: { name: lvm }, config: [{type: disk, path: ${base-iscsi}:${hostname}.boot.ubuntu }] } || sleep 1
#sanhook ${base-iscsi}:${hostname}.boot.ubuntu && set ubuntu-iscsi ISCSI_INITIATOR=${initiator-iqn} ISCSI_TARGET_NAME=${base-iqn}:${hostname}.boot.ubuntu ISCSI_TARGET_IP=${iscsi-server} ISCSI_TARGET_PORT=3260 || sleep 1
# https://medium.com/@tlhakhan/ubuntu-server-20-04-autoinstall-2e5f772b655a
# https://ubuntu.com/server/docs/install/autoinstall
# https://github.com/canonical/cloud-init/blob/master/doc/examples/kernel-cmdline.txt
# https://matt.olan.me/raspberry-pi-iscsi-root-on-ubuntu-20-04/
# https://askubuntu.com/questions/1235723/automated-20-04-server-installation-using-pxe-and-live-server-image
View gist:a7da9f326d3e4e94a2a54f030abb8272
sensor:
- platform: mqtt
state_topic: "sensor/server-room/temperature"
name: "Server room temperature"
unit_of_measurement: "°C"
value_template: "{{ value | round(1) }}"
@robinsmidsrod
robinsmidsrod / make_vbox.sh
Created Nov 20, 2019
How to build iPXE VirtualBox ROM that fits into 56KB
View make_vbox.sh
make_vbox() {
pushd "$HOME/src/forked/ipxe/src" >/dev/null &&
make CONFIG=vbox bin/intel--virtio-net--pcnet32.isarom && #EMBED=config/vbox/embedded.ipxe &&
echo "Max size of VirtualBox ROM is 56KB, 57344 bytes" &&
ls -l bin/intel--virtio-net--pcnet32.isarom &&
prefix=$(date +%Y%m%d-%H%M%S) &&
mkdir -p /ipxe/$prefix &&
cp -v bin/intel--virtio-net--pcnet32.isarom /ipxe/$prefix/ &&
echo -e "@echo off\r\nvboxmanage setextradata global VBoxInternal/Devices/pcbios/0/Config/LanBootRom C:\\Programs\\iPXE\\$prefix\\intel--virtio-net--pcnet32.isarom\r\nvboxmanage getextradata global enumerate\r\n" >/ipxe/setvboxrom.bat &&
popd >/dev/null
@robinsmidsrod
robinsmidsrod / gist:d2bdb98110e56f1a0f55adcbd593c371
Created Oct 10, 2019
USB-over-IP for sharing webcam over local network
View gist:d2bdb98110e56f1a0f55adcbd593c371
# server - make a device available remotely
apt install linux-tools-common linux-tools-generic hwdata
modprobe usbip-core
modprobe usbip-host
usbipd -D # (runs in background)
usbip list -l
usbip bind -b <busid>
# client - attach to remote device
apt install linux-tools-common linux-tools-generic-hwe-18.04 hwdata
View gist:55963a62214da9a24bc9a646e4fba0a2
src/config/local/efi/console.h:/* Everything but DEBUG and LOG output to EFI console */
src/config/local/efi/console.h:#undef CONSOLE_EFI
src/config/local/efi/console.h://#define CONSOLE_EFI ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_DEBUG & ~CONSOLE_USAGE_LOG )
src/config/local/efi/console.h:#define CONSOLE_EFI ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG )
src/config/local/efi/console.h:/* Everything but TUI output to syslog console */
src/config/local/efi/console.h:#undef CONSOLE_SYSLOG
src/config/local/efi/console.h:#define CONSOLE_SYSLOG ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )
src/config/local/efi/console.h:#undef LOG_LEVEL
src/config/local/efi/console.h:#define LOG_LEVEL LOG_ALL /* Full syslog logging */
src/config/local/efi/general.h:#undef BANNER_TIMEOUT
@robinsmidsrod
robinsmidsrod / ubuntu_1804.ipxe
Last active May 10, 2022
iPXE script entries for booting Ubuntu 18.04 in different ways
View ubuntu_1804.ipxe
# boot-url points to an nfs URL
# sanboot-url points to an http URL
# ubuntu-version contains 18.04.3
# ubuntu-release contains bionic
:ubuntu
echo Booting Ubuntu from iSCSI for ${initiator-iqn}
set root-path ${base-iscsi}:${hostname}.boot.ubuntu
sanboot ${root-path} || goto failed
goto start