Skip to content

Instantly share code, notes, and snippets.

View jphastings's full-sized avatar
🌴

JP Hastings-Spital jphastings

🌴
View GitHub Profile
@jphastings
jphastings / openpgp.md
Created November 12, 2022 11:39
Proving my identity with Keyoxide

openpgp4fpr:52A59FB334967177D8E425D5FDD468F7EF117819

@jphastings
jphastings / README.md
Last active May 18, 2022 08:59
JIRA Standup!

Standup helper

The following Manager Code™ will let you walk through your Jira Project board person by person, in a 'random order' (deterministic on a per-day basis) and show only their tickets.

It works in my Chrome browser; your mileage may vary… (forks of this gist very welcome!)

To use it:

  1. Copy the code below
  2. Create a new bookmark in Chrome
@jphastings
jphastings / rpi_firmware
Created March 27, 2021 13:35
Ensures the basic RPi firmware is in the given folder
#!/bin/sh
FIRMWAREURL="https://raw.githubusercontent.com/raspberrypi/firmware/master/boot/"
DIR="$1"
[ ! -d "${DIR}" ] && { echo "First argument should be a directory that exists"; exit 1; }
for firmware in LICENCE.broadcom bootcode.bin fixup.dat start.elf; do
firmware_dest="${DIR}/${firmware}";
if [ ! -f "${firmware_dest}" ]; then
echo "Downloading RPi firmware: ${firmware}";
curl --silent --output "${firmware_dest}" "${FIRMWAREURL}${firmware}";
@jphastings
jphastings / circle_overlap.php
Created February 26, 2010 19:27
Calculating the percentage area overlap between circles in PHP. Built for Jon Hazan @ Bam UK
<?php
/**
* Returns the percentage area overlap between two circles
* NB. Doesn't validate input.
*
* Built for Jon Hazan of Bam UK student marketing
*
* @author JP Hastings-Spital
* @param float distance between the two circles' origins
@jphastings
jphastings / git-into
Created September 18, 2019 15:04
Git into merges your current branch into the given remote branch, first resetting your local version of the given branch to remote's version thereof. To be invoked with a deep southern accent.
#!/bin/sh
# Place in your path and invoke with a deep southern accent: `git into staging`
mergeinto="$1"
if [[ $(git status -s) ]]; then
echo "Your working directory is not clean, please commit or stash first."
exit 1
else
branch=$(git rev-parse --abbrev-ref HEAD)
git fetch > /dev/null
git checkout "$mergeinto"
# gem install jphastings-dlc
require 'dlc'
s = DLC::Settings.new
s.name = "Your Name"
s.url = "http://yourdomain.com"
s.email = "your.name@yourdomain.com"
# Now you can make a dlc:
package = DLC::Package.new
package.name = "My package" # Suggested, but not required
@jphastings
jphastings / looper.go
Last active February 16, 2019 23:54
Animation gif looper
package main
/*
Some really shonky code that looks for looping moments within a set of frames from animated TV shows.
Find out more here: https://twitter.com/jphastings/status/1096915446702489600
*/
import (
"fmt"
@jphastings
jphastings / mkport
Created September 4, 2018 17:18
Need a port number for your service that's unlikely to clash with other services and easy to remember? Try mkport!
#!/usr/bin/env ruby
port = ARGV[0].downcase.split(//).reduce(0) do |sum, char|
sum * 10 + case char
when *%w[a b c] then 2
when *%w[d e f] then 3
when *%w[g h i] then 4
when *%w[j k l] then 5
when *%w[m n o] then 6
when *%w[p q r s] then 7
@jphastings
jphastings / app.go
Created July 6, 2018 09:15
Structuring a gin webapplication: an idea
package main
import (
"fmt"
"github.com/go-gonic/gin"
)
var Routes struct {
Homepage func() string
CreateWidget func() string
@jphastings
jphastings / README.md
Last active May 3, 2018 08:55
Show your codeowners in Sublime Text 3

Codeowners

Github uses a CODEOWNERS file in the root of a repo as a declaration of individuals or teams that should be notified if files are changed.

This is very useful when working on a project with a large number of contributors; but it can be a bit hard to make use of as a human.

This Sublime Text plugin adds a status bar hint to let you know who you might want to talk to about the file you're editing.

Illustration of plugin active in the Status Bar