Skip to content

Instantly share code, notes, and snippets.

View rmetzler's full-sized 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
def smiley
# this is also possible
# %w[ :-) X-) ;-) :-( B-D B-D ].sample
[":-)", "X-)", ";-)", ":-(", "B-D"].sample
end
(0..100).each {|x| puts "#{ ' '*x }#{smiley}"}
@rmetzler
rmetzler / nix.sh
Created February 12, 2024 19:59 — forked from vfarcic/nix.sh
# Source: https://gist.github.com/vfarcic/8ebbf4943c5c012c8c98e1967fa7f33b
#####################################################################
# Say Goodbye to Containers - Ephemeral Environments with Nix Shell #
#####################################################################
# Additional Info:
# - Nix: https://nixos.org
# - Dagger: The Missing Ingredient for Your Disastrous CI/CD Pipeline: https://youtu.be/oosQ3z_9UEM
@rmetzler
rmetzler / fuzzy-azure-account-switch
Created April 24, 2019 11:12
use fzf to switch between azure accounts
function faz() {
az account set --subscription $(az account list -o table | fzf | cut -c '62-98')
az account show
}
<#
Create Unix VM's.
PREREQUISITES:
- A VM that has been installed with an OS that supports cloud-init
- cloud-init is installed on the vm
How it works:
- Asks for a bunch of parameters
- Creates a disk from parent vhdx for speed
<!DOCTYPE html>
<html>
<head>
<title>Copy-Paste from Website to Terminal</title>
</head>
<style>
.codeblock {
background-color: lightyellow;
border: 1px dotted blue;
margin-left: 50px;
@rmetzler
rmetzler / assume-role.sh
Created October 23, 2023 08:42 — forked from mbarneyjr/assume-role.sh
aws sts assume-role one-liner
export $(aws sts assume-role --role-arn arn:aws:iam::$TARGET_ACCOUNT_ID:role/ci-access --role-session-name ci --output text --query "[['AWS_ACCESS_KEY_ID',Credentials.AccessKeyId],['AWS_SECRET_ACCESS_KEY',Credentials.SecretAccessKey],['AWS_SESSION_TOKEN',Credentials.SessionToken]][*].join(\`=\`,@)")
@rmetzler
rmetzler / gist:2947828
Created June 18, 2012 10:43
find all non UTF-8 encoded files
find . -type f | xargs -I {} bash -c "iconv -f utf-8 -t utf-16 {} &>/dev/null || echo {}" > utf8_fail
@rmetzler
rmetzler / flatten.gotmpl
Last active June 20, 2023 03:30
flatten lists in helm and go templating
{{- 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 / install-chrome.ps1
Created June 1, 2023 08:35 — forked from timothywarner/install-chrome.ps1
Install Chrome browser with a PowerShell one-liner
$Path = $env:TEMP; $Installer = 'chrome_installer.exe'; Invoke-WebRequest -Uri 'http://dl.google.com/chrome/install/375.126/chrome_installer.exe' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args '/silent /install' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer
# Thank you, nicolaigj!
@rmetzler
rmetzler / DefaultKeyBinding.dict
Created October 19, 2022 14:04 — forked from padde/DefaultKeyBinding.dict
Disable non-breaking space (Alt+Space) on OS X
# in ~/Library/KeyBindings/DefaultKeyBinding.dict
{
"~ " = ("insertText:", " ");
}