Skip to content

Instantly share code, notes, and snippets.

View donaldguy's full-sized avatar
💊
recently relapsing on software as apparent side-effect of psychiatric medication

Donald Guy donaldguy

💊
recently relapsing on software as apparent side-effect of psychiatric medication
View GitHub Profile
@donaldguy
donaldguy / shell_vars_from_json.jq
Last active June 8, 2024 03:50
Have you ever had a json object or array and wished it was a serious of zsh/bash variables? … yeah ¬_¬ , totally, me neither 😅 https://jqplay.org/s/biOH4MLXDfe
def declare: (
.t as $type | .var as $var |
{"array": "-a", "object": "-A"}[$type] as $arg |
"declare \($arg) \($var);"
);
def shellify: (
. as $container |
@donaldguy
donaldguy / version_endpoints_compare.sh
Created May 28, 2024 00:26
some pretty stupid roundabout bash
# cross-platform bash-3.2 compatible (thanks macos)
#
# examples:
#
# $ version_endpoints_compare "3.7.1" "<=4.3.1" "=4.3.4" ">=4.3.5" ">=4.4"
# <=4.3.1
# $ version_endpoints_compare "4.3.1" "<=4.3.1" "=4.3.4" ">=4.3.5" ">=4.4"
# <=4.3.1
# $ version_endpoints_compare "4.3.2" "<=4.3.1" "=4.3.4" ">=4.3.5" ">=4.4"
# other
@donaldguy
donaldguy / 0-eth0.network
Last active April 3, 2024 19:59
kubeadm stuff
[Match]
MACAddress=62:55:1b:5f:f7:d6
[Network]
IPForward=yes
DNS=9.9.9.9
Address=10.0.0.1/12
Gateway=10.15.0.1
[Route]
@donaldguy
donaldguy / bootstrap_podman_machine.sh
Last active February 1, 2024 06:56
boot messages during `podman machine start` (qemu)
#!/bin/bash
set -o errexit -o nounset -o pipefail
bootstrap_podman() {
if ! podman system info &>/dev/null; then
echo "!!podman not initialized: doing that" >&2
if ! podman machine inspect &>/dev/null; then
podman machine init --user-mode-networking
@donaldguy
donaldguy / userscript-app_hey_com-unread_and_autoadvance.js
Last active February 1, 2024 06:55
app.hey.com: add unread counts and auto-advance to the "Imbox" - very much a work in progress
// ==UserScript==
// @name Add counts to Hey.com Imbox (and contents)
// @run-at document-end
// @match https://app.hey.com/*
// @grant GM_getValue
// @grant GM_setValue
const BASE_URL_PATTERN = 'https://app\\.hey\\.com'
let UnreadCount = -1;
@donaldguy
donaldguy / bitbar_circleci-check.30s.py
Last active December 12, 2020 22:08
bitbar CircleCI workflow plugin: updated for modern-ish API/setup, dynamic reordering by last run
#!/bin/bash
""":"
exec /usr/bin/env python3 $0
":"""
# -*- coding: utf-8 -*-
# <bitbar.title>CircleCI My Worfklows Check</bitbar.title>
# <bitbar.version>v2.0</bitbar.version>
# <bitbar.author>Donald Guy</bitbar.author>
# <bitbar.author.github>donaldguy</bitbar.author.github>
@donaldguy
donaldguy / cucumber_feature_failures_on_circle.sh
Last active December 12, 2020 22:13
CircleCI failures fetch/local rerun scripts: rspec + cucumber, but not much would be needed to adapt for other langs/libs
#!/bin/bash
#: features_failures_on_circle.sh [job number] [project name]
#:
#: Summarizes recorded CircleCI results for a (parallelized) cucumber suite, with
#: a view towards debugging failures locally on macOS.
#:
#: BE ADVISED: running will overwrite your clipboard. You should consider a
#: clipboard history. I like the one provided by Alfred PowerPack
#:
@donaldguy
donaldguy / aks-kernel-patch.sh
Created August 8, 2018 21:45
Ensure an Ubuntu AKS worker pool is patched against CVE-2018-5390 aka SegmentSmack/FragmentSmack
#!/bin/bash
# This script is intended to ensure an AKS worker pool is patched against CVE-2018-5390 aka SegmentSmack/FragmentSmack
# by ensuring kernel is patched to version 4.15.0-1019
set -eu
case ${1:-} in
-h|--help|help|/?)
echo "Usages:"
echo " To determine unpatched machines and upgrade all (after prompt):"
@donaldguy
donaldguy / minikube logs
Created September 26, 2017 16:58
raw logs for kuberentes/minikube#2005
-- Logs begin at Tue 2017-09-26 16:56:52 UTC, end at Tue 2017-09-26 16:57:35 UTC. --
Sep 26 16:57:12 minikube systemd[1]: Starting Localkube...
Sep 26 16:57:12 minikube localkube[2936]: proto: duplicate proto type registered: google.protobuf.Any
Sep 26 16:57:12 minikube localkube[2936]: proto: duplicate proto type registered: google.protobuf.Duration
Sep 26 16:57:12 minikube localkube[2936]: proto: duplicate proto type registered: google.protobuf.Timestamp
Sep 26 16:57:12 minikube localkube[2936]: listening for peers on http://localhost:2380
Sep 26 16:57:12 minikube localkube[2936]: listening for client requests on localhost:2379
Sep 26 16:57:12 minikube localkube[2936]: name = default
Sep 26 16:57:12 minikube localkube[2936]: data dir = /var/lib/localkube/etcd
Sep 26 16:57:12 minikube localkube[2936]: member dir = /var/lib/localkube/etcd/member