Skip to content

Instantly share code, notes, and snippets.

View Justintime50's full-sized avatar

Justin Hammond Justintime50

View GitHub Profile
@Justintime50
Justintime50 / event_handler_example.py
Last active June 14, 2023 22:03
An example of how to setup event handlers in Python
import requests
class Event:
"""An Event that gets triggered when an HTTP event occurs."""
def __init__(self):
self._event_handlers = []
def __iadd__(self, handler):
@Justintime50
Justintime50 / setup-mailcatcher-docker.md
Created January 23, 2020 04:41
Have you ever needed to test mail functions for a project and didn't want to spam the real web? Use Mailcatcher!

Setup Mailcatcher on Docker

Have you ever needed to test mail functions for a project and didn't want to spam the real web? Use Mailcatcher!

Usage

docker run -d -p 1080:1080 -p 1025:1025 --name=mailcatcher -itd --network=mailcatcher sj26/mailcatcher
@Justintime50
Justintime50 / remote-git-repo-default-branch-name.md
Last active January 4, 2023 23:51
Grab the remote repo's default branch name

Grab a Remote Repo's Default Branch Name

git remote show REMOTE_REPO_URL | grep 'HEAD branch' | cut -d' ' -f5
@Justintime50
Justintime50 / working-with-branches.md
Last active October 3, 2022 16:58
Learn about various operations of a Git branch

Working with Git Branches

This document contains various operations you can use when working with Git branches such as moving commits, updating branch names, creating branches from a tag, etc.

Move a Commit to Another Branch

New Branch

git branch newbranch
@Justintime50
Justintime50 / setup-dnsmasq.md
Last active July 6, 2022 21:34
Guide on setting up dnsmasq for localhost development

Setup DNSMasq for Localhost Development

Local development requires you to edit your /etc/hosts file constantly to add custom local domains. Maintaining this file across machines and projects can become taxing. Let's use a service like dnsmasq to dynamically set any .localhost domain to point to 127.0.0.1

# Install dnsmasq
brew install dnsmasq
sudo brew services start dnsmasq

# Configure
@Justintime50
Justintime50 / mass-git-push.sh
Last active June 30, 2022 16:32
Push any changes from each repo in the current directory - great for mass updating repos at once.
#!/bin/bash
# Copy a set of files to each repo in a dir, create a branch, and push to origin
# Requires GitHub CLI: `brew install gh` and must be logged in with `gh auth login`
# GitHub CLI Docs: https://cli.github.com/manual/
MAIN_BRANCH="master"
BRANCH_NAME="ignore_cassette_diffs"
COMMIT_MESSAGE="chore: ignore cassette diffs via gitattributes"
PR_TITLE="$COMMIT_MESSAGE"

ZPL Commands

Command Format Description
^A ^Afo,h,w,d:f.x Use Scalable/Bitmapped Font
^A@ ^A@o,h,w,d:f.x Use Font Name to Call Font
^B0 ^B0a,b,c,d,e,f,g Aztec Bar Code Parameters
^B1 ^B1o,e,h,f,g Code 11 Bar Code
^B2 ^B2o,h,f,g,e,j Interleaved 2 of 5 Bar Code
^B3 ^B3o,e,h,f,g Code 39 Bar Code
@Justintime50
Justintime50 / imovie-on-nas.md
Created June 20, 2022 17:56
Use iMovie on a NAS.

Use iMovie on a NAS

iMovie only works when run on a filesystem supported by Apple (APFS or macOS Extended). Your NAS most likely isn't running this file system for drives. Follow this guide to be able to run your iMovie library off a NAS.

Instructions

  1. Open Disk Utility
  2. File -> New Image -> Blank Image
  3. Use the following settings:
@Justintime50
Justintime50 / setting-up-programming-languages.md
Last active May 23, 2022 15:43
This guide will help you setup various programming languages on macOS.

Setting Up Programming Languages

Setting up programming languages can take some time and differs per language. Here are some guides on each one to get you up and running in no time. NOTE: This guide is intended for macOS development.

M1 Macs & Homebrew: You will need to add the following to your path: /opt/homebrew/bin and /opt/homebrew/sbin

CSharp

Run brew install --cask dotnet-sdk to get started. This will install the SDK along with Mono. See the C# page for more information: https://formulae.brew.sh/cask/dotnet-sdk

@Justintime50
Justintime50 / invert_dictionary.py
Created April 21, 2022 21:18
Invert a dictionaries keys and values
import json
import os
# Invert a dictionary's keys and values
# USAGE: FILE=myfile.json venv/bin/python invert_dictionary.py
FILE = os.getenv('FILE')
def main():