Skip to content

Instantly share code, notes, and snippets.

View k3karthic's full-sized avatar

Karthic Kumaran k3karthic

View GitHub Profile
@k3karthic
k3karthic / get_credentials.sh
Created April 1, 2022 06:01
Fetch Temporary AWS Credentials from CloudShell
#!/usr/bin/env bash
# Based on information from https://hackingthe.cloud/aws/post_exploitation/get_iam_creds_from_console_session/
TOKEN=$( curl -s -X PUT localhost:1338/latest/api/token -H "X-aws-ec2-metadata-token-ttl-seconds: 60" )
JSON=$( curl -s localhost:1338/latest/meta-data/container/security-credentials -H "X-aws-ec2-metadata-token: $TOKEN" )
if [ $? -eq 0 ]; then
ak=$( echo $JSON | jq .AccessKeyId )
sk=$( echo $JSON | jq .SecretAccessKey )
token=$( echo $JSON | jq .Token )
@k3karthic
k3karthic / update_rclone.sh
Created November 4, 2021 16:17
Update rclone
#!/usr/bin/env sh
## https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value
tr -d 'v' # Remove v
}
@k3karthic
k3karthic / update_node.sh
Created September 7, 2021 05:29
Update NVM Node
#!/usr/bin/env bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install 'lts/*' --reinstall-packages-from=current
#!/usr/bin/env bash
## Forked from https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value
tr -d 'v' # Remove v
}
@k3karthic
k3karthic / update_kotlin.sh
Created June 8, 2021 22:46
Update Kotlinc
!/usr/bin/env bash
## Forked from https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value
tr -d 'v' # Remove v
}
@k3karthic
k3karthic / update_borg.sh
Created May 30, 2021 15:50
Update BorgBackup
#!/usr/bin/env sh
## https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value
tr -d 'v' # Remove v
}
@k3karthic
k3karthic / openpgp.md
Created May 28, 2021 11:51
Keyoxide Proof
@k3karthic
k3karthic / update_terraform.sh
Last active May 30, 2021 15:49
Update Terraform
#!/usr/bin/env bash
## Forked from https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value
tr -d 'v' # Remove v
}
@k3karthic
k3karthic / .exrc
Created May 9, 2021 00:14
Rudimentary Vi Config
set number
set autoindent
set tabstop=4
set shiftwidth=4
@k3karthic
k3karthic / .vimrc
Last active July 8, 2021 17:47
Rudimentary Vim Config
syntax on
set number
set autoindent
set tabstop=4
set shiftwidth=4
" YAML - 2 space indent, no tabs
autocmd FileType yaml setlocal tabstop=2 shiftwidth=2 expandtab
" Python - 4 space indent, no tabs