Skip to content

Instantly share code, notes, and snippets.

@mohanpedala
mohanpedala / bash_strict_mode.md
Last active November 17, 2024 16:44
set -e, -u, -o, -x pipefail explanation
@t2psyto
t2psyto / gist:f5453707d2658173715f49293d096fe5
Created July 14, 2017 04:15
powershell oneliner for encode/decode base64 to file
# encode from binary file to base64txt
powershell -C "& {$outpath = (Join-Path (pwd) 'out_base64.txt'); $inpath = (Join-Path (pwd) 'data.jpg'); [IO.File]::WriteAllText($outpath, ([convert]::ToBase64String(([IO.File]::ReadAllBytes($inpath)))))}"
# decode from base64txt to binary file
powershell -C "& {$outpath = (Join-Path (pwd) 'outdata2.jpg'); $inpath = (Join-Path (pwd) 'out_base64.txt'); [IO.File]::WriteAllBytes($outpath, ([convert]::FromBase64String(([IO.File]::ReadAllText($inpath)))))}"
@strebitz
strebitz / aws-sts-functions.sh
Last active February 9, 2021 15:05
Obtain AWS STS session-tokens with BASH for multiple awscli profiles or an IAM role ARN
#!/bin/bash
# Add these functions to your bash_profile or bash_rc
# Dependencies:
# - awscli - AWS command line client
# - jq - Command-line JSON processor
function cfn-validate-template() {
for template in $@
do
@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active November 18, 2024 14:16
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line