Skip to content

Instantly share code, notes, and snippets.

View dantheman213's full-sized avatar
๐Ÿš€

Dan dantheman213

๐Ÿš€
View GitHub Profile
@dantheman213
dantheman213 / aws-ssm
Last active January 10, 2020 23:25
Find list of SSM params with a keyword or phrase
# Get all SSM keys and values as JSON object per SSM key:
aws ssm describe-parameters --profile ${TARGET_ENV} | jq '{NextToken,Parameters:[ .Parameters | map(.Name) [] ] }' | jq -r '.Parameters | join("\n")' | while read line; do aws ssm get-parameter --name $line --profile ${TARGET_ENV} | jq -c '{Name: .Parameter.Name, Value: .Parameter.Value}'; done
# Get Keys by themselves per line raw
aws ssm describe-parameters | jq '{NextToken,Parameters:[ .Parameters | map(.Name) [] ] }' | jq -r '.Parameters | join("\n")'
# Do something in a bash for loop
aws ssm describe-parameters --profile preprod | jq '{NextToken,Parameters:[ .Parameters | map(.Name) [] ] }' | jq -r '.Parameters | join("\n")' | while read line; do aws ssm get-parameter --profile preprod --name $line; done
@dantheman213
dantheman213 / aws-ssm-find-param
Last active August 19, 2019 17:56
Quickly find AWS SSM params by partial search, use custom AWS profiles, get an interactive result to query, and get a AWS URL to view and edit target
#!/usr/bin/env node
//
// Quickly find AWS SSM params by partial search, use custom AWS profiles, get an interactive
// result to query, and get a AWS URL to view and edit target.
//
// Requires AWS CLI, NodeJS v10+ and Python 2/3
//
// Before running for first time do:
// npm install inquirer
@dantheman213
dantheman213 / reset.sh
Last active April 15, 2020 01:37
Reset home permissions
sudo chmod -R 777 ~/.ssh # start perms from scratch
chmod -v 700 ~/
chmod -v 700 ~/.ssh
find ~/.ssh -type f -name "*.pub" | xargs chmod -v 644
find ~/.ssh -type f -name "*.pem" | xargs chmod -v 400
find ~/.ssh -type f ! -name "*.*" | xargs chmod -v 400
find ~/.ssh -type d | xargs chmod -v 700
chmod -v 644 ~/.ssh/authorized_keys
chmod -v 600 ~/.ssh/config
@dantheman213
dantheman213 / uninstall_docker.md
Created April 25, 2019 23:29
Uninstall Docker

To completely uninstall Docker:

Step 1

dpkg -l | grep -i docker To identify what installed package you have:

Step 2

sudo apt-get purge -y docker-engine docker docker.io docker-ce

@dantheman213
dantheman213 / generate-ssh-key.sh
Created April 18, 2019 18:40 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa
@dantheman213
dantheman213 / Dockerfile
Last active September 28, 2018 17:55
Go Dockerfile Example
# Dockerfile for basic Go application example
#
# Assumptions
# - There is a project dir
# - Inside the project dir, there is the path src/main
# - The project's *.go files are located in src/main
# - The project's name is "myapp"
FROM golang:1.11.0-stretch AS packager
@dantheman213
dantheman213 / docker_cheat_sheet_readme.MD
Last active April 27, 2020 00:43
Docker Cheat Sheet

Docker Cheat Sheet

Copy file from container to host

docker cp <containerId>:/file/path/within/container /host/path/target

Stop all running containers

docker stop $(docker ps -aq)
@dantheman213
dantheman213 / main.sh
Created July 17, 2018 03:56
Read every line of an environment variable file for Docker in as a standard bash script.
while read fileLine; do echo "Exporting ${fileLine}...\n"; export ${fileLine}; done < secrets.env
// EX: secrets.env
// MY_VAR=123
// MY_API_KEY=ASDFKJDSFJL234545
@dantheman213
dantheman213 / README.md
Last active May 12, 2018 17:41
Youtube Download Cheatsheet

Youtube Download Cheatsheet

Download and install binary here: https://github.com/rg3/youtube-dl

Get Best Video and Audio

youtube-dl.exe -f "best[ext=mp4]" --no-check-certificate <VIDEO URL>

Get worst video no audio

youtube-dl.exe -f "worstvideo[ext=mp4]" --no-check-certificate

@dantheman213
dantheman213 / install_great_gnu_screen_config.sh
Last active May 10, 2020 05:05
Download a great Gnu Screen config straight to your current user's environment
#
# Download a great Gnu Screen config straight to your current user's environment
#
# Just paste that in wherever env you're at and run `screen` and you'll have a good configuration with a status bar,
# tabs, no warning screen, beeps/bells/alerts, and more.
#
# Screen Config (.screenrc) located here:
# Gist: https://gist.github.com/dantheman213/8df6fabb1bc6fc192c9e
# Raw: https://gist.githubusercontent.com/dantheman213/8df6fabb1bc6fc192c9e/raw/bfd65a3695974b94223849c516b5b58828932613/Great%2520GNU%2520Screen%2520config