Skip to content

Instantly share code, notes, and snippets.

View mrajo's full-sized avatar

Anthony Castle mrajo

  • San Diego, CA, USA
View GitHub Profile
@mrajo
mrajo / Caddy+PHP+MySQL+WordPress.md
Last active May 30, 2023 15:01
Caddy+PHP+MySQL+WordPress

Caddy+PHP+MySQL+WordPress

Install packages

sudo apt install mysql-server php7.2-common php7.2-cli php7.2-fpm php7.2-bcmath php7.2-curl php7.2-gd php7.2-mbstring php7.2-mysql

PHP setup

  1. Create document root folders
    • mkdir -p /var/www/example.com/htdocs
  • mkdir -p /var/www/example.com/logs
@mrajo
mrajo / basic_website_with_caddy_on_ubuntu_digital_ocean.md
Last active April 29, 2019 21:51
Caddy setup on Ubuntu/Digital Ocean

Create droplet

  1. Use DO dashboard
  2. Add SSH key for login
    • This does not create a root password, and login must be through SSH only
  3. Create DO firewall
    • Add HTTP and HTTPS to inbound rules
  4. After created, login as root through SSH
    • $ ssh root@<ip_of_droplet>
  5. Create new user and add to sudo and www-data group group
  • $ adduser
@mrajo
mrajo / gist:00cd4556834d4c810b01f812ccc6f01a
Last active August 26, 2018 06:19
keychain installer
cd ~/src
wget -O keychain-2.8.5.tar.gz https://github.com/funtoo/keychain/archive/2.8.5.tar.gz
tar xzvf keychain-2.8.5.tar.gz
cd keychain-2.8.5/
make clean && make
cp keychain ~/.local/bin/
echo "export PATH="$HOME/.local/bin:$PATH" >> ~/.bashrc
. ~/.bashrc
# fix user with git config
# method 1: rebase with exec on all commits
git rebase -r --root --exec "git commit --amend --no-edit --reset-author"
# method 2: filter-branch
git filter-branch --env-filter '
CORRECT_NAME="<correct name here>"
CORRECT_EMAIL="<correct email here>"
export GIT_COMMITTER_NAME="$CORRECT_NAME"
# change ext to source file extension
# change -t argument to expand to number of spaces
find . -name '*.ext' ! -type d -exec bash -c 'unexpand --first-only -t 4 "$0" >/tmp/ex && mv /tmp/ex "$0"' {} \;
# change ext to source file extension
# change -t argument to expand to number of spaces
find . -name '*.ext' ! -type d -exec bash -c 'expand -i -t 2 "$0" >/tmp/ex && mv /tmp/ex "$0"' {} \;
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
@mrajo
mrajo / keybase.md
Last active November 20, 2016 18:58

Keybase proof

I hereby claim:

  • I am mrajo on github.
  • I am acastle (https://keybase.io/acastle) on keybase.
  • I have a public key ASDF13lsq-tAyhpTzXYWcmLYAWfv63A_iIbKDiE0_-6r3wo

To claim this, I am signing this object: