Skip to content

Instantly share code, notes, and snippets.

View guypursey's full-sized avatar
🏠
Working from home

Guy Pursey guypursey

🏠
Working from home
View GitHub Profile
@guypursey
guypursey / cm-version.sh
Last active January 5, 2024 12:26
Semver with Git and Bash
V=$(git describe --tags --abbrev=0)
Y=$(date +"%Y")
m=$(date +"%m")
d=$(date +"%d")
today="$(date +"%Y")$(date +"%m")$(date +"%d")"
verregex="([0-9]+)"
preregex="([0-9]{8})\.([0-9]+)"
bldregex="(\+[a-zA-Z]+)?"
regex="^v$verregex\.$verregex\.$verregex-$preregex$bldregex$"
if [[ $V =~ $regex ]]
@guypursey
guypursey / .block
Last active September 21, 2023 09:51 — forked from mbostock/.block
Wrapping long labels with D3 v4 (sample data)
license: gpl-3.0
@guypursey
guypursey / gist:cbef413f2670f066ee8b
Created June 4, 2015 08:01
Bookmarklet to add scrollbar to Google Organisational Chart
javascript: (function () { document.getElementsByClassName("waffle-objwrap-gvizchart")[0].style.overflow = "scroll"; } ())
@guypursey
guypursey / git-global-config.sh
Created December 5, 2022 15:15
Helpful Git aliases
git config --global alias.alias "config --get-regexp ^alias\."
git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"
git config --global alias.inked "log --color=always --pretty=format:'A:%Cgreen%ad%Creset %h %Cred%cd %C(brightblue white)%D%Creset %s' --date=format:'%Y/%m/%d@%H%M' --decorate=short --decorate-refs=tags --author-date-order"
git config --global alias.keyed "log --color=always --pretty=format:'C:%Cred%cd%Creset %h %Cgreen%ad %C(brightblue white)%D%Creset %s' --date=format:'%Y/%m/%d@%H%M' --decorate=short --decorate-refs=tags --date-order"
@guypursey
guypursey / git-add-atomic.sh
Last active September 29, 2019 10:04
git-add-atomic
#!/bin/bash
# diff a specific file for now (check it exists, etc.)
# extract hunk texts
bold=$(tput bold)
head=$(tput smul)
oldd=$(tput setaf 1)
newd=$(tput setaf 2)
askq=$(tput setaf 5)
@guypursey
guypursey / test-link-data.json
Last active April 16, 2019 11:17
Test link data
@guypursey
guypursey / for-console.js
Last active November 30, 2017 16:39
Way of extracting data as TSV from Trello
members = JSON.parse(document.getElementsByTagName("pre")[0].innerHTML).members
.reduce((p, c) => { p[c.id] = c.fullName; return p }, {})
lists = JSON.parse(document.getElementsByTagName("pre")[0].innerHTML).lists
//.filter(x => !x.closed)
.reduce((p, c) => { p[c.id] = c.name; return p }, {})
labels = JSON.parse(document.getElementsByTagName("pre")[0].innerHTML).labels
.reduce((p, c) => { p[c.id] = c.name; return p }, {})
@guypursey
guypursey / .block
Last active October 1, 2017 17:28
Test coverage visualisation (demo with D3 v4)
license: mit
scrolling: yes
@guypursey
guypursey / .block
Last active September 18, 2017 20:57
Co-occurrence matrix as wheel (University of Reading joint degree options 2014 data) with D3 v4
license: mit
@guypursey
guypursey / .block
Last active September 2, 2017 14:04
Co-occurrence matrix (University of Reading joint degree options 2014 data) with D3 v4
license: mit