Skip to content

Instantly share code, notes, and snippets.

View sodonnell's full-sized avatar

Sean O'Donnell sodonnell

View GitHub Profile
@sodonnell
sodonnell / tf-deploy.cluster.sh
Created August 28, 2024 15:47
terraform.apply.destroy.remote.state.example
#!/usr/bin/env bash
TF_STATE_BUCKET=tfstate-ops
TF_STATE_PREFIX=cluster/ops
### USE REMOTE TFSTATE via S3
terraform init \
-backend-config=bucket=${TF_STATE_BUCKET} \
-backend-config=key=${TF_STATE_PREFIX}/cluster.tfstate \
-backend-config=region=us-west-2 \
@sodonnell
sodonnell / .gitconfig
Created April 30, 2020 20:05
Managing multiple git configurations to separate work/personal identities and other configuration differences.
# file: ~/.gitconfig
# my name is the same in real life and at work.
[user]
name = "Sean O'Donnell"
# All repos/subdirectories in ~/projects/work/ shall respect my work email address/config.
[includeIf "gitdir:~/projects/work/"]
path = ~/projects/work/.gitconfig
# All repos/subdirectories in ~/projects/personal/ shall respect my personal email address/config.
@sodonnell
sodonnell / github_fork_cleanser.py
Last active March 2, 2020 09:31
Safely cleaning-up crusty ol' github forks from your repository list using python...
#!/usr/bin/env python3
#
# This script is intended to interactively help you remove stale/unwanted github forks
# from your repo list, without accidently removing any of your actual (non-forked) repos.
#
# The use case for this is simple: I forked wayyyy too many repos that I should
# have otherwise 'starred', and wanted to clean-up my repository list.
#
# Manually purging all of my forked github repos via the github.com webui would take
# far too much effort, so I decided to automate the majority of the process.
@sodonnell
sodonnell / github_fork_cleanser.sh
Last active March 2, 2020 08:51
Safely cleaning-up crusty github forks from your repository list using bash...
#!/usr/bin/env bash
#
# This script is intended to interactively help you remove stale/unwanted github forks
# from your repo list, without accidently removing any of your actual (non-forked) repos.
#
# The use case for this is simple: I forked wayyyy too many repos that I should
# have otherwise 'starred', and wanted to clean-up my repository list.
#
# Manually purging all of my forked github repos via the github.com webui would take
# far too much effort, so I decided to automate the majority of the process.
@sodonnell
sodonnell / certbot.run.sh
Last active March 31, 2020 10:46
Let's Encrypt/certbot wildcard certificate configuration for Apache HTTP Server
#!/usr/bin/env bash
###########################
# define your fully qualified domain name.
FQDN=mydomainname.com
###########################
# wildcard cert config
# Assuming you're using various vhosts/sub-domains,
# you'll most likely want to choose a wildcard certificate.
@sodonnell
sodonnell / getopts.sh
Created October 25, 2019 04:37
Basic Bash Options/Argument Boilerplate.
#!/usr/bin/env bash
function helper() { echo -e "\nOptions:\n\n\t-a <app>\n\t-v <version>\n"; exit; }
while getopts "a:v:h" opt; do
case $opt in
c) APP=$OPTARG; echo "APP: ${APP}";;
v) VER=$OPTARG; echo "VER: ${VER}";;
h|*) helper;;
esac
@sodonnell
sodonnell / getopt.py
Last active May 20, 2020 04:16
Basic argument processing in python3
#!/usr/bin/env python3
#
# This gist shows how to process (4) common argument styles in python3 using the getopt module.
#
# -a
# -a val
# --a=val
# --a
#
import sys, getopt
@sodonnell
sodonnell / tar.release.py
Created September 14, 2019 20:05
Basic tarfile processing in Python
#!/usr/bin/env python3
import tarfile
tar = tarfile.open("release.tar.gz", "w:gz")
for name in ["LICENSE", "README.md", "bin","src","examples"]:
tar.add(name)
print(tar.list("release.tar.gz"))
@sodonnell
sodonnell / test.yml
Last active December 4, 2019 21:46
Basic YAML Parsing in Python
language: python
python: 3.6
script:
- python3 feed.py -u https://phys.org/rss-feed/
- python3 feed.py -u https://hackaday.com/blog/feed/
- python3 feed.py -u https://www.wired.com/feed/rss
@sodonnell
sodonnell / macos_vscode_extensions.txt
Last active September 11, 2019 05:40
VSCode Extensions Quick-Install for MacOS
# This gist is just a bunch of notes on quickly
# setting-up VSCode and all my favorite Extensions
# on a new MacOS machine, after a fresh install.
#
# This is handy if you're using VSCode on various
# MacOS machines, like at work and your iMac or Macbook @ home.
#
# This is mainly for my own personal reference, since I'll
# surely forget this after doing this once.