Skip to content

Instantly share code, notes, and snippets.

@nickistre
nickistre / copy-images.sh
Last active September 15, 2023 17:41
Files to help with air-gapped Kubernetes environments
#!/usr/bin/env bash
# Registry name to transfer to
REGISTRY="${1:?Registry name is required as argument}"
# Check that this actually looks like a registry host and not an image URL.
if [[ $REGISTRY == *"/"* ]]; then
echo "\"${REGISTRY}\" looks like an image location, not the registry host. Exiting."
exit 1
fi
@nickistre
nickistre / ddclient.conf
Last active January 18, 2023 01:28
ddclient.conf setup for freedns.afraid.org
# I was having problems with the standard setup, this is to remind me what was needed:
#debug=yes # Uncomment to debug
#verbose=yes # Uncomment for verbose output
daemon=600 # Checking every 10 minutes instead of 5
syslog=yes
pid=/var/run/ddclient/ddclient.pid
ssl=yes

openpgp4fpr:65242c0e477f13ccb2b0120e722a501d95610dd5

@nickistre
nickistre / start_ssh_agent.sh
Created December 14, 2022 19:30
Using ssh-agent in a cli environment
# Put this in .bash_profile to have ssh-agent running in a cli environment
# From https://stackoverflow.com/a/18915067
# and https://web.archive.org/web/20210506080335/https://mah.everybody.org/docs/ssh
SSH_ENV="$HOME/.ssh/agent-environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
@nickistre
nickistre / .zshrc-from-garuda
Created December 4, 2022 07:49
ZSH Setup Examples
## Path section
# Set $PATH if ~/.local/bin exist
if [ -d "$HOME/.local/bin" ]; then
export PATH=$HOME/.local/bin:$PATH
fi
eval "$(starship init zsh)"
function set_win_title(){
echo -ne "\033]0; $USER@$HOST:${PWD/$HOME/~} \007"
}
@nickistre
nickistre / Getting path to script
Last active November 28, 2022 22:14
Helpfull BASH script stuff
# From: https://stackoverflow.com/a/246128
# Basic script path information
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
K1_BIN_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$K1_BIN_DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
@nickistre
nickistre / test-awscli-config.sh
Created November 23, 2022 21:59
Helpful things
# To awscli is configured and connects to an actual account
aws sts get-caller-identity
@nickistre
nickistre / string_case_util.go
Created February 3, 2022 17:08
Converting between camelCase and snake_case in Golang
package utils
import (
"regexp"
"strings"
)
// SnakeCaseToCamelCase
// This will convert snake case to camelCased
// @return camelCased string, number of parts
@nickistre
nickistre / watch-fs
Created September 9, 2021 18:29
Script to watch for when a disk drops out
#!/bin/bash
# Infinite loop
for (( ; ; ))
do
for arg in "${@}"
do
if [ ! -e "${arg}" ]
then
echo "'${arg}' is gone"
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 5 5600X 6-Core Processor
CPU Family: 0x19