Skip to content

Instantly share code, notes, and snippets.

View plasticine's full-sized avatar
🐧
Hello? Is this thing on?

Justin Morris plasticine

🐧
Hello? Is this thing on?
View GitHub Profile
@plasticine
plasticine / slugify
Last active September 20, 2022 13:42
Slugify strings in bash with awk
#!/usr/bin/env bash
#
# Accepts an input string and slugifies it by replacing anything non-alphanumeric with a dash.
#
# Example;
#
# $ slugify "foo bar hello/world"
# > foo-bar-hello-world
#
# $ echo "foo bar hello/world" | slugify
#!/usr/bin/env bash
set -euo pipefail
plasticine() {
[[ -z ${ITS_ME:-} ]] && {
echo "MAKING A NETWORK CALL!!!"
ITS_ME=$(curl -sSL https://api.github.com/users/plasticine)
}
steps:
- trigger: juzzy-secondary
label: ":pipeline: First Trigger"
build:
env:
PARENT_JOB_LABEL: First
PARENT_JOB_ID: "$BUILDKITE_JOB_ID"
- wait
gcob() {
local format branch branches
format="%(committerdate:relative)\\%(color:green)%(refname:short)%(color:reset)\\%(HEAD)\\%(color:yellow)%(objectname:short)%(color:reset) %(upstream:trackshort)\\%(contents:subject)"
branches=$(git for-each-ref --format="$format" --sort=-committerdate refs/heads/ | column -t -s "\\") &&
branch=$(echo "$branches" | fzf --ansi --height=15 --border) &&
git checkout $(echo "$branch" | awk '{print $4}')
}
# Foundation Target (install system runtime deps)
FROM xyz:1.0@sha256:abcd1234 AS foundation
# Runtime deps and common environment stuff here
# Build Target (install system buildtime deps)
FROM foundation AS build
# Install build-time systems deps and things here, we don’t want/need these in production
# Development Target (development toolchain)
FROM build AS development
kube_context() {
context=$(kubectl config current-context | awk '{print toupper($0)}')
colour="%K{blue}"
[[ "$context" =~ "PRODUCTION" ]] && colour="%K{red}"
echo " $colour%F{black}%B \u2388 $context %b%f%k"
}
@plasticine
plasticine / help.makefile
Last active August 28, 2019 11:30
Automatically extract help from your Makefiles using some fully sick awk hacks
# You're looking at it! :)
help:
@makehelp < $(MAKEFILE_LIST)
.PHONY: help

Keybase proof

I hereby claim:

  • I am plasticine on github.
  • I am plasticine (https://keybase.io/plasticine) on keybase.
  • I have a public key ASBkwMaRziWws0mrw9MGEGIgst3UkOfxw9hiBzpfxtHEXAo

To claim this, I am signing this object:

@plasticine
plasticine / spendyspendy.txt
Last active August 29, 2015 14:26 — forked from dannolan/spendyspendy.txt
Top Entitlement Claiming Federal Politicians in Australia (2014)
Top Spenders OVERALL
The Hon Tony Abbott MP $ 1,057,673
The Hon Julie Bishop MP $ 866,653
Mr Tony Pasin MP $ 851,482
Mr Tim Watts MP $ 556,863
The Hon Andrew Robb AO MP $ 539,247
The Hon Darren Chester MP $ 529,344
Mr Wyatt Roy MP $ 526,258
Senator the Hon Simon Birmingham $ 523,191
#!/bin/sh
# /share/CE_CACHEDEV1_DATA/.qpkg/autorun/autorun-plexconnect.sh
#
# mkdir /share/CE_CACHEDEV1_DATA/.qpkg/autorun
# chmod +x /share/CE_CACHEDEV1_DATA/.qpkg/autorun/autorun-plexconnect.sh
curl -Lk https://gist.githubusercontent.com/plasticine/86e189c42ac8ec7598a8/raw/update_plex_connect.sh | bash &