Skip to content

Instantly share code, notes, and snippets.

{% for record in rpz_bad_domains %}
{{ record }}
{{ record.encode('punycode') }}
{{ record.encode('punycode').decode('punycode') }}
{{ record.encode('idna') }}
{{ record.encode('idna').decode('idna') }}
{% endfor %}
@teadur
teadur / rev.sh
Created April 17, 2024 14:22
rev.sh
#!/bin/bash
input=$1
function reverseip () {
local IFS
IFS=.
set -- $1
echo $4.$3.$2.$1
}
reverseip $input
@teadur
teadur / devcontainer.json
Last active February 6, 2024 12:48
devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
{
"name": "Arenduskeskus",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
"features": {
"ghcr.io/devcontainers-contrib/features/ansible:2": {},
"ghcr.io/wxw-matt/devcontainer-features/command_runner:0": {},
"ghcr.io/joshuanianji/devcontainer-features/gcloud-cli-persistence:1": {},
@teadur
teadur / debianpreseedosx.sh
Created August 24, 2022 12:04 — forked from Data-ptr/debianpreseedosx.sh
Modifying a Debian ISO (amd64) with a preseed file, but on OSX
#
# Figured out using:
# https://wiki.debian.org/DebianInstaller/Preseed/EditIso
# https://www.thegeekstuff.com/2009/07/how-to-view-modify-and-recreate-initrd-img/
# https://gist.github.com/Aktau/5510437
# https://www.cyberciti.biz/faq/how-to-extract-a-deb-file-without-opening-it-on-debian-or-ubuntu-linux/
#
## Go home
cd
@teadur
teadur / Ansible Disk Check
Created September 15, 2020 08:01 — forked from alexanderadam/Ansible Disk Check
Show disk space and warn about disk full in Ansible
* Shows a message while asserting like:
ok: [host] => {
"msg": "disk usage 4.2B of total 20.0GB (21.0%) (should exceed limit 90.0%)"
}
* Note this only looks at first mount point on current node
* Fails if disk is near-full
* Last step pushes to a push-based monitoring service, which will alert us if it doesn't get there after some time
* Need to setup a variable `disk_limit`, which is the max acceptable usage ratio, e.g. set it to 0.8 if you want to keep disks within 80% of max size
@teadur
teadur / ddnsserver.py
Created November 1, 2019 17:50 — forked from pklaus/ddnsserver.py
Simple DNS server (UDP and TCP) in Python using dnslib.py
#!/usr/bin/env python
# coding=utf-8
import argparse
import datetime
import sys
import time
import threading
import traceback
import socketserver
@teadur
teadur / em_syslog2.rb
Created October 30, 2019 06:38 — forked from lorenzoplanas/em_syslog2.rb
An EventMachine Syslog Protocol
# this is a configurable version of an EventMachine syslogger
# It was build to replace https://github.com/melito/em-syslog
#
# You can instantiate many of them (no global variables) as
# well as configure the facility. It also quacks like a ruby
# logger so it can be interchanged with a ruby logger.
#
# Example:
#
# # 11 is the facility code for an FTP daemon
@teadur
teadur / awp_5.3.0.16.04.130_amd64.deb.postinst
Created December 6, 2018 18:24
awp_5.3.0.16.04.130_amd64.deb.postinst
#!/bin/bash
NSSDB=$HOME/.pki/nssdb
MODUTIL="/usr/bin/modutil -force -dbdir sql:$NSSDB"
CERTUTIL="/usr/bin/certutil -d sql:$NSSDB"
LIBFILE=/usr/local/AWP/lib/libOcsPKCS11Wrapper.so
if [ -n "`which apt-get`" ];
then
sudo apt-get -y install libnss3-tools 2>/dev/null
#
# Based upon: https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
#
# localisation
d-i debian-installer/locale string en_US.utf8
d-i console-keymaps-at/keymap select us
# networking
d-i netcfg/choose_interface select auto
@teadur
teadur / git-fatfiles.pl
Created September 28, 2017 18:14
git-fatfiles.pl
#!/usr/bin/perl
use warnings;
use strict;
use IPC::Open2;
use v5.14;
# Try to get the "format_bytes" function:
my $canFormat = eval {
require Number::Bytes::Human;
Number::Bytes::Human->import('format_bytes');