Skip to content

Instantly share code, notes, and snippets.

View balupton's full-sized avatar
🏍️
Travelling for next 2 weeks

Benjamin Lupton balupton

🏍️
Travelling for next 2 weeks
View GitHub Profile
@balupton
balupton / README.md
Last active March 10, 2024 18:26
Upload a File to Cloudflare R2 Instructions
@balupton
balupton / bloc-party-another-weekend-in-the-city-secret-alarm.txt
Last active March 2, 2024 11:30
Bloc Party — Another Weekend in the City / Bloc Party - Secret Alarm
Posted on https://www.last.fm/music/Bloc+Party/Another+Weekend+In+The+City/+shoutbox?sort=popular
I was an original compiler of this, though track listing changed.
https://web.archive.org/web/20100914172131/https://www.last.fm/user/balupton links a 2017 journal entry where I shared my track listing (the actual entry was not archived, my llast.fm account was deleted when last.fm was acquired by CBS, and the computer with the full track listing crashed)
From fragments of various backups, I compiled two albums
My incomplete track listing for "Another Weekend in the City”
01 England
02 Emma Kate's Accident
@balupton
balupton / cors.js
Created September 11, 2012 05:21
Acheiving CORS via a Node HTTP Server
// Create our server
var server;
server = http.createServer(function(req,res){
// Set CORS headers
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Request-Method', '*');
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
res.setHeader('Access-Control-Allow-Headers', '*');
if ( req.method === 'OPTIONS' ) {
res.writeHead(200);
@balupton
balupton / readme.md
Last active January 5, 2024 01:12
Debugging Ubuntu VPN/Bridge Networking

Networking on my Ubuntu machines is being flaking:

  • docker bridge interface failing
  • traffic not going to vpns
  • when vpn or docker bridge does work it knocks out all dns resolutions

Here are all the things I have tried or yet to try.

docker failures

@balupton
balupton / inter.html
Last active December 9, 2023 06:35
Load Inter Font on Every Webpage
<link rel="preconnect" href="https://rsms.me/" />
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
<style>
:root,
html,
body
article,
p,
h1,
h2,
@balupton
balupton / ajaxify-html5-native.js
Created August 15, 2011 06:38
Ajaxify a Website with the HTML5 History API, jQuery and ScrollTo
// https://gist.github.com/1145804
(function(window,undefined){
// Prepare our Variables
var
history = window.history,
$ = window.jQuery,
document = window.document;
// Check to see if the HTML5 History API is enabled for our Browser
@balupton
balupton / README.md
Last active September 1, 2023 20:22
Stack Overflow Question 76861137 — How to prevent nested function failures being missed in bash?

Exit Status and Bash

I'm @balupton, author of dorothy which is the largest public bash codebase that I am aware of.

Dorothy is coded using set -e (errexit) to avoid || return $? statements on every single one of its thousands of lines of code, for the most part this has worked well, however I was suprised when the down command would report a failure via:

However it would also report a success within the called function:

@balupton
balupton / bash-input-output-testing.bash
Created August 30, 2023 13:24
Bash Input Output Testing
# test input/output availability, accurately but noisely
(: </dev/stdin || printf '%s\n' 'cannot read stdin') || :
(: >/dev/stdin || printf '%s\n' 'cannot write stdin') || :
(: </dev/stdout || printf '%s\n' 'cannot read stdout') || :
(: >/dev/stdout || printf '%s\n' 'cannot write stdout') || :
(: </dev/stderr || printf '%s\n' 'cannot read stderr') || :
(: >/dev/stderr || printf '%s\n' 'cannot write stderr') || :
(: </dev/tty || printf '%s\n' 'cannot read tty') || :
(: >/dev/tty || printf '%s\n' 'cannot write tty') || :