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 / 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 / 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"
@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 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 / 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

@jphastings
jphastings / keybase.md
Created February 27, 2017 18:20
Decentralised proof of identity. Hooray!

Keybase proof

I hereby claim:

  • I am jphastings on github.
  • I am jphastings (https://keybase.io/jphastings) on keybase.
  • I have a public key ASDEkcXgO-mkOUUYhp5pQXwbBdnaxvyz32b74GKEVd-PAQo

To claim this, I am signing this object:

@jphastings
jphastings / initial_guidelines.md
Created October 16, 2015 11:48
Writing Presentations

Writing a presetation

Writing engaging presentations can be hard, below is the first draft of some hints and tips I've accumulated. I'm going to put them into a presentation (!) soon but this should give you a flavour in the short term.

Before you start

  • Your slides are a prop. They are not your presentation, you are.
    • Your slides will not be printed out or referred back to:
  • If you need to share data to take away, link to it.