Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Hammond Justintime50

View GitHub Profile
@Justintime50
Justintime50 / working-with-branches.md
Last active Jul 1, 2022
Learn about various operations of a Git branch
View working-with-branches.md

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
View zpl-quick-reference.md

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
View imovie-on-nas.md

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
This guide will help you setup various programming languages on macOS.
View setting-up-programming-languages.md

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 Apr 21, 2022
Invert a dictionaries keys and values
View invert_dictionary.py
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
Created Apr 14, 2022
Quickly setup multiple websites via Docker containers on a single server.
View README.md

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 Mar 24, 2022
Reset your MySQL Replication
View reset_mysql_replication.md

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 Feb 16, 2022
Fix the insecure mixed content error in a Laravel production instance.
View insecure-mixed-content-laravel-prod.md

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.
 *
@Justintime50
Justintime50 / package-non-python-assets.md
Created Sep 23, 2021
Learn how to package non-Python assets into your Python Package
View package-non-python-assets.md

Package non-Python Assets into your Python Package

There are times where you may need to include non-Python assets in your Python package for distribution. This may include data files or JSON assets from a submodule for example that your Python package needs to reference. By default, Python will not include these assets in the bdist/sdist. You can either include an empty __init__.py file in that submodule (even if the project isn't Python) and rely on the magic of packages=setuptools.find_packages() in setup.py or you can explicitly include those non-Python assets by using the following steps.

  1. In setup.py, include an array of locations to include. These are glob matching patterns. An example of this looks like the following:
package_data={
    'top_level_package': [
 'path/to/assets/one/*.json',
@Justintime50
Justintime50 / aws_ip_range_parser.py
Created Sep 1, 2021
Gets the complete list of AWS IP ranges and parses the results
View aws_ip_range_parser.py
import requests
# Gets the complete list of AWS IP ranges and parses the results
# Usage: venv/bin/python aws_ip_range_parser.py
AWS_IP_URL = 'https://ip-ranges.amazonaws.com/ip-ranges.json'
REGIONS_TO_FILTER = [
'us-east-2',
'us-west-2',
]