Skip to content

Instantly share code, notes, and snippets.

View pstadler's full-sized avatar

Patrick Stadler pstadler

View GitHub Profile
@pstadler
pstadler / .git-stats.sh
Last active February 9, 2023 13:45
Print Git commit statistics for a specific author.
# Print Git commit statistics for a specific author
# Usage: git-stats "Linus Torvalds"
git-stats() {
author=${1-`git config --get user.name`}
echo "Commit stats for \033[1;37m$author\033[0m:"
git log --shortstat --author $author -i 2> /dev/null \
| grep -E 'files? changed' \
| awk 'BEGIN{commits=0;inserted=0;deleted=0} \
{commits+=1; if($5!~"^insertion") { deleted+=$4 } \
#!/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')
@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 / ticker.sh
Last active June 13, 2018 14:52
Real-time stock tickers shell script (requires jq)
# This has been moved: https://github.com/pstadler/ticker.sh
@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
@pstadler
pstadler / bluetooth-defaults.sh
Created June 27, 2013 08:24
OS X Bluetooth fix
#!/bin/sh
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 48
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 40
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 48
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 53
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 48
defaults write com.apple.BluetoothAudioAgent "Stream - Flush Ring on Packet Drop (editable)" 30
defaults write com.apple.BluetoothAudioAgent "Stream - Max Outstanding Packets (editable)" 15
#!/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
{