Skip to content

Instantly share code, notes, and snippets.

@cheeseplus
cheeseplus / workaround.md
Last active July 16, 2019 21:45
Chef Infra License Errors in Test-kitchen and Packer

If you're getting errors like:

       +---------------------------------------------+
            Chef License Acceptance
       
       Before you can continue, 2 product licenses
       must be accepted. View the license at
       https://www.chef.io/end-user-license-agreement/
       
@smammy
smammy / macOS-IPv6-Tunnel-DNS-HOWTO.md
Created December 13, 2018 19:14
How to convince macOS to do IPv6 DNS lookups when your only IPv6 address is via a VPN or tunnel of some sort

This was a huge hassle to figure out, so I wrote up a little guide in hopes that others would find it helpful:

How to convince macOS to do IPv6 DNS lookups when your only IPv6 address is via a VPN or tunnel of some sort

The Problem

macOS's domain name resolver will only return IPv6 addresses (from AAAA records) when it thinks that you have a valid routable IPv6 address. For physical interfaces like Ethernet or Wi-Fi it's enough to set or be assigned an IPv6 address, but for tunnels (such as those using utun interfaces) there are some extra annoying steps that need to be taken to convince the system that yes, you indeed have an IPv6 address, and yes, you'd like to get IPv6 addresses back for DNS lookups.

I use wg-quick to establish a WireGuard tunnel between my laptop and a Linode virtual server. WireGuard uses a utun user-space tunnel device to make the connection. Here's how that device gets configured:

@pamolloy
pamolloy / README.md
Last active October 16, 2024 20:40
Ubiquiti USG configuration for Wireguard

Download the latest ugw3 package from https://github.com/Lochnair/vyatta-wireguard/releases and install it on your USG using dpkg -i wireguard-ugw3-<version>.deb.

cd /config/auth
umask 077
mkdir wireguard
cd wireguard
wg genkey > wg_private.key
wg pubkey < wg_private.key > wg_public.key
@tamas-molnar
tamas-molnar / kubectl-shortcuts.sh
Last active February 22, 2025 20:23
aliases and shortcuts for kubectl
alias kc='kubectl'
alias kclf='kubectl logs --tail=200 -f'
alias kcgs='kubectl get service -o wide'
alias kcgd='kubectl get deployment -o wide'
alias kcgp='kubectl get pod -o wide'
alias kcgn='kubectl get node -o wide'
alias kcdp='kubectl describe pod'
alias kcds='kubectl describe service'
alias kcdd='kubectl describe deployment'
alias kcdf='kubectl delete -f'
@gilyes
gilyes / Backup, restore postgres in docker container
Last active January 18, 2025 00:57
Backup/restore postgres in docker container
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@meineerde
meineerde / haproxy.cnf
Created May 19, 2016 15:06
HAPROXY: Use a fetched integer value as checked value in an ACL
# First extract the rate into a variable called req.src_http_req_rate
http-request content set-var req.src_http_req_rate %[src_http_req_rate]
# Then use this variable in the acl by subtracting the current rate from the
# value returned from the map. If the result is less than 0, the request rate
# is larger than the allowed value
acl abuse src,map_ip_int(/etc/haproxy/ips.map),sub(req.src_http_req_rate) -m int lt 0
#!/bin/bash
# Derive our topic from our some/topic@hostname
topic_at_host=$1; shift
host=$(echo ${topic_at_host} | sed -e 's/^.*@//')
topic=$(echo ${topic_at_host} | sed -e 's/@.*$//')
# Generate a random topic for reply
reply_topic="$(dd if=/dev/random bs=2048 count=1 2>/dev/null | shasum | awk '{print $1}')"
# append a 'respond':'mqtt/_random_reply_topic' to our user-provided message
http://saturn:32400/web/index.html#!/server/1d289f50f716872fa0043edb52d4854027289ef1/details/%2Flibrary%2Fmetadata%2F21905
https://plex.tv/pms/system/library/sections
7a9403ed2084a69936ee1c6c6e6b905642420c2e
http://[PMS_IP_Address]:32400/library/sections?X-Plex-Token=YourTokenGoesHere
http://saturn.hq.thebikeshed.io:32400/sections?X-Plex-Token=${X_PLEX_TOKEN}
curl -X GET http://saturn.hq.thebikeshed.io:32400/library/sections?X-Plex-Token=${X_PLEX_TOKEN}
curl -X GET 'http://saturn.hq.thebikeshed.io:32400/library/sections/4/refresh?X-Plex-Token=${X_PLEX_TOKEN}&force=1'
@toddq
toddq / README.md
Last active May 15, 2021 13:37 — forked from mjamieson/README.md