Skip to content

Instantly share code, notes, and snippets.

View mhutter's full-sized avatar
🤘

Manuel Hutter mhutter

🤘
View GitHub Profile
@mhutter
mhutter / retry.sh
Created June 26, 2018 15:12
Bash: Retry command N times
#!/bin/bash
function retry {
local n=0
local max="$1"; shift
local cmd="$*"
until $cmd; do
if [ "$((++n))" -lt "$max" ]; then
echo "Retrying in $((n*2)) seconds..."
@mhutter
mhutter / ansible.cfg
Last active November 26, 2019 19:24
Ansible project template
[defaults]
forks = 20
inventory = ./hosts.yml
# Allow displaying and gathering custom stats
show_custom_stats = True
callback_whitelist = profile_tasks
# Speed up fact gathering
# Don't gather facts on each role (can be overwritten in playbooks)
scriptencoding utf-8
""" Basics
let g:mapleader=' '
""" Tabs #tabs
" - Two spaces wide
set tabstop=2
set softtabstop=2
" - Expand them all
class Fyre
def initialize(klass)
@klass = klass
end
def call(method, *args)
method = method.to_sym
if method == :help
help
else
#cloud-config
users:
- name: mh
groups: ['sshlogin']
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILRFlkyW0MXxYjA1HUzJ18nlTLtXOHKV0rVJD/46v7Sb tera2023
# This will not work if there's no internet connectivity
#ssh_import_id:
@mhutter
mhutter / ruby_patterns.md
Last active November 21, 2016 09:27
Ruby quick patterns

Ruby Quick Patterns

Quick arrays

%w{foo bar baz}
#=> ["foo", "bar", "baz"]

Make sure we have an array

@mhutter
mhutter / install-ca-cert.sh
Last active August 29, 2015 14:03
Install own CA-Certificate in Linux
# Step 0: Convert the Certificate to PEM format
$ openssl x509 -inform der -in certificate.cer -out certificate.pem
# Step 0.5: Make sure there is only 1 Certificate in the File
$ grep 'BEGIN.* CERTIFICATE' certificate.pem | wc -l # should output `1`
# Step 1: Verify it's the correct Certificate
$ openssl x509 -noout -fingerprint -in certificate.pem
# Step 2: Copy the File to /etc/ssl/certs
@mhutter
mhutter / lenses.md
Last active August 29, 2015 14:02
Lens Sweetspots

Aperture Sweetspots in regard to Sharpness.

Lens foc. len Sweetspot
Canon EF 50mm f/1.4 USM 50mm 5.6
Canon EF 24-105mm f/4L IS USM 24mm 4.0
Canon EF 24-105mm f/4L IS USM 105mm 8.0
Canon EF 70-200mm f/2.8L IS II USM 70mm 4.0
Canon EF 70-200mm f/2.8L IS II USM 200mm 2.8/8.0