Skip to content

Instantly share code, notes, and snippets.

Cully Larson cullylarson

Block or report user

Report or block cullylarson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Site Performance Checklist

Do these things

  • Enable gzip
  • HTTP/2


  • Chrome Lighthouse Audit
cullylarson /
Last active Nov 2, 2018
Headers I should probably be using
  1. Strict-Transport-Security. Ensures that all traffic, even the first request to a non-https version of the URL, will be encrypted.
  2. Referrer-Policy. Allows you to tell the browser what to set as the referrer URL when going to an external site.
cullylarson / crontab
Created Oct 1, 2018
Database and file backup scripts
View crontab
DB_BK_CMD = /home/user/backups/site_name/
FILE_BK_CMD = /home/user/backups/site_name/
# backup / Every day @ 3 am
0 3 * * * $DB_BK_CMD do-daily database_name
0 3 * * * $FILE_BK_CMD do-daily /home/user/public_html
# rotate weekly / Every 7 days @ 3:30am
cullylarson / Pushing to a clients git
Last active Mar 19, 2018
Pushing to a client's git repo
View Pushing to a clients git

Pushing to a client's git repo

I'm a freelance programmer. Sometimes I work on projects where the client wants to occasionally see code updates in their own repo, but I don't want them to see my work schedule. If I push my dev repo, they'll see when I'm working, how many hours, etc. To solve that, I started maintaining a for-client branch that only shows weekly, squashed merges of master. Each commit is monolithic, with one commit message (it doesn't include all of the individual commit times, messages, etc. from the master branch).

View Convenient k8s, Docker, gcloud

Convenient k8s/Docker/gcloud Commands

Commands that are useful for doing stuff on Google Container Engine


$ gcloud config set project PROJECT_ID
$ gcloud config set compute/zone ZONE_NAME
$ gcloud container clusters list
cullylarson /
Last active Mar 14, 2017
Catch all emails sent on a dev box and deliver them to the 'vagrant' user's mailbox
# Many apps send email. In a dev environment, we generally don't want those emails
# to get out. However, we still want our app to think it's sending mail and we want
# to verify that emails are being sent, with the correct content and to the correct
# recipients.
# This setup solves that problem by delivering all out-bound emails to the local
# "vagrant" user's mailbox. You can then read the emails using the "mutt" command.
# Most if this is copied from:
cullylarson /
Last active Jun 1, 2016
Installing Wordpress as a dependency

Wordpress as a Dependency

How to install Wordpress as a dependency in your project, without including the WP install in version control.


In the spirit of The Twelve Factor App, we want to "explicitly declare and isolate dependencies". Wordpress doesn't really promote this idea out of the box, so we have jump through a few hoops to do it. This document describes a simple method to include Wordpress as a dependency in this way.

General Idea

cullylarson /
Last active Mar 2, 2016
Backup Database, with Rotation
if [[ -z "$1" ]]; then exit 1; fi
if [[ -z "$2" ]]; then exit 1; fi
# Backup folders
View Fix Vagrant GuestAdditions

Addresses something like this:

Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.3.10
VBoxService inside the vm claims: 5.0.10

Option 1

cullylarson / gulpfile-images.js
Last active Dec 9, 2015
Gulpfile snippet for processing images
View gulpfile-images.js
import gulp from 'gulp'
import gutil from 'gulp-util'
import plumber from 'gulp-plumber'
import os from 'os'
import batch from 'gulp-batch'
import imagemin from 'gulp-imagemin'
import pngquant from 'imagemin-pngquant'
import changed from 'gulp-changed'
const plumberh = function (err) {
You can’t perform that action at this time.