Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Hammond Justintime50

View GitHub Profile
@Justintime50
Justintime50 / laravel-nested-subfolder-nginx.conf
Last active Sep 17, 2019
Host Laravel in a Nested Subfolder/Directory - Nginx Configuration
View laravel-nested-subfolder-nginx.conf
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 Dec 22, 2020
Use the following commands to setup Hombrew as a standard user getting around needing sudo access for most packages.
View standard-user-owned-brew.md

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 Mar 10, 2020
Run the following to hash a password using PHP.
View hash-password.md

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 Jul 14, 2020
Reset your latest Git commit as if it never happened.
View remove-latest-git-commit.md

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 Apr 6, 2021
Run the following commands to generate and copy an SSH key.
View working-with-ssh-keys.md

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 Feb 19, 2020
The ultimate Homebrew setup and usage guide.
View the-homebrew-guide.md

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 Jan 15, 2020
Guide to migrating Google Drives across domains.
View migrate-google-drive-across-domains.md

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 Jan 23, 2020
Have you ever needed to test mail functions for a project and didn't want to spam the real web? Use Mailcatcher!
View setup-mailcatcher-docker.md

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 Feb 7, 2020
Upgrading MySQL from v5 to v8 breaks passwords
View laravel-upgrade-mysql-from-v5-to-v8-password.md

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 May 4, 2020
Push any changes from each repo in the current directory - great for mass updating repos at once.
View mass-git-push.sh
#!/bin/bash
# Push any changes from each repo in the current directory
echo -e "Pushing changes from each repo..."
for DIR in */ ; do
printf '\n%s\n' "$DIR"
cd "$DIR" || exit
git checkout master
git add README.md
git commit -m "Updated Travis-CI Badge Link"