Skip to content

Instantly share code, notes, and snippets.

View johnbeynon's full-sized avatar

John Beynon johnbeynon

View GitHub Profile
hugo version # Output the OLD version
if [[ ! -f $XDG_CACHE_HOME/hugo ]]; then
echo "...Downloading HUGO"
mkdir -p ~/tmp
wget -P ~/tmp https://github.com/gohugoio/hugo/releases/download/v0.99.1/hugo_0.99.1_Linux-32bit.tar.gz
cd ~/tmp
echo "...Extracting HUGO"
tar -xzvf hugo_0.99.1_Linux-32bit.tar.gz
services:
- type: web
context: ./static
name: passthrough
branch: master
env: static
buildCommand: echo "hi"
staticPublishPath: .
buildTriggers:
includedPaths:
@johnbeynon
johnbeynon / add_domain.rb
Last active June 13, 2023 15:37
Add custom domain to Render preview environment app
#!/usr/bin/ruby
# Script to add a custom domain to a preview environment web service. Use it via the buildCommand
#
# Resultant custom domain added to the service will be:
# <servicename>-pr-<number>.prs.mydomain.com
#
# Setup:
#
# Add a wildcard DNS entry to your domain, something like *.prs.mydomain.com pointing to 216.57.24.1

After deploying an Heroku Button app the apps git repo is not updated. Attempts to clone it will result in a message "You have cloned an empty repo". You can easily link an Heroku Button app to a repo so you can make changes to the source and deploy it again.

  • Deploy the app with Heroku Button and remember the app name that you created.
  • Go back to where the Heroku Button was displayed and copy it's underlying URL eg https://heroku.com/deploy?template=https://github.com/jamesward/heroku-connect-phone-change
  • Now extract the https://github.com part so you're left with https://github.com/jamesward/heroku-connect-phone-change
  • Clone the repo with heroku git:clone -a <YOUR-APP-NAME> - it will be reported as empty
  • cd into the project and add a git remote pointing at the original source, git remote add origin https://github.com/jamesward/heroku-connect-phone-change
  • pull from the remote origin git pull origin master
  • ls the directory, and there's the code.
@johnbeynon
johnbeynon / imagemagick.md
Created October 30, 2015 11:03
Imagemagick buildpack

Before:

$ heroku run bash
~ $ convert --version
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
▶ heroku run bin/setup
Running `bin/setup` attached to terminal... up, run.6178
Adding DATABASE_URL to .env
Adding RACK_ENV to .env
Adding TZ to .env
Adding RAISE_ERRORS to .env
Adding FORCE_SSL to .env
Adding TIMEOUT to .env
Adding PRETTY_JSON to .env
Using i18n 0.7.0
@johnbeynon
johnbeynon / gist:6a59fec601ad02c8a6d4
Created November 14, 2014 16:41
Rails redefine structure:dump
# In Rakefile
Rake::Task["db:structure:dump"].clear if Rails.env.production?
@johnbeynon
johnbeynon / backup_all_dbs.sh
Last active August 29, 2015 13:57
Backup commands for MySQL and Postgres - backs up all databases!
# backup_all_dbs.sh
# Expects ~/backups to exist
# Expects pg to be running on 127.0.0.1
# Expects mysql to be running on 127.0.0.1
# Expects mysql root user to have no password
# Expects zip to be available.
echo "Backing up local DBs"
pg_dumpall -h 127.0.0.1 > ~/backups/postgres.sql
mysqldump -u root --all-databases > ~/backups/mysql.sql
-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP JS 0.0.1
Comment: https://keybase.io/crypto
wcBMA43lKB+8iCMcAQf+NAAyZWOxBIDmyH75KK9/m4h0Q1DETD/p2hEL0ZKJ8g2F
kJq4/UyQ1kEVA91tIgbMAmV5BWiY41HsldISiunwGeMXQBcPzINWEOScL9/pRB/T
V0ShCZr2sQCHDVX/asHsk2/dY3ur+YZ772yCCb6NFWvU5hyeTdGvvKfqixWLtKaW
aQQTMvdyhpZqbC5YDuM8HDk40gg+s+YtTo12KqPdCSyNdGwEJ+LbOKbOI37/semv
CR/RQCtHknf/0clBCxNQTJUy9tH6dI10YDtfguHOAZbMeZ2OB6OUPuwvqDARTTXk
kc3Or0AiOOtTXAtzw7Zmh2JWSHGbGgClC2MVnNEuDNLBFAH7uadqZFlMf43UCRcm

Keybase proof

I hereby claim:

  • I am johnbeynon on github.
  • I am johnbeynon (https://keybase.io/johnbeynon) on keybase.
  • I have a public key whose fingerprint is A5B4 D9BA 969A AE41 438B D180 4056 40E9 95A2 C093

To claim this, I am signing this object: