Skip to content

Instantly share code, notes, and snippets.

@jwatson3d
jwatson3d / docker-compose-update.sh
Created December 24, 2024 16:38 — forked from dgalli1/.sh
Simple update script for docker compose
#!/bin/bash
echo "Now Updating all Docker Containers"
export TZ=UTC # force all timestamps to be in UTC (+00:00 / Z)
printf -v start_date_epoch '%(%s)T'
printf -v start_date_iso8601 '%(%Y-%m-%dT%H:%M:%S+00:00)T' "$start_date_epoch"
# List of all folders that contain a docker compose
declare -a StringArray=("auth-stack" "bitwarden" "languagetool" "media-stack" "monitoring" "" "mosquitto" "portainer" "dnsmasq" "socks5" "nginx-proxy-manager" "filebrowser")
# Iterate the string array using for loop
#!/bin/bash
## Install development dependencies for macOS
#
# Usage: ./initial-macos-developer-setup.sh [--debug]
#
# Bash script installing the basic developer macOS command line
# development tools from Apple for this particular version of macOS,
# installs the `brew` package manager, and a few essential brew
# tap sources and settings.

Conventional Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@jwatson3d
jwatson3d / conventional-commits.md
Created September 28, 2022 02:29 — forked from Zekfad/conventional-commits.md
Conventional Commits Cheatsheet

Quick examples

  • feat: new feature
  • fix(scope): bug in scope
  • feat!: breaking change / feat(scope)!: rework API
  • chore(deps): update dependencies

Commit types

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Changes which doesn't change source code or tests e.g. changes to the build process, auxiliary tools, libraries
@jwatson3d
jwatson3d / bash_aws_jq_cheatsheet.sh
Created May 5, 2022 15:12 — forked from lukeplausin/bash_aws_jq_cheatsheet.sh
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@jwatson3d
jwatson3d / cf_create_or_update.py
Created October 29, 2021 21:58 — forked from svrist/cf_create_or_update.py
Update or create a CloudFormation stack given a name and template + params'
'Update or create a stack given a name and template + params'
from __future__ import division, print_function, unicode_literals
from datetime import datetime
import logging
import json
import sys
import boto3
import botocore
#!/usr/bin/env bash
#
# Description
# Bootstrap SSH Session to an SSM-managed instance
# by temporarily adding a public SSH key available on the local machine (ssh-agent or in ~/.ssh)
#
#
# Installation
#
# First run your eye over this script to check for malicious code
@jwatson3d
jwatson3d / referenced_mongo_json.md
Created February 3, 2020 05:09 — forked from bclinkinbeard/referenced_mongo_json.md
Populating referenced collections in MongoDB from JSON files using Node.js and Mongoose

Populating referenced collections in MongoDB from JSON files using Node.js and Mongoose

I recently began working with Node and MongoDB for a small personal project, largely just to learn the technologies. One thing that is fairly simple but that I found far from obvious and lacking in concrete examples was how to populate the part of my database that used referenced collections from the sample JSON data I was starting with. This post attempts to fill that gap using the following code snippets, which are heavily commented inline. You will notice I am using the awesome Mongoose library which makes working with MongoDB very easy.

http.createServer( app ).listen( app.get( 'port' ), function() {

    mongoose.connect( 'mongodb://localhost/{YOUR_DB_NAME}' );

	var db = mongoose.connection;
@jwatson3d
jwatson3d / gitflow-breakdown.md
Created January 5, 2020 22:03 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@jwatson3d
jwatson3d / m2
Created March 30, 2019 12:10 — forked from lhazlewood/m2
Bash script to switch maven configurations by name
#!/usr/bin/env bash
LINK_FILE="$HOME/.m2/settings.xml"
if [ ! -L "$LINK_FILE" ]; then
echo "This program expects $LINK_FILE to be a symbolic link."
exit 1
fi
if [ -z "$1" ]; then