The intent is to define terse, standards-supported names for AWS regions.
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 | |
#>> Strip all the path from a variable in bash. | |
echo ${0##*/} |
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 | |
#>> Different ways to get the directory of the script. | |
echo ${0%/*} | |
echo $(cd ${0%/*} && pwd) | |
if [[ ${0%/*} = "." ]] | |
then echo $PWD | |
else echo ${0%/*} |
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 | |
#> Options that are sometimes useful in bash. | |
set -o nounset | |
set -o errexit | |
set -o pipefail | |
trap "exit" SIGINT SIGTERM | |
trap "echo done" EXIT |
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 python3 | |
#>> Dump all etcd key/values under <path> as json. All values are converted to json if possible. | |
# Example: | |
# $ etcdctl set /config/a 'String for a' | |
# String for a | |
# $ etcdctl set /config/b true | |
# true | |
# $ etcdctl set /config/c 100 | |
# 100 | |
# $ etcdctl set /config/d '{"d1":1,"d2":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
(defun punt-comments () | |
(interactive) | |
(goto-char (point-min)) | |
(while (re-search-forward "/\\*\\|//" nil t) | |
(let ((start (match-beginning 0))) | |
(if (string= (match-string 0) "/*") | |
(if (search-forward "*/" nil t) | |
(delete-region start (point))) | |
(delete-region start (line-end-position)))))) |
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
(global-set-key [f9 ?s] 'gostack-goto) | |
(defun gostack-file () | |
(save-excursion | |
(save-restriction | |
(end-of-line) | |
(let ((eol (point))) | |
(beginning-of-line) | |
(narrow-to-region (point) eol) |