Skip to content

Instantly share code, notes, and snippets.

View johnsyweb's full-sized avatar

Pete Johns johnsyweb

View GitHub Profile
@johnsyweb
johnsyweb / capture_font_comparison.rb
Created November 4, 2025 03:11
Script to capture before/after screenshots of website changes using Jekyll server and Chrome headless
#!/usr/bin/env ruby
# frozen_string_literal: true
# Script to capture before/after screenshots of the about page
# and create a composite image showing the font change
#
# This script should be run in an environment where Ruby is managed by mise
# (or similar tool) to ensure the correct Ruby version is available.
require 'fileutils'
@johnsyweb
johnsyweb / twexit.user.js
Created May 16, 2025 08:49
Redirect X.com and Twitter to Nitter
// ==UserScript==
// @name Redirect X.com and Twitter to Nitter
// @namespace http://tampermonkey.net/
// @version 1.0.1
// @description Redirect Twitter/X (including t.co) URLs to a Nitter instance
// @author Pete Johns (@johnsyweb)
// @match *://x.com/*
// @match *://www.x.com/*
// @match *://mobile.x.com/*
// @match *://twitter.com/*
@johnsyweb
johnsyweb / cucumber.diff
Created October 10, 2018 21:49
Sample Cucumber Failure...
% git reset --hard origin/master && rbenv version && bundle exec cucumber --version && bundle exec cucumber features/built_in_matchers/all.feature:21
HEAD is now at 00252315 Merge 3-8-maintenance
2.5.1 (set by RBENV_VERSION environment variable)
1.3.20
/opt/rubies/2.5.1/lib/ruby/gems/2.5.0/gems/gherkin-2.12.2/lib/gherkin/formatter/filter_formatter.rb:105: warning: constant ::Fixnum is deprecated
Using the default profile...
..F
(::) failed steps (::)
@johnsyweb
johnsyweb / keybase.md
Created July 17, 2017 02:20
Suck it Malcolm!

Keybase proof

I hereby claim:

  • I am johnsyweb on github.
  • I am johnsyweb (https://keybase.io/johnsyweb) on keybase.
  • I have a public key ASCrr5299F40kYKt9QVqd-22qgmC4914VfJb57pn7sHojAo

To claim this, I am signing this object:

@johnsyweb
johnsyweb / list_set_slice.py
Created November 11, 2016 23:37
Python surprise!
>>> l = []
>>> l[100:] = ['foo']
>>> l[100]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
for region in $(aws ec2 describe-regions --region ap-southeast-1 --query 'Regions[].RegionName' --output=text); do
echo "EC2 instances in ${region}..."
aws ec2 describe-instances --region ${region} --query 'Reservations[].Instances[].Tags[?Key==`Name`].Value' --output=text
done
@johnsyweb
johnsyweb / broken-git
Created August 5, 2014 05:21
Oh. Great(!)
$ git fetch
remote: Counting objects: 4467, done.
remote: Compressing objects: 100% (2616/2616), done.
remote: Total 4467 (delta 2569), reused 2859 (delta 1665)
Receiving objects: 100% (4467/4467), 3.87 MiB, done.
Resolving deltas: 100% (2569/2569), done.
fatal: bad object 932319fa81372b23ab80b4fd8c99947b83322f3c
#!/bin/bash
boot2docker down
for i in {49000..49900}; do
for protocol in 'tcp' 'udp'; do
VBoxManage modifyvm "boot2docker-vm" --natpf1 "${protocol}-port${i},${protocol},,${i},,${i}"
done
done
#!/usr/bin/env ruby
# encoding: utf-8
IDEAS = [
%Q(Bar uvg jbaqref' bgure fbatf),
%Q(Gurl jnag gb oernx serr: Gur zhfvp gurl znqr jura gurl yrsg gur onaq),
%Q(Nhfgenyvnan: Fubjpnfr lbhe snibhevgr angvir onaqf gb arjpbzref gb guvf ynaq tveg ol frn ),
%Q(Sbervta ynathntr fbatf),
%Q(Xrrc ba Ehaava': Zhfvp gb zbgvingr zr gb trg cnfg gur 8xz znex),
%Q(Zhfvp bs gur zbivrf: Abg gur gurzrf… ohg fbatf znqr snzbhf ol gur zbivrf),
iex(2)> v()
1: h()
#=> :"do not show this result in output"
:ok