Skip to content

Instantly share code, notes, and snippets.

View mschmitt's full-sized avatar
🥾
Busier than a one-legged man in an ass-kicking contest.

Martin Schmitt mschmitt

🥾
Busier than a one-legged man in an ass-kicking contest.
View GitHub Profile

Bitte ein Wrapper-Script für openconnect anlegen in dem der User-Agent für Anyconnect gesetzt wird:

echo -e '#!/bin/bash\nexec /usr/sbin/openconnect --useragent=AnyConnect "$@"' | sudo tee /usr/local/sbin/openconnect
sudo chmod +x /usr/local/sbin/openconnect

Anschließend ist die Einwahl wieder möglich:

# /etc/systemd/system/tcpdump-unattended.service
[Unit]
Description=unattended tcpdump (to /var/tmp)
After=network.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
[Service]
UMask=0022
WorkingDirectory=/var/tmp
# Ensure requirements are met
ExecCondition=jq --version
@mschmitt
mschmitt / System Design.md
Created February 17, 2023 19:44 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@mschmitt
mschmitt / apt-package-and-version
Last active August 31, 2022 08:37
List the contents of an APT repository (Packages.gz)
#!/usr/bin/perl -an
# List the contents of an APT repository
#
# Input: Unpacked contents of Packages.{xz,gz}
# Output: [package] [version]
#
# curl -s http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz |
# xz -dc | apt_package_and_version | grep '^bash '
#
#!/usr/bin/env python3
# https://mastodon.online/@unixtippse/108437781336003434
from schwifty import IBAN
from maskprocessor import maskprocessor
masked_iban='DE0210010010000682?d?d?d?d'
for an_iban in maskprocessor(masked_iban):
@mschmitt
mschmitt / apt-key-migrate
Last active April 19, 2022 12:03
Service for converting apt-key /etc/apt/trusted.gpg into distinct keyrings.
https://github.com/mschmitt/apt-key-migrate
#!/usr/bin/env bash
set -o errexit
# A native bash function to mimic the behaviour of shuf(1).
#
# - From the failed experiments department.
# - Unusably slow on long files with thousands of lines.
#
# "Arrays are sparse doubly-linked lists."
# https://git.savannah.gnu.org/cgit/bash.git/tree/array.c
@mschmitt
mschmitt / stfd.conf
Last active March 18, 2022 09:00
systemd: Howto quickly sigkill (-9) a service that blocks shutdown for minutes. (Here: ESET Antivirus, eea.service)
# /lib/systemd/system/eea.service.d/stfd.conf
[Service]
TimeoutStopSec=5
TimeoutStopFailureMode=kill
@mschmitt
mschmitt / play-wallpaper.yml
Last active December 19, 2023 14:38
Gnome wallpaper changer in native systemd user units
#!/usr/bin/env ansible-playbook
---
- hosts: localhost
become: false
gather_facts: false
connection: local
tasks:
- name: Systemd user config location
file:
path: ~/.config/systemd/user/
@mschmitt
mschmitt / ATmega32U4_StartStartStart.ino
Created January 13, 2022 07:29
Automatic BIOS password entry for computers in a remote lab
#include "HID-Project.h"
#define WAIT_SECS 900
void setup() {
BootKeyboard.begin();
delay(10 * 1000);
}
void loop() {