Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Recruiters should mention the role and salary range if you spam me.

Richard Metzler rmetzler

💭
Recruiters should mention the role and salary range if you spam me.
View GitHub Profile
@rmetzler
rmetzler / DefaultKeyBinding.dict
Created Oct 19, 2022 — forked from padde/DefaultKeyBinding.dict
Disable non-breaking space (Alt+Space) on OS X
View DefaultKeyBinding.dict
# in ~/Library/KeyBindings/DefaultKeyBinding.dict
{
"~ " = ("insertText:", " ");
}
View 135-cluster-api.sh
# Source: https://gist.github.com/d8113b6f149583e1cf1614d76f2a4182
#####################################################################
# How To Create, Provision, And Operate Kubernetes With Cluster API #
# https://youtu.be/8yUDUhZ6ako #
#####################################################################
# Referenced videos:
# - Should We Replace Docker Desktop With Rancher Desktop?: https://youtu.be/bYVfCp9dRTE
View 161-talos.sh
# Source: https://gist.github.com/c7cdfef142bd65cc744789d3c1e90170
###########################################
# Talos Linux: OS Designed For Kubernetes #
# https://youtu.be/iEFb2Zg4xUg #
###########################################
# Additional Info:
# - Talos Linux: https://www.talos.dev/
# - How To Create, Provision, And Operate Kubernetes With Cluster API (CAPI): https://youtu.be/8yUDUhZ6ako
View fsnotifytest.go
package main
import (
"io/ioutil"
"log"
"gopkg.in/fsnotify.v1"
)
func main() {
View backup_script.sh
#!/bin/bash
export B2_ACCOUNT_ID=<your keyID here>
export B2_ACCOUNT_KEY=<your key here>
export RESTIC_PASSWORD=<your restic repository password here>
command1="restic -r b2:mybucket-desktop-backups:alfred/ backup /home/eric/Documents/ 2>&1"
output1=$(eval "${command1}")
result1=$?
@rmetzler
rmetzler / check_dns.sh
Created Sep 14, 2021 — forked from anapsix/check_dns.sh
Watch for DNS changes and reload NGINX (or do something else)
View check_dns.sh
#!/usr/bin/env bash
#
## example running it from cron
# MAILTO=""
# SHELL=/bin/bash
# VERBOSE=1
# CMD_ON_FAILURE='/etc/init.d/nginx reload'
# * * * * * root timeout -k 2 5 /tmp/check_dns.sh upstream.server.com 2>>/var/log/check_dns.log
# * * * * * root sleep 10 && sed -e :a -e '$q;N;501,$D;ba' -i /var/log/check_dns.log
#
@rmetzler
rmetzler / .gitlab-ci.yml
Created Aug 16, 2021
autorebase in gitlab ci
View .gitlab-ci.yml
image: node:16
stages:
- build
- test
build:
stage: build
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
@rmetzler
rmetzler / flatten.gotmpl
Last active Aug 7, 2021
flatten lists in helm and go templating
View flatten.gotmpl
{{- define "flatten_list" -}}
{{- $output := list -}}
{{- range . -}}
{{- if (kindIs "slice" . ) -}}
{{- $output = (concat $output ( get (fromYaml (include "flatten_list" . ) ) "list" ) ) -}}
{{- else -}}
{{- $output = (append $output . ) -}}
{{- end -}}
{{- end -}}
{{- toYaml (dict "list" $output) -}}
@rmetzler
rmetzler / shell-execution.rb
Last active Jun 3, 2021 — forked from JosephPecoraro/shell-execution.rb
Shell Execution in Ruby
View shell-execution.rb
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@rmetzler
rmetzler / script-template.sh
Created Dec 15, 2020 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
View script-template.sh
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]