Skip to content

Instantly share code, notes, and snippets.

View ScottHelme's full-sized avatar

Scott Helme ScottHelme

View GitHub Profile
@ScottHelme
ScottHelme / key.asc
Created September 22, 2018 03:23
PGP Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (MingW32)
mQINBFR2+BUBEACfI9VnBNX9vbbwTPr2WfWXfR7+oaox149q5/mCi6ycV963hIVG
OLuRWR4euu9xpVxGbbI7wFfiR9WnZg/05Kd08yaWZ8sswzY3jiW2RlEmyHF/a5B5
l2yx9W9jVCoSQ2mmSqt0z+DQH3jctSwE8r0hTMt0Q5Fgc9NW6SRFE/YhVEqcJMDi
FSd5xgHJ0hDoSffFHBGqr9AkRIQxkd39gJDKaUj5FHE2tQrcK3Hki/uqmCozgASh
e7mgsj3m9tH4KmdO969KBzNEHxMXby5qUGXDzK6fz6kTIAw/3tsoRpGLZEdPC5d+
ykDyivCmWsYxFqLniv+++I4W/HRX7OHyjgWYoL21uM5TnCMsFTYJVBl/MBfsGoGh
S4LrCirPdXMgv89NTBsnbR4WuHYPHn7R4hI1tnCixO8IOcyk+7bAOv4htAp3Y/L8
@ScottHelme
ScottHelme / test.js
Last active June 22, 2018 12:54
test
alert(1234);
@ScottHelme
ScottHelme / test-js
Created June 22, 2018 12:22
test.js
alert(123);
@ScottHelme
ScottHelme / disqus.html
Created October 20, 2016 10:03
An iframe to load Disqus comments in an AMP document.
<div id="disqus_thread"></div>
<script>
window.addEventListener('message', receiveMessage, false);
function receiveMessage(event)
{
if (event.data) {
var msg;
try {
msg = JSON.parse(event.data);
} catch (err) {
@ScottHelme
ScottHelme / upgrade.sh
Created October 2, 2016 14:05
Upgrade Ghost to latest version.
#!/bin/bash
# Written by Andy Boutte and David Balderston of howtoinstallghost.com, ghostforbeginners.com, allaboutghost.com
# updateghost_digitalocean.sh will update your current Digital Ocean Ghost install to the latest version without you losing any content
if [[ `whoami` != root ]]; then
echo "This script must be run as root."
exit 1
fi
# Make temporary directory and download latest Ghost.
@ScottHelme
ScottHelme / clear-cache.sh
Created October 2, 2016 14:05
Clear Nginx cache.
#!/bin/bash
sudo find /home/nginx/ghostcache -type f -delete
@ScottHelme
ScottHelme / brotli-compress.sh
Created October 2, 2016 14:04
Compress all blog assets with Brotli.
#!/bin/bash
for x in `find /var/www/ghost/content/themes/futura/assets/js/ -type f -iname '*.js'`
do
sudo /home/scott/nginx/brotli/bin/bro --input ${x} --output ${x}.br
sudo chown scott:ghost ${x}.br
sudo chmod 664 ${x}.br
done
for x in `find /var/www/ghost/content/themes/futura/assets/css/ -type f -iname '*.css'`
do
@ScottHelme
ScottHelme / amp.hbs
Last active August 31, 2018 20:20
My custom amp.hbs template for Ghost v0.10.0
<!DOCTYPE html>
<html ⚡>
<head>
<meta charset="utf-8">
<title>{{meta_title}}</title>
<meta name="description" content="{{meta_description}}" />
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<link rel="shortcut icon" href="/assets/images/favicon.ico">
{{amp_ghost_head}}
@ScottHelme
ScottHelme / changes.txt
Created September 4, 2016 13:32
Update Ghost 0.10.0 to use Google AMP Cache
/var/www/ghost/core/server/apps/amp/lib/helpers/amp_content.js
// make relative URLs abolute
html = makeAbsoluteUrl(html, config.url, post.url).html();
html = html.replace("https://scotthelme.co.uk/content/images/", "https://cdn.ampproject.org/i/s/scotthelme.co.uk/content/images/");
/var/www/ghost/core/server/data/meta/amp_url.js
if (_.includes(context, 'post') && !_.includes(context, 'amp')) {
var cacheUrl = config.urlJoin(config.getBaseUrl(false), getUrl(data, false)) + 'amp/';
@ScottHelme
ScottHelme / netxml2kml.py
Last active December 13, 2018 02:59
Convert XML files from Kismet into KML for Google Maps or Fusion Tables
#!/usr/bin/env python
# coding=utf-8
#
# Converts netxml files from Kismet Newcore into KML or KMZ files for Google Earth
#
# Author: Patrick Salecker
# URL: http://www.salecker.org/software/netxml2kml/en
# Last modified: 13.06.2011
import os