Skip to content

Instantly share code, notes, and snippets.

working on in my sparse spare time

Jay Caines-Gooby jaygooby

working on in my sparse spare time
View GitHub Profile
View gist:269604
jaygooby / school_type count
Created May 31, 2011
Case statement to increment count()
View school_type count
select lea, SUM(CASE WHEN school_type like '%primary%' THEN 1 ELSE 0 END) as `primary`, SUM(CASE WHEN school_type like '%secondary%' THEN 1 ELSE 0 END) as `secondary` from schools group by lea
jaygooby / os-x-ghostscript-imagemagick
Last active Mar 9, 2018
Download and install imagemagick plus configure automator app for converting PDFs to PNGs
View os-x-ghostscript-imagemagick
#!/usr/bin/env bash
# Install using:
# bash < <(curl -s
IM_TMP_FILE=/tmp/$(basename $IM_URL)
IM_SUM="33849 17409"
jaygooby / strip_related_videos.php
Created Nov 4, 2011
Always put a rel=0 attribute on Youtube embedded videos so that related videos aren't shown at the end
View strip_related_videos.php
jaygooby / .screenrc
Created Mar 5, 2012
Good default .screenrc that remaps CTRL-a to CTRL-g and lists open screens in a menu
View .screenrc
# None of my own work. Munged from various other .screenrc recipes
# Don't use CTRL-A as the trigger because its stops the bash
# cli navigation like CTRL-A for start of line to stop working
escape ^Gg
# We'd like to scroll in an xterm please
defscrollback 1024
View gist:2170045
function htmlreplace(a, b, element) {
if (!element) element = document.body;
var nodes = element.childNodes;
for (var n=0; n<nodes.length; n++) {
// MSIE doesn't have Node
if (nodes[n].nodeType == 3) {
var r = new RegExp(a, 'gi');
// MSIE8 and less doesn't have textContent
if (nodes[n].textContent) {
View Sebastian Coe spam.txt
From: <Sebastian Coe>
Dear Sir/Madam
I am an Agent to London 2012 Olympics organising commitee (LOCOG). I play an intermediary role between local organizing committee (LOC) and any interested foreign company in any international competitive tender and my commission is usually 2%
of the total contract value.
I wish to know if your company or you as an individual will be interested to participate in an international Tender for the supply of the following items:
1) T-shirt
2) Umbrellas/Tents,
View Gemfile
gem 'apn_sender', :require => 'apn'
gem 'daemons'
View gist:2700905
We've received a report that your instance(s):
Instance Id: i-9ab75ffa
IP Address:
has been port scanning remote hosts on the Internet; check the information provided below by the abuse reporter.
This is specifically forbidden in our User Agreement:
jaygooby /
Last active Jul 26, 2022
Git, you bloody git

Initialising a new repo with a different initial branch

After working on some new code, I realised I wanted to push it to an existing remote git repo, but in a branch that didn't exist. The code hadn't been pulled from anywhere - it was newly written in a directory.

Initialise the directory with the branch that you want it to become, commit the code, add the existing remote and push:

git init --initial-branch=my-fun-feature

git add -A && git commit -m "WIP"