This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
declare SALT # One time pad | |
if [ "${1+x}" = x ]; then | |
SALT="$1" | |
else | |
# 64byte = 512bit | |
SALT="$(head -c64 /dev/random)" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host */* | |
ProxyCommand ssh %r@$(dirname %h) -W $(basename %h):%p | |
Host *_* | |
ProxyCommand ssh %r@$(cut -f1 -d_ <<< '%h') -W $(: '%h'; echo "${_##*_}"):%p | |
# SSH over Session Manager | |
Host aws-ssm-* | |
ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Not actually executable, but a reminder for myself | |
# see https://lunaticgeek.com/whatsapp-stickers/ | |
# see https://gist.github.com/patrickhammond/4ddbe49a67e5eb1b9c03#gistcomment-2903816 | |
TMP="$(mktemp -d)" | |
wget https://dl.stickershop.line.naver.jp/products/0/0/1/3962468/iphone/[email protected] --no-check-certificate | |
# unzip, folder is stickers@2x | |
cd 'stickers@2x' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my-df() { | |
df -h | | |
awk '$NF != "/" && NR > 1 {print $NF}' | | |
xargs -I{} echo --exclude {} | | |
sudo xargs du / -h \ | |
--exclude /sys \ | |
--exclude /proc | | |
tee du.out | | |
sort -h | | |
less |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat <<EOF > /etc/cni/net.d/100-crio-flannel.conf | |
{ | |
"cniVersion": "0.3.0", | |
"name": "mynet", | |
"type": "flannel" | |
} | |
EOF | |
cat <<EOF > /etc/cni/net.d/200-loopback.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
key="${1:?Env var is required as first parameter}" | |
default=${2:-} | |
value="${!key:-$default}" | |
: "${value:?Env var $key not found}" | |
printf "%s" "${value}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$env:SCOOP_GLOBAL='D:\ProgramData\scoop' | |
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine') | |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | |
iwr -useb get.scoop.sh | iex | |
scoop install 7zip git openssh aria2 curl grep sed less touch --global | |
scoop bucket add extras | |
scoop install imageglass paint.net firefox vlc vcredist2015 --global | |
scoop install googlechrome --global | |
scoop install neovim deluge discord steam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /var/www/html; | |
charset utf-8; | |
location / { | |
autoindex on; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jc_remote { | |
jmx_host=$1 | |
jmx_port=${2:-5000} | |
proxy_port=${3:-8123} | |
echo "Connecting jconsole to $jmx_host:$jmx_port via SOCKS proxy using local port $proxy_port" | |
ssh -ND $proxy_port $jmx_host & | |
jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=${proxy_port} \ | |
service:jmx:rmi:///jndi/rmi://localhost:${jmx_port}/jmxrmi | |
kill %1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Downloads from bintray and extracts into cellar | |
# Intended as support brew switch <formula> <version> | |
# in case that the given version is no longer available in cellar | |
# e.g. | |
# $0 terraform 0.11.11 should download the following | |
# https://bintray.com/homebrew/bottles/download_file?file_path=terraform-0.11.11.sierra.bottle.tar.gz | |
# Which allows brew switch terraform 0.11.11 to succeed |