Skip to content

Instantly share code, notes, and snippets.

View nightsparc's full-sized avatar

nightsparc nightsparc

  • Munich, Germany
View GitHub Profile
@nightsparc
nightsparc / ForceUSBtoTTY.md
Created July 4, 2022 17:19 — forked from edro15/ForceUSBtoTTY.md
[How To] Force a specific USB device to a certain TTY

Scenario:

  • multiple USB devices plugged via hub to a host (Linux OS based),
  • multiple services/programs interacting with TTY running on top (e.g. GPSd)

Problem:

At boot TTY are randomly assigned to devices causing depending services/programs instabilities. They could indeed fail to start because of different TTY configurations.

Solution:

@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/[email protected]
would destroy system/usr/jails/[email protected]
would destroy system/usr/jails/[email protected]
would destroy system/usr/jails/[email protected]
would destroy system/usr/jails/[email protected]
would destroy system/usr/jails/[email protected]
would destroy system/usr/jails/[email protected]
would destroy system/usr/jails/[email protected]
would destroy system/usr/jails/[email protected]
would destroy system/usr/jails/[email protected]
@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)