Skip to content

Instantly share code, notes, and snippets.

View pstadler's full-sized avatar

Patrick Stadler pstadler

View GitHub Profile
@pstadler
pstadler / wireguard.sh
Last active May 4, 2022 13:10
WireGuard on Vyatta
#!/bin/bash -e
# vyatta-wireguard
#
# Usage: `./wireguard.sh [upgrade|uninstall]`.
#
# When called without arguments, the latest version will be fetched and installed.
#
# To automatically install the latest version of WireGuard after Firmware upgrades,
# this script should be placed in `/config/scripts/post-config.d/wireguard.sh`.
@pstadler
pstadler / docker-cleanup.sh
Last active December 19, 2019 08:44
Docker Cleanup
# use this:
docker system prune -a --volumes
# outdated:
docker rm $(docker ps -qa --no-trunc --filter "status=exited")
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
@pstadler
pstadler / browsers.json
Last active May 3, 2019 09:10
./selenoid.sh start|stop|restart
{
"chrome": {
"default": "65.0",
"versions": {
"65.0": {
"image": "selenoid/vnc:chrome_65.0",
"port": "4444"
}
}
},
@pstadler
pstadler / cert-expiration.sh
Last active June 6, 2018 13:23
Print SSL certificate end dates for a list of domains
#!/bin/sh
domains=(
"example.org"
"example.com:7443"
)
default_port=443
for domain in ${domains[@]}; do
#!/bin/sh
# See: https://github.com/Radarr/Radarr/wiki/Mass-Delete-via-API
HOST=http://radarr.local:7878
API_KEY= # Settings > General
ids=$(curl --silent $HOST/api/movie -X GET -H "X-Api-Key: $API_KEY" \
| jq '.[] | select(.monitored == false) | .id')
#!/bin/bash
set -e
URL="${1}"
if [ -z "${1}" ]; then
echo "usage: $(basename ${0}) <url>"
echo ""
echo "examples:"
echo " - $(basename ${0}) http://test-images.fr-1.storage.online.net/scw-distrib-ubuntu-trusty.tar"
@pstadler
pstadler / writes.dtrace
Created March 18, 2017 18:25 — forked from daviderickson/writes.dtrace
Dtrace script to print all written-to files in FreeNAS, and their average write rate every 10 seconds.
#!/usr/sbin/dtrace -s
#pragma D option quiet
#pragma D option defaultargs
#pragma D option switchrate=10hz
#pragma D option dynvarsize=4m
#pragma D option cleanrate=30hz
dtrace:::BEGIN
{
@pstadler
pstadler / promisify-es2015.js
Last active January 18, 2017 19:18
ES2015 Promisify Pattern
const fnPromisified = (arg) => new Promise((resolve, reject) =>
fnTakingCallback(arg, (err, res) => {
if (err) {
return reject(err)
}
return resolve(res)
})
)
@pstadler
pstadler / geocoder.js
Last active March 14, 2016 16:07
Simple on-demand lazy loader for the Google Maps Geocoding service
/**
* Geocoder is a simple on-demand lazy loader for the Google Maps Geocoding service
*
* Usage: `Geocoder.call(function (geocoder) {});`
*/
var Geocoder = (function (self) {
var _geocoder = null;
self.call = function (cb) {
// available
### Keybase proof
I hereby claim:
* I am pstadler on github.
* I am ps (https://keybase.io/ps) on keybase.
* I have a public key whose fingerprint is 6DDF F549 C7E4 555F FDC1 F6FA 31DB BB1F 6949 DA68
To claim this, I am signing this object: