modprobe wireguard
ip link add dev wg0 type wireguard
ip address add dev wg0 192.168.14.1/24
wg setconf wg0 /jffs/wg0.conf
ip link set up dev wg0
iptables -A INPUT -i wg0 -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE
#!/bin/sh | |
# Based on: https://github.com/tprelog/iocage-homeassistant/issues/64 | |
install_packages() { | |
echo "[i] Installing required packages for Home Assistant" | |
pkg install -y \ | |
autoconf \ | |
bash \ |
Implementation of the Caddy webserver new file listing template as nginx XSLT template.
Requires nginx module ngx_http_xslt_filter_module
Githook pre-commit script to prevent accidental commits using the wrong email address, for example from git global configuration.
#!/bin/ash | |
set -euo pipefail | |
readonly HOOK_NAME='efi-kernel' | |
# Defaults | |
output_dir='/boot/efi/Alpine' | |
output_name='linux-{flavor}.efi' | |
backup_old=yes | |
skip_flavors= |
## template: jinja | |
#cloud-config | |
users: | |
- name: compose | |
uid: '2000' | |
groups: docker | |
write_files: | |
- path: /home/compose/env | |
permissions: '0644' |
#!/bin/sh | |
echo "Top 5 Alpine Mirrors:" | |
for MIRROR in $(curl -s http://dl-cdn.alpinelinux.org/alpine/MIRRORS.txt) | |
do | |
MEASUREMENT=$(curl -s --connect-timeout 2 --max-time 5 -w '%{time_total}' -o /dev/null "$MIRROR") | |
TIME=$(echo "scale=0;(${MEASUREMENT} * 1000)/1" | bc) | |
echo "${TIME} ${MIRROR}" | |
done | sort -n | head -n5 | cut -d " " -f2 |
#!/bin/bash | |
touch initrd.new | |
cd early | |
find . -print0 | cpio --null --create --format=newc > ../initrd.new | |
cd ../early | |
find . -print0 | cpio --null --create --format=newc >> ../initrd.new |
#!/bin/bash | |
BUCKET_NAME="<bucket>" | |
BUCKET_PATH="<path>/" | |
PROFILE="<profile>" | |
### S3 Bulk Delete by File Size ### | |
aws s3 ls "s3://${BUCKET_NAME}/${BUCKET_PATH}" --profile "${PROFILE}" --recursive | awk -F ' ' '{print $3,$4}' | awk -F ' ' '$1 < 1 {print $2}' | xargs -IP echo '{"Key": "P"}' > delete.txt | |
# Because bulk delete limit is 1000 per api call. |
# Generate a self-signed certificate in a Java keystore as a single line command | |
# Note this generates a SAN certificate for machine.domain, localhost & 127.0.0.1 | |
keytool -genkeypair \ | |
-keyalg RSA \ | |
-keysize 2048 \ | |
-alias "machine.domain" \ | |
-keystore /discovery-service/config/keystore.jks \ | |
-keypass "key-password" \ | |
-storepass "store-password" \ | |
-validity 1095 \ |