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
# source this file or copy and paste to get the functions in your environment | |
docker-lint() { | |
# superlinter from github | |
# echo "count: $#" | |
[[ $1 != "-f" ]] && docker run --name superlinter -t --rm -e RUN_LOCAL=true "${@}" -v $PWD:/tmp/lint github/super-linter | |
[[ $1 == "-f" ]] && docker run --name superlinter -t --rm -e RUN_LOCAL=true "${@:3}" -v $PWD/"${2}":/tmp/lint/"${2}" github/super-linter | |
} | |
docker-jupyter() { |
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
export AWS_DEFAULT_PROFILE="" | |
# to display parameter store variables for aws latest linux | |
aws ssm get-parameters-by-path --path "/aws/service/ami-amazon-linux-latest" --region us-west-2 | |
# get the list of parameter store variables in the account | |
aws ssm describe-parameters | jq '.Parameters[].Name' | |
# remove the last path and filter higher level path | |
aws ssm describe-parameters | jq '.Parameters[].Name' | sed -e 's,\(.*\)/.*,\1",g' | sort | uniq |
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 | |
# To encrypt | |
# 1. save the unencrypted data in file called clear.txt | |
# 2. execute | |
# gpg -o ./pass.gpg -c ./clear.txt 2>/dev/null | |
# 3. remove clear.txt | |
# To decrypt | |
# 1. gpg -o clear2.txt -d ./pass.gpg 2>/dev/null | |
# 2. cat clear2.txt |
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
sudo apt -y install nodejs npm | |
node --version | |
npm --version | |
sudo npm i -g aws-cdk | |
cdk --version | |
# follow example from: https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html#hello_world_tutorial | |
mkdir simple-s3 && cd simple-s3 | |
cdk init app --language typescript |
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
import random | |
for ix in range(10): | |
print('"{}"'.format("".join([str(random.randrange(10)) for ix in range(12)]))) | |
# execute this program like: | |
# wget -q -O - "https://gist.githubusercontent.com/xbalaji/26f0e8ec95ab6259a70b1762f33da948/raw/gen_aws_account_no.py" | python - |
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
#! /usr/bin/env bash | |
function get_public_gists() | |
{ | |
for uid in ${@} | |
do | |
curl -sk -o - "https://api.github.com/users/${uid}/gists?per_page=200" | jq -r --arg dx $uid '.[].files[]| "-sk --create-dirs -o \($dx)/\(.filename) \(.raw_url)"' | xargs -t -L 1 curl | |
done | |
} | |
get_public_gists xbalaji xbalajipge |
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
# mount ubuntu cdrom - | |
sudo mount /dev/sr0 /mnt/cdrom | |
sudo mount /dev/cdrom /mnt/cdrom # older systems | |
# mount vmplayer shared directory | |
sudo mkdir -p /mnt/hgfs | |
sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other | |
# mount remote machine windows or samba share | |
sudo mkdir -p $HOME/remote |
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
# github-download-file.sh | |
github_download_file() | |
{ | |
fileurl=$(echo ${2} | sed -e 's,github.com,api.github.com/repos,;s,blob/master,contents,') | |
curl -sqk -H "Authorization: token ${1}" -H "Accept: application/vnd.github.v3.raw" -O -L "${fileurl}" | |
} | |
# call like: github_download_file $MY_TOKEN "https://github.com/xbalaji/xbenv/blob/master/gvimrc.html" |
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
walk_aws_cli() | |
{ | |
ToCombine="$1" | |
shift | |
AwsCliCmd="$@" | |
DirName="${FUNCNAME[0]}-$$" | |
mkdir $DirName | |
LoopCount=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
# oneliners-json2yml.sh | |
cat "json-file" | python -c 'import sys,yaml; yaml.dump(yaml.safe_load(sys.stdin),sys.stdout)' | |
python -c 'import sys,yaml; yaml.dump(yaml.safe_load(sys.stdin),sys.stdout)' < "json-file" |