Skip to content

Instantly share code, notes, and snippets.

View nightsparc's full-sized avatar

nightsparc nightsparc

  • Munich, Germany
View GitHub Profile
@nightsparc
nightsparc / README
Created June 17, 2022 14:00
Start Virtualbox VM via systemd
See https://www.pragmaticlinux.com/2020/10/start-a-virtualbox-vm-on-boot-with-systemd/
@nightsparc
nightsparc / read_kvp.sh
Created May 25, 2022 12:33
Read key value pairs from a file
# @brief Helper to read key value pairs
# @details
# Read kv in the form <key>=<value>
# The script cleans whitespaces first and will remove any newlines
# @see https://stackoverflow.com/a/27918723/1267320
read_kvp()
{
file="$1"
while IFS="=" read -r key value; do
# clean whitespaces
@nightsparc
nightsparc / cpp_legacy_inheritance_vs_std_variant.md
Created April 29, 2022 16:32 — forked from olibre/cpp_legacy_inheritance_vs_std_variant.md
C++ legacy inheritance vs CRTP + std::variant
@nightsparc
nightsparc / gist:8ce7a3f118c3a1a47e03fed317e9d335
Created September 22, 2021 21:05 — forked from tayvano/gist:6e2d456a9897f55025e25035478a3a50
complete list of ffmpeg flags / commands
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@nightsparc
nightsparc / ZFS Snapshot Deletion
Created January 10, 2021 17:22 — forked from alexjj/ZFS Snapshot Deletion
Delete all ZFS Snapshots
zfs list -H -o name -t snapshot | xargs -n1 zfs destroy
@nightsparc
nightsparc / zfs destroy (dry run)
Created October 9, 2020 10:03 — forked from dlangille/dry run
Doing a dry run of zfs destroy, and seeing what will be destroyed and how much space will be reclaimed
$ zfs destroy -nv system/usr/jails@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/pg93@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/mysql55@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/pg94@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/empty@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/toiler@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/pg90@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/ansible@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/snapshots@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/ansible-slave@BeforeUpgradingBaseJailFrom9.1To9.3
@nightsparc
nightsparc / renew-gpgkey.md
Created May 18, 2020 19:56 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@nightsparc
nightsparc / xreadkeys.c
Created April 20, 2020 12:42 — forked from javiercantero/xreadkeys.c
A X11/Xlib program that reads the KeyPress and KeyRelease events from the window and prints them to the standard output. Used to debug the keyboard within X.
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
Display *display;
Window window;
XEvent event;
int s;
#!/bin/sh
MODEM="$(mmcli -L | grep -o '/org/freedesktop/ModemManager1/Modem/[0-9]*' | head -1)"
BEARER="$(mmcli -m $MODEM --list-bearers | grep -o '/org/freedesktop/ModemManager1/Bearer/[0-9]*' | head -1)"
mkdir -p /run/systemd/network
connect() {
MODEM="$(mmcli -L | grep -o '/org/freedesktop/ModemManager1/Modem/[0-9]*' | head -1)"
# hardcode all the things !! (this is for mobile vikings)
@nightsparc
nightsparc / virtual_serial_ports.md
Created September 28, 2019 21:45 — forked from CMCDragonkai/virtual_serial_ports.md
Virtual Serial Ports #cli #serial #network

Virtual Serial Ports

We can use socat to create 2 virtual serial ports that are connected to each other locally. This can be useful for debugging serial port applications. Or simulating serial port communication. Or running 2 legacy programs that only communicate with each other over serial ports, such as old DOS games. And of course, for education, since serial communication is probably the most simple communication protocol there is, RS232 is considered at the bottom of the OSI stack, at the "Physical Layer". See: http://electronics.stackexchange.com/questions/31171/internet-vs-serial-communication