Skip to content

Instantly share code, notes, and snippets.

View tickbox-smc's full-sized avatar

Chris Falck tickbox-smc

View GitHub Profile
@tickbox-smc
tickbox-smc / .bash_profile
Created September 23, 2022 14:31 — forked from atr0s/.bash_profile
AWS Session Manager SSH/SCP helper
# Snippet of code to be put on ~/.bash_profile to help SSH into instances via Session Manager while specifying AWS profiles
# It can be used by saving ~/.ssm_bash_profile and adding the following line to ~/.bash_profile
# source ~/.ssm_bash_profile
function aws-ssm-instance-list {
if [ "$#" -lt 1 ]; then
echo "Usage: aws-ssm-instance-list <profile name>"
else
output=$(aws ssm describe-instance-information --profile $1 --query "InstanceInformationList[*].{Name:ComputerName,Id:InstanceId,IPAddress:IPAddress}" --output text)
echo "$output"
@tickbox-smc
tickbox-smc / aws-credentials.sh
Created April 26, 2022 16:04 — forked from inkblot/aws-credentials.sh
Authenticate to vault using IAM instance profile credentials in bash using curl, openssl, and jq
#!/bin/bash
_SELF="${0##*/}"
_HERE="$(dirname $(realpath ${0}))"
function aws_instance_profile_arn() {
curl -s http://169.254.169.254/2019-10-01/meta-data/iam/info | jq -r .InstanceProfileArn
}
function aws_instance_profile_name() {
@tickbox-smc
tickbox-smc / py_flask_ex.py
Created March 24, 2022 14:16 — forked from postcert/py_flask_ex.py
simple python flask healthcheck toggler
from flask import Flask, jsonify
app = Flask(__name__)
health_status = True
@app.route('/toggle')
def toggle():
global health_status
health_status = not health_status
@tickbox-smc
tickbox-smc / README.md
Created July 27, 2021 08:33 — forked from avoidik/README.md
AWS query examples

Top 10 Examples of AWS CLI Query

List Volumes showing attachment using Dictionary Notation

$ aws ec2 describe-volumes \
  --query 'Volumes[*].{ID:VolumeId,InstanceId:Attachments[0].InstanceId,AZ:AvailabilityZone,Size:Size}'
[
    {
        "InstanceId": "i-a071c394",
2019/07/09 15:31:12 [INFO] Terraform version: 0.12.3
2019/07/09 15:31:12 [INFO] Go runtime version: go1.12.4
2019/07/09 15:31:12 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan"}
2019/07/09 15:31:12 [DEBUG] Attempting to open CLI config file: /Users/cfalck/.terraformrc
2019/07/09 15:31:12 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/07/09 15:31:12 [INFO] CLI command args: []string{"plan"}
2019/07/09 15:31:12 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/07/09 15:31:12 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/07/09 15:31:12 [DEBUG] New state was assigned lineage "a9bfd18e-bfa6-856d-64b4-3f65a428def2"
2019/07/09 15:31:12 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
@tickbox-smc
tickbox-smc / iterm2-solarized.md
Created March 29, 2019 10:06 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

# Add to site.pp to create a default bin path for all exec statements
# Default Exec binary paths
Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }