Skip to content

Instantly share code, notes, and snippets.

@tdussa
tdussa / notify_new_login.sh
Last active July 4, 2024 10:00 — forked from arcticlinux/notify.sh
Email sysadmin on every login from a new IP address
#! /usr/bin/env bash
##
## New IP login notification script
## 2009-11-20 00:28 Samuele ~redShadow~ Santi
## 2018-06-04 12:53 ElliotNB
## 2018-10-17 17:55 ElliotNB - bug fixes for non-interactive sessions and `sudo su` commands
## 2019-08-27 16:15 mbest - update geoip lookup awk syntax, add mktemp for temporary directory,
## - add delete TMP_DIR function and trap to delete it for assurance,
## - change emails to example.com, add xargs to trim output
## 2024-06-10T08:25Z tdussa - Removed GeoIP lookup
@tdussa
tdussa / pacmixer_build_instructions.md
Last active March 17, 2023 08:46
How to convince the `pacmixer` AUR package to build

How to convince the pacmixer AUR package to build

When building the package, select cleanBuild, edit the PKGBUILD file and add this code verbatim right before the build() function:

prepare() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    patch -p1 <<'EOF'    
From 82ef1fb08c0aec56999e89c8d355d74bdbf9788a Mon Sep 17 00:00:00 2001
From: FuzzyNovaGoblin <fuzzy.nova.goblin@outlook.com>
Date: Wed, 15 Feb 2023 18:44:07 -0500
@tdussa
tdussa / get_sanity_files.sh
Last active February 19, 2023 15:52
General sanity files
#! /bin/sh
DOTFILES=".aliases .extend.bashrc .zshrc.local"
EXTENDFILES=".bashrc .zshrc .zshrc.pre"
PROFILEFILES="colorized_root_prompt.sh history_extend_size.sh history_timestamp.sh timestamped_prompt.sh timestamped_root_prompt.sh"
FILES="${DOTFILES} ${EXTENDFILES} ${PROFILEFILES}"
mkdir bin git
cd git
@tdussa
tdussa / Description.md
Last active April 20, 2024 17:21
Vaccination Status Overview script for VisiData

This VisiData script is meant to take a number of CSV files containing vaccination information and mangle the data to create a nice overview.

The input data is expected in the format seen in the sample files.

To use, just load it with vd -p Vaccination_Status_Overview.vd; to add or remove persons, the script itself needs to be edited.

Update: Refactoring so that the duration until the next refresher shot is calculated and displayed. An additional column in the data files is needed that contains the time to the next refresher in weeks; if that column is empty, that vaccination shot is assumed to be final without any more required refreshers.

@tdussa
tdussa / countdown.sh
Last active December 11, 2021 08:08
Simple shell countdown
#! /bin/sh
if [ -z "$1" ]; then
echo "Missing argument! Usage:"
echo -e "\t$0 <time string>"
exit 1
fi
TARGET=$(date -d"$1" "+%s")
TOGO=$((TARGET-$(date "+%s")))
@tdussa
tdussa / failover.md
Last active July 15, 2024 14:02
MikroTik failover routing description (living document)

MikroTik Routing Failover

This is meant to be a somewhat-easier-to-digest recap of the discussion that can be found on the MikroTik forum at this URL: https://forum.mikrotik.com/viewtopic.php?f=23&t=157048&p=836497&hilit=failover#p836497 Note that the forum discussion not only addresses failover, but also load balancing at the same time (without explicitly saying so in the beginning).

For the sake of this document, we'll make some assumptions:

@tdussa
tdussa / 00-Systemd_service_for_autossh.md
Last active January 14, 2023 19:55 — forked from ttimasdf/00-Systemd_service_for_autossh.md
Systemd service for autossh

Usage

Set up the host to connect to and port base to open:

export HOSTNAME=foo.bar
export JUMPHOST=jumphost.baz
export PORTBASE=1234

Create the autossh user:

@tdussa
tdussa / play_snapshot.py
Last active January 4, 2018 21:45
Python pyGame sound output test.
#! /usr/bin/env python
from time import sleep
import sys
import contextlib
import numpy
import pygame
channels = 2048 # number of audio channels

Keybase proof

I hereby claim:

  • I am tdussa on github.
  • I am tdussa (https://keybase.io/tdussa) on keybase.
  • I have a public key ASBS4LiW7Cj0jhMVu7obvVE6E9g6rsJEKKudNWoitEVMFgo

To claim this, I am signing this object:

#!/usr/bin/env python
import fileinput
def shipout(aerodrome, count, pdfstring):
file = open(aerodrome + '_' + str(count) + '.pdf', 'w')
file.write(pdfstring)
count = 0
aerodrome = ''