Skip to content

Instantly share code, notes, and snippets.

View Justintime50's full-sized avatar

Justin Hammond Justintime50

View GitHub Profile
@Justintime50
Justintime50 / justmakefiles.py
Last active March 4, 2024 22:46
Make Justfiles out of Makefiles
import os
def main():
makefile_path = os.path.join(os.getcwd(), "Makefile")
with open(makefile_path, "r") as makefile:
content = makefile.readlines()
new_content = ""
@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 / 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

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():
@Justintime50
Justintime50 / README.md
Last active September 9, 2023 19:10
Quickly setup multiple websites via Docker containers on a single server.

Multisite Docker Server via Traefik

Quickly setup multiple websites via Docker containers on a single server via Traefik.

Edit the email found in the traefik.toml file and run docker compose up -d to get started in production (LetsEncrypt will generate SSL certs for all your sites).

If you'd like to use Traefik during development, you'll want to comment out the lines that have SSL/HTTPS/443 comments/code in the docker-compose.yml file.

Hosts: You'll need to add each site url to your /etc/hosts file before it can be visited.

@Justintime50
Justintime50 / reset_mysql_replication.md
Created March 24, 2022 18:46
Reset your MySQL Replication

Resetting MySQL Replication

If you have a master/slave replication setup that comes across something similar to error 1236 where the binlogs get out of sync, you can run the following commands to get things back on track.

# On the master node
SHOW MASTER STATUS;

# On the slave node
STOP SLAVE;
@Justintime50
Justintime50 / insecure-mixed-content-laravel-prod.md
Created February 16, 2022 06:52
Fix the insecure mixed content error in a Laravel production instance.

Insecure or Mixed Content Production Laravel

Make sure your AppServiceProvider.php file has a boot function that looks like this to avoid the was not allowed to run insecure content error in production:

use Illuminate\Support\Facades\URL;

/**
 * Bootstrap any application services.
 *