Skip to content

Instantly share code, notes, and snippets.

View Justintime50's full-sized avatar

Justin Hammond Justintime50

View GitHub Profile
@Justintime50
Justintime50 / laravel-nested-subfolder-nginx.conf
Last active March 28, 2022 10:24
Host Laravel in a Nested Subfolder/Directory - Nginx Configuration
server {
listen 80;
index index.php index.html;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html/site;
location / {
try_files $uri $uri/ /index.php;
@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 / hash-password.md
Last active March 10, 2020 03:18
Run the following to hash a password using PHP.

Hash a Password

Run the following to hash a password using PHP. Replace mypass with the password you'd like to hash.

php -r '$hash = password_hash("mypass", PASSWORD_DEFAULT); echo $hash."\n";'
@Justintime50
Justintime50 / remove-latest-git-commit.md
Last active July 14, 2020 22:38
Reset your latest Git commit as if it never happened.

Remove Latest Git Commit

Have you ever pushed something you wish you hadn't? There is a simple solution to this problem. You can reset your latest commit and then push that to remote as if the commit never happened.

Warning: Doing so will remove that commit. This is detremental to repos that have collaborators on them. Only use these on branches only you have access to (feature branches) or on private repos. Using this method on the master/develop branch is highly discouraged.

Usage

# Roll us back to the last commit
@Justintime50
Justintime50 / working-with-ssh-keys.md
Last active January 31, 2022 23:15
Run the following commands to generate and copy an SSH key.

Working with SSH Keys

Follow this guide to generate an SSH private/public key pair, retrieve it, or send it to a client machine.

Usage

# 1) Generate an SSH Key
ssh-keygen -t rsa
@Justintime50
Justintime50 / the-homebrew-guide.md
Last active February 19, 2020 20:14
The ultimate Homebrew setup and usage guide.

The Homebrew Guide

The ultimate Homebrew setup and usage guide.

What is Homebrew?

Homebrew is the missing package manager for macOS. It allows you to install command line tools brew install ... as well as GUI desktop apps brew cask install ... all through the command line.

Install Homebrew

@Justintime50
Justintime50 / migrate-google-drive-across-domains.md
Created January 15, 2020 20:06
Guide to migrating Google Drives across domains.

Migrate Google Drive Across Domains

Guide to migrating Google Drives across domains.

Intro

Have you ever needed to migrate files or an entire drive structure from one domain to another? Many people have. Whether you rebrand or just want to share some files with another company quickly, there is a growing need to do this; however, Google does not provide a way to automatically migrate files across domains. I spent the last two years brainstorming and testing methods to do this after the company I worked for rebranded and we suddenly had a need to move 4+ terrabytes of data and thousands of folders across domains. Here is the journey we took to get there.

What didn't work

@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 / laravel-upgrade-mysql-from-v5-to-v8-password.md
Created February 7, 2020 07:46
Upgrading MySQL from v5 to v8 breaks passwords

Upgrading MySQL from v5 to v8 breaks passwords

Frameworks such as Laravel will no longer work with the native mysql passwords when upgraded. Follow these steps to correct:

Usage

docker exec -it database_container bash
mysql -u root -p
ALTER USER username IDENTIFIED WITH caching_sha2_password BY 'MYPASSWORDHERE';
@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"