Skip to content

Instantly share code, notes, and snippets.

View bradthurber's full-sized avatar

Brad Thurber bradthurber

  • Carmel Solutions
  • Indiana
View GitHub Profile
@bradthurber
bradthurber / markdown-pdf.css
Created October 18, 2023 21:27
vscode markdown-pdf CSS mod to make inline comments use github style instead of ugly yellow. Update %USERPROFILE%/.vscode/externsions/yzne.markdown-pdf-1.5.0/styles/markdown-pdf.css
/*
* Markdown PDF CSS
*/
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif, "Meiryo";
padding: 0 12px;
}
pre {
@bradthurber
bradthurber / markdown-pdf.css
Created July 27, 2023 16:49
snippet of vscode markdown-to-PDF extension to convert from ugly gold to nice github style
/* for inline code */
:not(pre):not(.hljs)>code {
color: black;
background-color: #afb8c133;
padding: .2em .4em;
margin: 0;
border-radius: 6px;
font-size: 85%;
}

How to make a single commit branch from a big feature branch

## create a new branch from the latest main branch
$ git checkout -b latest_MCode

## Now merge your feature branch into latest_Mcode branch
$ git merge --squash feature-branch

## before pushing - make sure the commit message is correct
@bradthurber
bradthurber / install-update-aws-sam.sh
Created May 12, 2023 15:19
bash script to install/update the AWS SAM CLI on Ubuntu
#!/bin/bash -e
# https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html#cliv2-linux-install
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html
echo "make sure OS is up-to-date"
sudo apt update && sudo apt upgrade -y
sudo apt install unzip -y
echo "* Switching to new temporary tmp folder..."
@bradthurber
bradthurber / install-update-aws-cli-v2.sh
Created May 12, 2023 15:18
bash script to install or update the AWS CLI on Ubuntu
#!/bin/bash -e
# https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html#cliv2-linux-install
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html
echo "make sure OS is up-to-date"
sudo apt update && sudo apt upgrade -y
sudo apt install unzip -y
echo "* Switching to new temporary tmp folder..."
@bradthurber
bradthurber / gpg-import-and-export-instructions.md
Created January 14, 2019 20:48 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@bradthurber
bradthurber / s3etag.sh
Created March 23, 2018 20:36 — forked from emersonf/s3etag.sh
A Bash script to compute ETag values for S3 multipart uploads on OS X.
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 file partSizeInMb";
exit 0;
fi
file=$1
if [ ! -f "$file" ]; then
@bradthurber
bradthurber / lambdaAMIBackups.py
Created January 9, 2018 21:05 — forked from bkozora/lambdaAMIBackups.py
AWS Lambda AMI Backups
# Automated AMI Backups
#
# @author Robert Kozora <bobby@kozora.me>
#
# This script will search for all instances having a tag with "Backup" or "backup"
# on it. As soon as we have the instances list, we loop through each instance
# and create an AMI of it. Also, it will look for a "Retention" tag key which
# will be used as a retention policy number in days. If there is no tag with
# that name, it will use a 7 days default value for each AMI.
#
@bradthurber
bradthurber / gist:cd9c3bd647711940e2ed
Last active August 29, 2015 14:21
Reference jinja var in jinja for salt mine string
##
## Using the mine data, we are trying to find the IP address of all servers
## with roles: mod-cluster-node in the same environment as this minion.
##
# EXAMPLE A: THIS WORKS - but we are hard-coding the minion's environemt (development). We don't want to hard-code
{%- for server, addrs in salt['mine.get']('G@roles:mod-cluster-node and G@environment:development', 'network.ip_addrs', expr_form='compound').items() %}
# ... do stuff...
{%- endfor %}
@bradthurber
bradthurber / jboss-as-domain.sh
Created May 22, 2015 14:12
jboss-startup-scripts
#!/bin/sh
#
# JBoss domain control script
#
# chkconfig: - 80 20
# description: JBoss AS Domain
# processname: domain
# pidfile: /var/run/jboss-as/jboss-as-domain.pid
# config: /etc/jboss-as/jboss-as.conf