Skip to content

Instantly share code, notes, and snippets.

View triangletodd's full-sized avatar

Todd Edwards triangletodd

View GitHub Profile
@triangletodd
triangletodd / update_discord.sh
Created December 5, 2020 04:29
Update Discord on Debian
#!/usr/bin/env bash
set -e
trap "{ rm -f $tmpfile; }" EXIT
tmpfile="$(mktemp)"
main() {
curl -Lo "$tmpfile" 'https://discord.com/api/download?platform=linux'
sudo dpkg -i "$tmpfile"
@triangletodd
triangletodd / README.md
Last active June 25, 2025 05:39
k3s in LXC on Proxmox

On the host

Ensure these modules are loaded

cat /proc/sys/net/bridge/bridge-nf-call-iptables

Disable swap

sysctl vm.swappiness=0
swapoff -a
@triangletodd
triangletodd / cloudflare.inc.sh
Created November 5, 2019 06:35
Bash functions for interacting with the Cloudflare v4 API
#!/usr/bin/env bash
export CF_CURL_OPTS=()
export CF_V4_API='https://api.cloudflare.com/client/v4'
_cf_exit() {
# if being called directly, don't exit
if [ ${#FUNCNAME[@]} -eq 0 ]; then
return 1
fi
exit 1
@triangletodd
triangletodd / feature_flipper.rb
Last active December 12, 2020 22:41
Ruby Feature Flipper
#!/usr/bin/env ruby
require 'redis'
require 'flipper'
require 'flipper/adapters/redis'
class Feature
ENABLED = Flipper::Actor.new(true)
DISABLED = Flipper::Actor.new(false)
def initialize
@triangletodd
triangletodd / gcr_cleanup.sh
Last active May 24, 2019 09:40
GCR Image Cleanup - list or delete all but the 5 newest tags for all images in a GCR repository
#!/usr/bin/env bash
# Exit if no arguments are passed
if [ $# -lt 1 ]; then
cat << HELP
gcr_cleanup -- list or delete all but the 5 newest tags for all images
EXAMPLE:
- list all but the 5 newest tags for all images
@triangletodd
triangletodd / k8s_secret.code-snippets.json
Last active May 24, 2019 09:42
VSCode Kubernetes Snippets
{
"k8s_secret": {
"prefix": "k8s_secret",
"scope": "plaintext,yaml",
"body": [
"apiVersion: v1",
"kind: Secret",
"metadata:",
" name: ${1:secret_name}",
"type: Opaque",
@triangletodd
triangletodd / Chassis.stl
Last active December 12, 2020 22:44
Wifi Pineapple Quad
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@triangletodd
triangletodd / sparse_clone.sh
Created February 28, 2019 22:06
Sparse git clone (clone a single subdirectory from a repo)
mkdir config
cd config
git init
git remote add -f origin https://github.com/cockroachdb/cockroach
git config core.sparseCheckout true
echo "cloud/kubernetes" >> .git/info/sparse-checkout
git pull origin master
@triangletodd
triangletodd / create_pdbs.sh
Last active February 27, 2019 23:48
Create a PDB for all deployments in the default Kubernetes namespace with a minAvailable of 50%
#!/usr/bin/env bash
set -e
template() {
cat <<EOF
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{NAME}}
namespace: default
@triangletodd
triangletodd / working_verify_slack.go
Created February 7, 2019 23:29
Golang Verify Slack
package middlewares
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"github.com/gin-gonic/gin"
)