Skip to content

Instantly share code, notes, and snippets.

View mattmorganpdx's full-sized avatar
:octocat:

Matt Morgan mattmorganpdx

:octocat:
  • Portland, OR, USA
View GitHub Profile
@mcastelino
mcastelino / iptables-cheatsheet.md
Last active May 2, 2024 21:27
iptables-cheatsheet

The netfilter hooks in the kernel and where they hook in the packet flow

The figure below calls out

  • The netfilter hooks
  • The order of table traversal
@xuwang
xuwang / get-aws-metadata
Last active August 23, 2023 18:40
Utility script to get commonly used AWS instance metadata (e.g., id, role, account, region, security credentials etc.). Just need curl.
#!/bin/bash
# Retrieve AWS instrance's commonly used metadata. Require curl.
# ./get-metadata help
# ./get-metadata id
# Input is case insensitive; format to uppper case to generate self-help page.
info=${1^^}
meta_data_url=http://169.254.169.254/latest/meta-data/
roleProfile=$(curl -s http://169.254.169.254/latest/meta-data/iam/info \
| grep -Eo 'instance-profile/([a-zA-Z.-]+)' | sed 's#instance-profile/##')
@robmiller
robmiller / .gitconfig
Created July 17, 2013 07:52
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 14, 2024 11:33
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'