Skip to content

Instantly share code, notes, and snippets.

View sigio's full-sized avatar

Mark Janssen sigio

View GitHub Profile
@sigio
sigio / fixsubs.py
Created February 29, 2024 23:24
Fix hidive srt subs for mkv
#!/usr/bin/env python3
#
# Fix (hidive) srt subtitles for mkv player
# These subs seem to have multi-line captions with a 1ms start offset
# mpv then prints these in the wrong order (issue #7070)
# This script will merge subtitle lines correctly for mpv
#
# Public domain (created mostly with ChatGPT)
#
import argparse
addrs:
- ip: 10.1.2.3
mask: 255.255.255.0
entries.yaml:
entries:
{% for entry in addrs %}
- ip {{ entry.ip }}
mask {{ entry.mask }}
{% endfor %}
At the end of every role:
- import_tasks: "common_tasks/update_localfacts.yaml"
And in that file:
---
- name: update localfacts
ini_file:
path: "/etc/ansible/facts.d/custom.fact"
@sigio
sigio / nftables.conf
Created December 3, 2020 17:35
nftables firewall with fail2ban integration, beware: blocks outgoing traffic in current form
#!/usr/sbin/nft -f
# NFTables firewall with fail2ban integration
# Configure f2b with jail = nftables-multiport, and comment-out actionstart and actionstop in nftables-common.conf
flush ruleset
define TRUSTED4 = {
127.0.0.1,
127.0.0.0/8
BEGIN MESSAGE.
5dZiffMTKBD7ZOU lV3G6ADH52ARbIA xcr6dF7VUpPtm6q G1NEP1hDA2qSe0T
pt8IKbQ4Fip7YNA AmWEqQH6wIaTCKq 6Xr2MZHgg7H9kTa 2gDUlbp3nYEIl9T
yO3qMYpaSQfJFwT u1Ytk700saZN5eC wkpfPiBDS0bClvi 0Jq8KPsDcaeDkdD
Oatl56OxnqmHg3A DNKXRDQBU5eZKvC 59FIT.
END MESSAGE.
BEGIN MESSAGE.
SWCbhC2mta8GcyM 2Dre2x3QGWOyb0G FldQ8bgCPeg1KOP 7EkshgoVoTRFCy2
MojyoYl38B65R7F eqNWdzkT1zWTCKq 6Xr2MZHgg6eqIs0 qGtbQOFCCOiXvkk
kjY0XMn9QNWnuuY DNcLtWuGsJ1STrE pDcl1imK68x6J73 OA34t0wQBuqgHD4
WpWxc20pDPiYYgX bRmNssT3QRiKVF2 EfKVJ.
END MESSAGE.
@sigio
sigio / passmenu.sh
Created July 30, 2015 09:48
Passmenu / dmenu interface for pass(1)
#!/usr/bin/env bash
shopt -s nullglob globstar
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi
### Keybase proof
I hereby claim:
* I am sigio on github.
* I am sigio (https://keybase.io/sigio) on keybase.
* I have a public key whose fingerprint is 6AFC 0D83 5346 C729 6754 113F D867 4D8F C4F6 9BD2
To claim this, I am signing this object:
@sigio
sigio / gist:5818419
Last active December 18, 2015 17:28
Ansible-provisioning patch
diff --git a/library/virt_guest b/library/virt_guest
index e139726..9d9adb9 100755
--- a/library/virt_guest
+++ b/library/virt_guest
@@ -55,8 +55,7 @@ examples:
requirements: [ "libvirt" ]
notes:
- Run this on the libvirt host.
- - This returns a provisioning_status variable you can register to create groups.
- Possible values are: provisioned, unprovisioned, absent
@sigio
sigio / play-snmpd.yml
Last active January 11, 2020 22:56
Ansible play to install snmpd on centos (5/6)
# Install and configure snmpd
---
- hosts: centos5:centos6
gather_facts: yes
vars:
tasks:
- name: Install snmpd package