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 | |
# Read a single char from /dev/tty, prompting with "$*" | |
# Note: pressing enter will return a null string. Perhaps a version terminated with X and then remove it in caller? | |
# See https://unix.stackexchange.com/a/367880/143394 for dealing with multi-byte, etc. | |
function get_keypress { | |
local REPLY IFS= | |
>/dev/tty printf '%s' "$*" | |
[[ $ZSH_VERSION ]] && read -rk1 # Use -u0 to read from STDIN | |
# See https://unix.stackexchange.com/q/383197/143394 regarding '\n' -> '' |
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
HOSTNAME=`hostname` ssh-keygen -t rsa -C "$HOSTNAME" -f "$HOME/.ssh/id_rsa" -P "" && cat ~/.ssh/id_rsa.pub |
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 +ux | |
# We set the sh +ux flags so that we error on undefined variables and error on bad commands | |
help() { | |
echo >&2 "$0 [-f] [-p] [-q] [<priv_key_file>] [<key_type>] [<key_comment>]" | |
echo >&2 | |
echo >&2 "-q / --quiet to silent all output (except -p if passed)" | |
echo >&2 "-p / --pubkey to output public key after generation" | |
echo >&2 "-f / --force to force replacing existing key" | |
echo >&2 |
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
curl -s http://mirrors.ubuntu.com/mirrors.txt | xargs -n1 -I {} sh -c 'echo `curl -r 0-102400 -s -w %{speed_download} -o /dev/null {}/ls-lR.gz` {}' | sort -g -r | head -1 | awk '{ print $2 }' |
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
# More information can be found at https://docs.gitlab.com/ee/user/infrastructure/#gitlab-managed-terraform-state | |
terraform { | |
backend "http" { | |
} | |
} |
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 | |
# Add this line into /boot/config/go where username is the user you want to setup, probably root | |
#/boot/config/ssh/setup_ssh_client.sh "username" | |
if [[ "$1" == "" ]]; then | |
echo "Invalid User!" | |
exit 1 | |
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
#!/bin/sh -u | |
# Count all files | |
# ./count | |
# Count only mp3 files | |
# ./count "*.mp3" | |
# Count only directories | |
# ./count "" "d" | |
# Count only directories ending with blah | |
# ./count "*blah" "d" |
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 | |
USER=`id -u -n` | |
GROUP=`id -g -n` | |
GENERATE_ROOT_CA_FILE="YES" | |
GENERATE_CA_DER_FILE="YES" | |
GENERATE_IM_CA_FILE="YES" | |
GENERATE_IM_DER_FILE="NO" | |
GENERATE_DH_FILE="NO" |
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 | |
DEBUG="NO" | |
LOGGER_NAME="firewall" | |
PORTS="tcp:9443" | |
WAN="$1" | |
log() { | |
if [ "$DEBUG" == "YES" ]; then | |
echo "$1" |
NewerOlder