Skip to content

Instantly share code, notes, and snippets.

View hazcod's full-sized avatar

Niels Hofmans hazcod

View GitHub Profile
@hazcod
hazcod / feature-policy
Created August 24, 2018 07:00
Full Feature-Policy header
Feature-Policy "accelerometer 'none'; ambient-light-sensor 'none'; animations 'none'; autoplay 'none'; camera 'none'; encrypted-media 'none'; fullscreen 'none'; geolocation 'none'; gyroscope 'none'; image-compression 'none'; legacy-image-formats 'none'; magnetometer 'none'; max-downscaling-image 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture 'none'; speaker 'none'; sync-xhr 'none'; unsized-media 'none'; usb 'none'; vertical-scroll 'none'; vr 'none'";
@hazcod
hazcod / logger.go
Last active September 22, 2021 14:27
Simple logger that listens for UNIX datagram message and prints them to stdout. We don't like syslog-ng in our postfix container!
package main
import (
"bufio"
"net"
"os"
"syscall"
)
func println(msg string) {
@hazcod
hazcod / compose-plex.yml
Last active August 1, 2018 10:53
Docker compose file for Plex. uidguid.env should contain UID=$(id -u user) and GID=$(id -g user)
version: '2'
services:
plex:
image: plexinc/pms-docker:beta
container_name: plex
ports:
- 9:9/udp
- 9:9/tcp
- 7:7/udp
- 7:7/tcp
@hazcod
hazcod / gencert.sh
Last active July 17, 2018 07:39 — forked from martijnvermaat/gencert.sh
Generate self-signed x509 certificates
#!/bin/bash
# Generate a self-signed x509 certificate or certificate signing request and
# key using OpenSSL. DNS and IP addresses can be added as subjectAltName
# entries.
#
# Usage:
# ./gencert.sh <common name (or DNS name)> <DNS names or ip addresses...> [--rsa4096] [--csr]
#
# By default, a 2048 bits RSA key is generated. Supply --rsa4096 at the end to
# generate a 4096 bits key.
@hazcod
hazcod / MediaCenter.bttpreset
Created July 11, 2018 08:31
Control Mac Mini Plex mediacenter with Apple Siri Remote.
{
"BTTPresetName" : "Mediacenter",
"BTTGeneralSettings" : {
"disableScrollingIf3" : true,
"BTTForceNormalClickPressure5F" : 200,
"disableScrollingIf2" : true,
"BTTDidRegisterForUpdateStats" : "2.530",
"BTTShowControlStrip" : true,
"BTTShowControlStripItem" : true,
"BTTForceForceClickPressure5F" : 600,
@hazcod
hazcod / rclone-lb.sh
Created July 9, 2018 09:00
Load-balance rclone requests over multiple remotes.
#!/usr/bin/env bash
rclone_from="/User/user/Downloads/"
rclone_to="/tmp/"
rclone_remotes=(remote1 remote2 remote3)
rclone_cmd="echo"
rclone_opt="--verbose"
index_file="/tmp/rclone.index"
index_curr=0
@hazcod
hazcod / tvheadend-fetch-epg.sh
Created January 18, 2018 16:56
EPG grab script for tvheadend EPG
#!/usr/bin/env sh
countries=(belgium)
for country in ${countries[@]}; do
curl --output - "http://epg.baznga.tvip.xyz/${country}.xml.gz" | gunzip -f | curl -d @- -X POST -m 1 --unix-socket /config/epggrab/xmltv.sock http://localhost 2>/dev/null
done
@hazcod
hazcod / drawio-vega-overclocking.xml
Last active December 27, 2017 11:21
Draw.io file for overclocking AMD VEGA cards.
<mxfile userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36" version="7.8.7" editor="www.draw.io" type="device"><diagram name="Page-1" id="c7558073-3199-34d8-9f00-42111426c3f3">3VvbcqM4EP0aV+08TAohwPAYe3LZqs3uVKVqZudRwbJhg5FXyHGcr1/JiIsk8CWA441fbBohoT7dR6cFHsHp8vWOolX0QGY4GdnW7HUEv41sGzjQ4l/Css0t4zHIDQsaz2SjyvAYv2FplNct1vEMZ0pDRkjC4pVqDEma4pApNkQp2ajN5iRRR12hBTYMjyFKTOvPeMai3OrbXmW/x/EiKkYGXpCfeULh84KSdSrHG9lwvvvkp5eo6EtONIvQjGxqJngzglNKCMt/LV+nOBG+LdyWX3fbcra8b4pTdswFML/gBSVrOfUfN3fXniPvjm0Lj2yimOHHFQrF8YajPoITlMSLlB+GfDBMueEFUxZzL17LE8t4NhMdTOYkZY+yM8CPM0bJc+laKFrESTIlCaG74eAt/0yn5mzkBMVA+LVmkrO7w2SJGd3yJvKsDSVmMhILx28qWANpimqIetKGZCAtyo4rZ/If0p/NvnUafet6n8a3jvVRri1Arfn2erVKxL1lZM7ExMiGu41/J0hYGXpKOKGIBIacZODEAAHPOAPIw5SkwrMpuakZK9/WfBkEFv8YXudOm3C/0u3f/MC6covDX+KwHL3B+RlZ0xAruckQXeCiVcFA4m73QlQDAVgNKJRGihPE4heV+JqwkWN8J3HKavmlxYCroZtPSF5UJyKtH6B1BPSOcjcYHe0ipZz3ccEzNoLnNkFZxE2T3/96PGdkKHGxC5OjIsMxIwNeWlz4Gp7BOwMDah3p/fQXFwCay1
@hazcod
hazcod / fix-openconnect.sh
Created November 22, 2017 16:11
Fix openconnect routes after disconnect
#!/usr/bin/env bash
PATTERN="State:/Network/Service/utun[0-9]+/DNS"
REMOVE_RECORD_CMD=""
REMOVE_RECORD_MSG="RECORDS TO REMOVE:\n"
echo "Killing openconnect.."
sudo pkill openconnect
RECORDS=`scutil <<EOF
@hazcod
hazcod / brew-cleanup
Last active April 6, 2022 03:06
List all top level brew packages
#!/usr/bin/env bash
#EDIT: just use `brew leaves`
brew deps --installed | awk -F'[: ]+' '{
packages[$1]++
for (i = 2; i <= NF; i++)
dependencies[$i]++
}
END {