Skip to content

Instantly share code, notes, and snippets.

sudo amazon-linux-extras install epel -y
sudo yum install stress -y
sudo stress --cpu 8 --vm-bytes $(awk '/MemAvailable/{printf "%d\n", $2 * 0.9;}' < /proc/meminfo)k --vm-keep -m 1
# –cpu spawn 8 CPU workers spinning on a square root task (sqrt(x))
# –vm-bytes use 90% of the available memory from /proc/meminfo
# –vm-keep re-dirty memory instead of freeing and reallocating.
# -m 1 spawn 1 worker spinning on malloc()/free()
pyenv install --list | grep " 3\.[789]"
pyenv versions
pyenv install 3.10.10
python3 -m venv .venv
source .venv/bin/activate
pyenv local 3.10.10
#!/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 / tf-proj-scaffold.sh
Last active August 13, 2022 18:49
A simple Bash script to scaffold a new Terraform project using HCL syntax.
#!/bin/bash
# default project name to 'test' unless specified
PROJ_NAME=${1:-test}
echo -e "Using PROJ_NAME '${PROJ_NAME}'\n"
# pause to allow inspection
echo "Press any key to proceed or Ctl+C to quit"
read -n 1 -s
@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

Keybase proof

I hereby claim:

  • I am jwatson3d on github.
  • I am jhwatson3d (https://keybase.io/jhwatson3d) on keybase.
  • I have a public key ASBfOJvNKmtwoQBMS7iprMbuAru0h1nOuPb0Ime_sM4l9Ao

To claim this, I am signing this object:

@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