Skip to content

Instantly share code, notes, and snippets.

@nevstokes
nevstokes / stylesheet regex
Created December 17, 2011 22:33
Regex to extract site-relative stylesheets from HTML page source
$regex = '/
(?= # Lookahead:
<link # Open link tag
(?:\s+[^>]*)? # Any leading data (non-capturing)
\s+rel= # rel attribute preceded by one or more spaces
([\'"]) # Opening quote for attribute ($matches[1] for backreference)
stylesheet # Match attribute value
\1 # Backreference to match quotes
.*? # Consume any subsequent data non-greedily
\/? # Optionally self-close
@nevstokes
nevstokes / keybase.md
Created October 25, 2014 06:58
Keybase verification

Keybase proof

I hereby claim:

  • I am nevstokes on github.
  • I am nevstokes (https://keybase.io/nevstokes) on keybase.
  • I have a public key whose fingerprint is 5811 61D4 A932 29EF F3A0 9099 576C 815A F211 FC60

To claim this, I am signing this object:

@nevstokes
nevstokes / github-releases.xsl
Last active December 16, 2017 20:53
Parse the GitHub Atom feed for a project to extract links to releases
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output method="text"/>
<xsl:template match="/atom:feed">
<xsl:apply-templates select="atom:entry"/>
@nevstokes
nevstokes / release
Created October 22, 2017 20:52
zsh function to make use of github-release.xsl
function release() {
wget -q https://github.com/$1/releases.atom -O - | xsltproc github-releases.xsl - | awk -F/ '{ print $NF; }'
}
@nevstokes
nevstokes / .ignore.yaml
Last active April 14, 2019 19:44
Generate individual ignore files from unified yaml
eslint:
- node_modules/
- "*.d.ts"
docker:
- .env.dist
- node_modules
- README.md
git:
@nevstokes
nevstokes / update-base-images.sh
Created August 22, 2019 18:23
Automatically update base image hash digests in a Dockerfile
#!/usr/bin/env bash
dockerfile=${1:-Dockerfile}
if [[ ! -f ${dockerfile} ]]; then
echo "${dockerfile} was not found" >&2
exit 1
fi
while IFS="@" read image existing_hash; do
@nevstokes
nevstokes / timings.sh
Created January 20, 2020 15:14
Processes a Bamboo build log and extracts timings for each task
#!/usr/bin/env bash
if [[ "$#" -ne 1 ]]; then
echo "Usage: $0 LOGFILE" >&2
exit 1
fi
LOGFILE=$1
if ! [[ -f "${LOGFILE}" ]]; then
#!/usr/bin/env bash
sudo apt update && sudo apt upgrade -y
sudo apt install software-properties-common
# Get up-to-date versions of ansible and git
sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-add-repository -y ppa:git-core/ppa
sudo apt update
@nevstokes
nevstokes / Sigchain Statement
Last active March 28, 2021 20:31
keys.pub verification
BEGIN MESSAGE.
12UZY9MkdOBCzm8 vmYDTM7T2E48Jw6 mx4DEizWS4LFFvO nncQFPhPf5xaz5P
VSTBlpVPDDLnMsh wIRNkPWuzWsTCKq 6Xr2MZHgg6tRvTF uuGHhqecfR4eFVq
xpuy5y6i6OHivHd 0PtVxx24rTnzpWu vSaNjADnlMWE6sq FQ6Ia1PQtg0XfXP
fbqQv3R2P1Ji7pD Lz4uY5eqoSpvbut qRGsC29HFxl.
END MESSAGE.