Skip to content

Instantly share code, notes, and snippets.

View nightsparc's full-sized avatar

nightsparc nightsparc

  • Munich, Germany
View GitHub Profile
@nightsparc
nightsparc / google_search_maps_addon.js
Created February 24, 2024 15:01 — forked from Daan-Grashoff/google_search_maps_addon.js
Bring back the google maps button when searching on google
// ==UserScript==
// @name Google maps addon
// @namespace http://tampermonkey.net/
// @version 2024-02-13
// @description Bring google maps button back
// @author You
// @match https://www.google.com/*
// @icon https://www.google.com/
// @grant none
// ==/UserScript==
@nightsparc
nightsparc / serial_duplicator.py
Created February 1, 2024 08:01 — forked from Salamandar/serial_duplicator.py
Duplicate TTY serial port using socat in Python to log everything that goes through it.
#!/usr/bin/env python3
import sys
import os
import signal
import threading
import subprocess
from typing import Optional
from pathlib import Path
@nightsparc
nightsparc / socat_examples
Created February 1, 2024 08:01 — forked from mario21ic/socat_examples
Examples for using socat (and filan)
// Examples for using socat (and filan)
//"$" means normal user, "#" requires privileges, "//" starts a comment
///////////////////////////////////////////////////////////////////////////////
// similar to netcat
// connect to 10.1.1.1 on port 80 and relay to and from stdio
@nightsparc
nightsparc / nmbrnetkvm.md
Created December 17, 2023 10:06 — forked from plembo/nmbrnetkvm.md
NetworkManager bridged network for KVM guests

Setting up a bridged network for KVM guests

This will work with either networkd or NetworkManager as a resolver. In fact, this is the only way to do bridged KVM (libvirtd) networking with NetworkManager.

If you're using NetworkManager (on a desktop or laptop, for example) on your KVM host, follow these instructions to set up a bridge interface.

Once you have the host bridge set up, proceed as follows:

  1. Create a bridge network device inside KVM. Edit and save the below text as file host-bridge.xml:
@nightsparc
nightsparc / addbr0ubunmcli.md
Created December 17, 2023 10:04 — forked from plembo/addbr0ubunmcli.md
Add br0 to Ubuntu desktop using nmcli

Add a bridge interface to Ubuntu desktop using nmcli

Had to do this for some advanced networking with KVM, and couldn't figure out how to do it using the Nework Manager gui. Did find an article later that showed how to do it with nmtui, but it's so much easier to record what you did when using the cli.

Note: I now set net.ifnames=0 in grub for all my machines, to ensure my device names are "predictable" (so the first ethernet device will be "eth0" and not "ens1", "eno1 or anything else).

To see what everything looks like before starting:

@nightsparc
nightsparc / gpg-import-and-export-instructions.md
Created August 15, 2023 17:51 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@nightsparc
nightsparc / xorg.conf
Created June 23, 2023 09:49 — forked from wamberg/xorg.conf
Dual Monitor (one portrait, one landscape) xorg.conf
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 270.29 (buildd@roseapple) Fri Feb 25 14:43:24 UTC 2011
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 1680 0
Screen 1 "Screen1" LeftOf "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "1"
@nightsparc
nightsparc / FixCtrlBackspace.ahk
Last active December 28, 2022 13:04 — forked from AdrienVR/FixCtrlBackspace.ahk
AutoHotkey script to fix Ctrl+Backspace (delete previous word) in File Explorer and Desktop (AHK V1)
; source: https://gist.github.com/AdrienVR/4136db1bfb0d3d3490b0d1e23e56daf9
; context: http://superuser.com/a/636973/124606
#NoEnv
; Reloard script if not used
; https://www.autohotkey.com/docs/v2/lib/_SingleInstance.htm
#SingleInstance force
; https://www.autohotkey.com/docs/v2/lib/SendMode.htm
SendMode Input
@nightsparc
nightsparc / remote-unlock-zfs-with-dropbear.md
Last active February 25, 2023 09:51
Remote unlocking of native-encrypted ZFS-on-root on Debian/Ubuntu using Dropbear SSH

Introduction

The following describes a way to remote unlock a server with natively-encrypted ZFS-on-root. It uses Dropbear SSH to start a SSH server in the initramfs listing on a specified port.

All server commands are executed as root on Debian 10. For Ubuntu, sudo su or adding sudo to all command should be sufficient.

Requirements

The following requires the recent ZoL 2.x, which adds support to Unlock encrypted root filesystem via SSH, making it merely a no-brainer to unlock the data set (besides setting up Dropbear).

@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: