This file contains hidden or 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
_realpath() { | |
local return=0 | |
local result='' | |
local arg=${1:-} | |
[[ $arg ]] || die "ERROR: _realpath: missing operand" | |
local pwd0=$(pwd) | |
local base tmp | |
cd "$arg"; | |
base=$(basename "$(pwd)") |
This file contains hidden or 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 | |
REAL_GIT=${REAL_GIT-/usr/bin/git} | |
TICKET_PREFIX=TICKET-PREFIX- # Like JIRA-, REDMINE-, CLEARQUEST- or something. | |
TICKET_REGEX="${TICKET_PREFIX}[0-9][0-9]*" | |
main() { | |
local command=$1 | |
shift | |
if [[ commit == $command ]] || [[ ticket == $command ]] ; then | |
get_ticket |
This file contains hidden or 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 | |
main() { | |
local switch_to=$1 | |
local what_repo=$(basename "$(pwd)") | |
local topd=$(pwd) | |
local top=true | |
[[ -d .git ]] || top=false | |
while [[ $top == false ]] ; do | |
cd .. || die "ERROR: Failed to find a top git repo root (a parent folder with a .git subfolder, stopped at $tmp)." |
This file contains hidden or 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 | |
touch_p() { mkdir -p "$(dirname $1)"; touch "$1"; } |
This file contains hidden or 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 | |
# Encrypts and decrypts short strings with the user's default SSH key pair. | |
# USAGE: | |
# encrypt file: cat some_short_file.txt | encrypt_str | |
# encrypt variable: echo "$some_variable" | encrypt_str | |
# decrypt file: cat something.encrypted | decrypt_str | |
# decrypt variable: echo "$string" | decrypt_str | |
# |
This file contains hidden or 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 | |
IFF_ARGS='-dbB' | |
dir_diff() { | |
local a=$1 | |
local b=$2 | |
exit=0 | |
rm -rf a b diff &> /dev/null || true | |
local thisn=a |
This file contains hidden or 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 | |
fix=$1 ; | |
DEBUG=2 ; | |
limitLines=20 ; | |
maxDepth=15 ; | |
tmp=old ; | |
thisD=$(dirname "$0") ; |
This file contains hidden or 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 | |
# With ability to mount a CIFS/Samba share the way one might | |
# with a cheap external hard drive attached to an expensive WiFi router. | |
main() { | |
set -x | |
# update-alternatives --list editor | |
sudo update-alternatives --set editor /usr/bin/vim.tiny | |
sudo apt-get -y update |
This file contains hidden or 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 | |
sslFingerprint=$(echo \ | |
| openssl s_client -showcerts -connect $some_jenkins_server_fqdn_name:443 2> /dev/null \ | |
| openssl x509 -noout -sha256 -fingerprint | awk -F'=' '{print $NF}') | |
# Note that you can strip the colons for a shorter fingerprint: | |
echo $sslFingerprint | tr -d ':' | |
# But you do not need to strip them. |
This file contains hidden or 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 | |
main() { | |
execute echo hi ; | |
execute true ; | |
# execute false || echo "$? from execute false" ; | |
# { execute false; } || echo "$? from execute false" ; | |
( execute false; ) || echo "$? from execute false" ; | |
say_do echo howdy ; | |
say_do true ; |
NewerOlder