Skip to content

Instantly share code, notes, and snippets.

View Justintime50's full-sized avatar

Justin Hammond Justintime50

View GitHub Profile
@Justintime50
Justintime50 / setup-laravel-project.sh
Last active May 6, 2024 17:26
Sets up a Laravel project for the first time.
#!/bin/bash
# shellcheck disable=SC2104
# The following script will setup the project for the first time for local dev
# To run the project after setup, use `docker compose up -d`
set -e
REPO_NAME="$1"
@Justintime50
Justintime50 / ssh-agent-in-crontab.md
Last active April 18, 2024 16:57
Use Your SSH Agent in a Crontab

Use Your SSH Agent in a Crontab

Getting access to SSH inside a Crontab is often a problem for many as the environment in which your cron runs is not the same as your normal shell. Simply running ssh-add will not allow you to use your SSH Agent inside your crontab. Follow the below guide to setup your crontab to use your ssh-agent:

Usage

  1. Install Keychain.
  2. Add the following to your ~/.zlogin file which will be invoked on each login. This will allow your crontab (and normal shell) to use your ssh keys and bypass needing to punch in your password each time you need SSH. This will also span across multiple sessions and shells.
@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 / resetForm.gs
Created March 1, 2024 00:11
Reset a Google Form's Sheet and Responses
function resetForm() {
deleteAllFormResponses()
resetFormResponseDestination()
}
function resetFormResponseDestination() {
var form = FormApp.getActiveForm();
var formResponsesSheetId = form.getDestinationId();
var spreadsheet = SpreadsheetApp.openById(formResponsesSheetId);
@Justintime50
Justintime50 / reset-xcode-install.md
Last active February 14, 2024 17:17
Reset Your Xcode Installation on macOS

Reset your Xcode Install on macOS

Having troubles with Xcode or their Command Line Tools? Follow this guide to reset your Xcode instance on macOS and resolve issues such as "No Xcode or CLT version detected!"

1) Check if Xcode is installed

xcode-select -print-path
@Justintime50
Justintime50 / standard-user-owned-brew.md
Last active January 12, 2024 16:41
Use the following commands to setup Hombrew as a standard user getting around needing sudo access for most packages.

Standard User Owned Brew

Use the following commands to setup Hombrew as a standard user getting around needing sudo access for most packages.

NOTE: This still requires an admin to install Homebrew initially. After the ownership change, the standard user can use Homebrew moving forward.

Setup Homebrew for a Standard User

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@Justintime50
Justintime50 / diagnose.md
Last active November 17, 2023 22:44
Diagnose Docker on MacOS

Diagnose Docker on MacOS

/Applications/Docker.app/Contents/MacOS/com.docker.diagnose check
@Justintime50
Justintime50 / random_int_of_length.py
Created November 2, 2023 16:43
Create a random integer of a specified length`
import random
n = 36
random.randint(pow(10, n - 1), pow(10, n) - 1)
@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 / lldb-debugging.md
Last active July 9, 2023 21:23
Learn how to debug a program with lldb.

Debugging with LLDB

LLDB is a debugger you can attach to a program to do things like capturing stacktraces. Here is some basic usage:

# Attach to a program (waits for future execution in another terminal)
lldb -n php -w

# continue execution
c