Skip to content

Instantly share code, notes, and snippets.

View theothermattm's full-sized avatar

Matt M. theothermattm

View GitHub Profile
@theothermattm
theothermattm / sync-using-gitignore.sh
Created October 7, 2015 20:58
Rsync files using .gitignore
# sync everything excluding things in .gitignore
# delete anything on target not in source
# include dotfiles and symlinks, also use compression
rsync -azP --delete --filter=":- .gitignore" . my-target-host:/my/target/directory
@theothermattm
theothermattm / go-to-coding-resources.md
Last active February 29, 2024 18:08
Go To Coding Resources

A list of things I find myself always referring to, or I SHOULD always refer to 😄

The source of this is a Gist and is located here

Architecture/Design

Many pressures tend to make programs more complicated (and therefore more expensive and buggy). One such pressure is technical machismo. Programmers are bright people who are (often justly) proud of their ability to handle complexity and juggle abstractions. Often they compete with their peers to see who can build the most intricate and beautiful complexities. Just as often, their ability to design outstrips their ability to implement and debug, and the result is expensive

@theothermattm
theothermattm / tmux-sessions.sh
Created January 30, 2024 15:17
Setup predefined TMUX sessions with splits
#!/bin/zsh
# https://superuser.com/a/440082
SESSIONNAME="number1"
tmux has-session -t $SESSIONNAME &> /dev/null
if [ $? != 0 ]
then
tmux new-session -s $SESSIONNAME -n script -d
tmux split-window -v -t $SESSIONNAME
@theothermattm
theothermattm / postgres_restore.sql
Created September 8, 2023 16:38
Simple bash script to restore a postgres backup
#!/bin/bash
# helper script to import a postgres export locally
if [[ -z $1 || -z $2 ]];
then
echo 'example usage: ./database-import.sh name-of-export.sh database_name'
exit 1
fi
set -o nounset
@theothermattm
theothermattm / randomized-pairing.py
Created September 7, 2023 20:41
Randomized name pairing in python
"""Console script for python_boilerplate."""
import argparse
import random
import sys
import math
def main():
"""Console script for python_boilerplate."""
parser = argparse.ArgumentParser()
@theothermattm
theothermattm / aws-client-vpn.tf
Created August 22, 2023 13:37
Terraform for creating AWS Client VPN
# source: https://spak.no/blog/article/63f519260faeadeeeb968af2
# good resource: https://spak.no/blog/article/63f519260faeadeeeb968af2
# generating PKI certs using easyrsa: https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/mutual.html
resource "aws_acm_certificate" "server_vpn_cert" {
certificate_body = file("pki/server.crt")
private_key = file("pki/server.key")
certificate_chain = file("pki/ca.crt")
@theothermattm
theothermattm / mastodon.mermaid
Created December 15, 2022 18:17
Mastodon Architecture
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@theothermattm
theothermattm / scans.sql
Created October 25, 2022 16:37
Identify Sequential Scans in PostGreSQL
SELECT relname,
seq_scan,
seq_tup_read,
idx_scan,
idx_tup_fetch,
seq_tup_read / seq_scan
FROM pg_stat_user_tables
WHERE seq_scan > 0
ORDER BY seq_tup_read DESC;
@theothermattm
theothermattm / load-envs.sh
Created June 3, 2022 15:23
Bash: Load environment vars from .env file
# Load Environment Variables from .env
if [ -f .env ]; then
export $(cat .env | grep -v '#' | sed 's/\r$//' | awk '/=/ {print $1}' )
fi
@theothermattm
theothermattm / engineering-management.md
Created December 9, 2021 20:49
Go To Engineering Management Resources