Skip to content

Instantly share code, notes, and snippets.

View aaronmelton's full-sized avatar

Aaron Melton aaronmelton

View GitHub Profile
@aaronmelton
aaronmelton / run_code_checks.sh
Last active November 25, 2023 14:16
A simple shell script I use to scan my Python code for issues before committing code changes. Requires the use of pyproject.toml to work.
#!/usr/bin/env bash
echo '-->Running Flake8p' && \
flake8p --config pyproject.toml . && \
echo '-->Running Black' && \
black --config pyproject.toml --check --diff . && \
echo '-->Running isort' && \
find . -name '*.py' -not -path '*/tests/*' | xargs isort --profile black --skip tests/ && \
echo '-->Running Pylint' && \
find . -name '*.py' | xargs pylint --rcfile=pyproject.toml && \
@aaronmelton
aaronmelton / update_repos.sh
Last active November 25, 2023 14:17
A simple shell script to loop through all sub-directories of current directory and perform a 'git pull' on each. This assumes all sub-directories are git repositories.
#!/usr/bin/env bash
base_dir=$PWD
# Loop through directories
for dir in */ ; do
[ -L "${dir%/}" ] && continue
this_dir=$base_dir/$dir
cd $this_dir
echo "-->$this_dir"
@aaronmelton
aaronmelton / meetings.py
Created April 20, 2022 17:21
Zoom/Google Meet MacOS hotkeys for Adafruit MACROPAD
# SPDX-FileCopyrightText: 2021 Phillip Burgess for Adafruit Industries
#
# SPDX-License-Identifier: MIT
from adafruit_hid.keycode import Keycode # REQUIRED if using Keycode.* values
app = { # REQUIRED dict, must be named 'app'
'name' : 'Meetings', # Application name
'macros' : [ # List of button macros...
# COLOR LABEL KEY SEQUENCE
@aaronmelton
aaronmelton / archfipkgs
Last active January 15, 2022 16:55
archfi additional installation packages
# This file is a sample of a custom package list that is available at the pacstrap step.
# Each line is a package but empty line and commented line is supported.
# How to use :
# Store your own file on a web server
# Launch archfi with :
# archfi -cpl url_of_the_file
# Some packages :
base
# Server list generated by rankmirrors on 2019-06-23
##
## Arch Linux repository mirrorlist
## Generated on 2019-06-14
##
## United States
Server = http://mirrors.kernel.org/archlinux/$repo/os/$arch
Server = http://mirrors.advancedhosters.com/archlinux/$repo/os/$arch
Server = http://ftp.osuosl.org/pub/archlinux/$repo/os/$arch
Server = https://arlm.tyzoid.com/$repo/os/$arch
http://raspbian.the808.net/raspbian
http://mirror.us.leaseweb.net/raspbian/raspbian
http://raspbian.nwlinux.us/raspbian
http://mirrors.lug.mtu.edu/raspbian/raspbian
http://mirrors.cat.pdx.edu/raspbian/raspbian
http://mirror.glennmcgurrin.com/raspbian/
http://mirrors-usa.go-parts.com/raspbian/
http://reflection.oss.ou.edu/raspbian/raspbian/
http://raspbian.mirrors.lucidnetworks.net/raspbian/
http://mirror.umd.edu/raspbian/raspbian
@aaronmelton
aaronmelton / aws-set-mfa.py
Created March 12, 2018 14:45
Python script to improve two-factor authentication for AWS CLI.
#!/usr/bin/env python
#
# aws-set-mfa.py
# Copyright (C) 2017-2018 Aaron Melton <aaron(at)aaronmelton(dot)com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#!/bin/bash
#
# author = "Aaron Melton <aaron@aaronmelton.com>"
# date = "2017-08-30"
# description = "Get S3 Buckets"
# name = "get_s3_buckets.sh"
# version = "v0.0.1"
#
# REQUIREMENTS:
# 1. Install AWS Command Line Interface: https://aws.amazon.com/cli/
#!/bin/bash
#
# author = "Aaron Melton <aaron@aaronmelton.com>"
# date = "2017-08-30"
# description = "Get IAM Users"
# name = "get_iam_users.sh"
# version = "v0.0.1"
#
# REQUIREMENTS:
# 1. Install AWS Command Line Interface: https://aws.amazon.com/cli/
#!/bin/bash
#
# Lists all Elastic IPs in numerical order.
#
aws ec2 describe-addresses | grep "PublicIp" | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | uniq | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4