Skip to content

Instantly share code, notes, and snippets.

Avatar

Ondřej Caletka oskar456

View GitHub Profile
@oskar456
oskar456 / data.yaml
Last active Oct 18, 2020
Ansible bug with datetime in data
View data.yaml
---
data_1:
- id: 1
key: hello
- id: 2
key: world
data_2:
- id: 1
@oskar456
oskar456 / wgwatchdog.sh
Last active Aug 22, 2020
Wireguard tunnel watchdog for OpenWRT
View wgwatchdog.sh
#!/bin/sh
check_reachability() {
local target="$1"
local retval
ping6 -c1 -W1 "$target" >/dev/null 2>&1
retval="$?"
[ "$retval" -eq 2 ] && {
ping -c1 -W1 "$target" >/dev/null 2>&1
retval="$?"
@oskar456
oskar456 / oneshot_setup.sh
Created Jul 5, 2020
Raspberry Pi Zero USB gadget mode with ethernet and serial
View oneshot_setup.sh
#!/bin/sh
# Enable gadget mode
echo "dtoverlay=dwc2,dr_mode=peripheral" >> /boot/config.txt
systemctl enable setupgadget.service
# alternatively: ln -s /etc/systemd/system/setupgadget.service /etc/systemd/system/basic.target.wants/setupgadget.service
# Enable getty on the virtual serial line
systemctl enable serial-getty@ttyGS0.service
# alternatively: ln -s /lib/systemd/system/serial-getty@.service /etc/systemd/system/getty.target.wants/serial-getty@ttyGS0.service
@oskar456
oskar456 / videocuttter.sh
Created Jul 2, 2020
Cut a video out of a long recording with fade in and out and volume normalization
View videocuttter.sh
#!/bin/bash
INFILE="input_video.mp4"
FPS=30
get_seconds() {
local seconds=0
IFS=":" read -ra T <<< "$1"
for x in "${T[@]}"; do
seconds=$(echo "$seconds * 60 + $x" | bc)
@oskar456
oskar456 / happykaktus.py
Created Feb 24, 2020
Scrap mujkaktus.cz and send news to a Telegram channel
View happykaktus.py
#!/usr/bin/env python3
import lxml.html
import urllib.request
from pathlib import Path
import requests
telegram_bot_token = "FIXME"
telegram_group_name = "@kvetinac"
@oskar456
oskar456 / wgcf.py
Last active Dec 4, 2020
Cloudflare WARP linux client (using wg-quick for actual tunnel setup)
View wgcf.py
#!/usr/bin/env python3
import subprocess
import json
import os
from pathlib import Path
import requests
from requests.compat import urljoin
@oskar456
oskar456 / walk_sk_nsec3_ds.py
Created May 8, 2019
Walk NSEC3 chain of .SK TLD in order to discover zones with secure delegation
View walk_sk_nsec3_ds.py
#!/usr/bin/env python3
from hashlib import sha1
from base64 import b32encode
import csv
from collections import OrderedDict
from itertools import zip_longest
import dns.name
from dns.rdtypes.ANY.NSEC3 import b32_normal_to_hex
@oskar456
oskar456 / grabivysilani.py
Created Mar 10, 2019
Grab TV series from iVysilani with CC and AD
View grabivysilani.py
#!/usr/bin/env python3
import subprocess
import youtube_dl
import click
from pprint import pprint
@click.command()
@oskar456
oskar456 / rpsl_to_fred.py
Created Oct 29, 2018
Convert RIPE DB domain dump into Fred-akm data file
View rpsl_to_fred.py
#!/usr/bin/env python3
import gzip
import hashlib
import sys
from collections import defaultdict
def read_db_dump(fname="ripe.db.domain.gz"):
obj = None
@oskar456
oskar456 / cert_deploy_check.py
Created Sep 19, 2018
Get hostname list from CT logs, via certspotter, check if hostnames offer valid certificate path.
View cert_deploy_check.py
#!/usr/bin/env python3
import ssl
import socket
from pathlib import Path
def get_cert_hostnames():
path = Path("~/.certspotter/certs/").expanduser()
You can’t perform that action at this time.