Skip to content

Instantly share code, notes, and snippets.

View grahamb's full-sized avatar
🇨🇦
As Canadian as possible under the circumstances

Graham Ballantyne grahamb

🇨🇦
As Canadian as possible under the circumstances
View GitHub Profile
@grahamb
grahamb / .eslintrc.json
Last active November 18, 2022 18:21
Basic Node Prettier/ESLint bootstrap
{
"extends": [
"unobtrusive"
],
"parserOptions": {
"ecmaVersion": 2022
},
"plugins": [
"import"
],
@grahamb
grahamb / stp2022.md
Created July 23, 2022 17:47
Seattle to Portland 2022 Recap

TL;DR: A+, would do again. Here's some pics: https://imgur.com/a/RH8c7Zm

It's been a week and I've had some time to think about it. I'll start off with that this was my second STP, but the first was in 2010, so it might as well have been my first. I'm in moderately-reasonable shape; I was a year-round bike commuter pre-pandemic (~30km RT, with ~300m of climbing on the way to work). I now work primarily remote, so my riding time has gone way down.

I had grand plans to train up to the ride, but the shitty spring and early summer weather we had in the Vancouver area, coupled with life stuff, put a dent in that. I did have to travel ~100km from home for a work conference last month, so I rode my bike rather than drive, so that was a good reminder of what a day in the saddle felt like and confirmed that my bike fit and clothing were still appropriate. I also have another single-day 160km ride coming up in a few weeks; it has way more climbing than STP, but it confirmed that I should be able to do it.

The

@grahamb
grahamb / aqi.js
Last active September 18, 2020 20:34 — forked from jasonsnell/purpleaqijsnell.js
AQI Widget Code
// Displays Air Quality Index based on station data from
// aqicn.org
//
// Requires an API token: https://aqicn.org/data-platform/token/#/
//
// Configuration: configure the widget "Parameter" with a query string
// containing the station name and API token, e.g:
// station=Burnaby North Eton, British Comlumbia, Canada&token=12345
//
// based on widget code by Jason Snell <[email protected]>
@grahamb
grahamb / machine.js
Created September 16, 2020 18:49
Generated by XState Viz: https://xstate.js.org/viz
const initialContext = {
username: null,
};
/*
USER STATES
A user can be in one of the following states.
These states are calculated as a result of the `enrolledTOTP` and `registration` properties on the user record.
- enrolledRegistered: is enrolled (in the maillist) and registered (has registration record in DB)
[databases]
; canvas_production via haproxy
canvas_production_haproxy = .........
[pgbouncer]
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
listen_addr = *
listen_port = 5432
auth_type = hba
@grahamb
grahamb / .eslintrc
Last active March 20, 2020 18:12
node devtools bootstarap
{
"extends": ["unobtrusive"],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
},
"env": {
"browser": false,
// AWS sends some request headers as all-lower-case, and others as mixed-case. Normalize them for great justice.
// Hat-tip:
// https://architecture-as-text.slack.com/archives/C6BGT0D08/p1571179244177200?thread_ts=1571178938.175700&cid=C6BGT0D08
module.exports = req => {
const headerKeys = Object.keys(req.headers);
const normalizedHeaders = {
...req.headers,
};
#0 0x00007ff1aea56625 in raise () from /lib64/libc.so.6
No symbol table info available.
#1 0x00007ff1aea57e05 in abort () from /lib64/libc.so.6
No symbol table info available.
#2 0x00007ff1afcbc231 in die () at error.c:478
No locals.
#3 rb_bug_context (ctx=0x7ff1b0466b00, fmt=<optimized out>) at error.c:508
file = <optimized out>
line = 33
#4 0x00007ff1afbc811f in sigsegv (sig=<optimized out>, info=0x7ff1b0466c30, ctx=0x7ff1b0466b00) at signal.c:907
#0 0x00007fdb14400625 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
resultvar = 0
pid = <value optimized out>
selftid = <value optimized out>
#1 0x00007fdb14401e05 in abort () at abort.c:92
save_stage = 2
act = {__sigaction_handler = {sa_handler = 0xa4716d6b, sa_sigaction = 0xa4716d6b}, sa_mask = {__val = {59980901, 72340172821233687, 140578719339804, 0, 140734697714016, 140578914126680, 140578931418312, 140578719339912, 4294967295, 140578931518824, 5, 2275712, 0, 140578996000280, 140734697714352, 140578719338496}}, sa_flags = 354762944, sa_restorer = 0x7fdb00000005}
sigs = {__val = {32, 0 <repeats 15 times>}}
#2 0x00007fdb08a32090 in dlfree () from /tmp/canvas-lms/vendor/bundle/ruby/2.4.0/gems/ffi-1.9.23/lib/ffi_c.so
No symbol table info available.
@grahamb
grahamb / files_controller.diff
Last active May 4, 2018 18:49 — forked from lukfugl/files_controller.diff
fix avatar upload for local storage
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index eeaa0d3..fe0e7d9 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -763,7 +763,9 @@ class FilesController < ApplicationController
@attachment.uploaded_data = params[:file] || params[:attachment] && params[:attachment][:uploaded_data]
if @attachment.save
# for consistency with the s3 upload client flow, we redirect to the success url here to finish up
- redirect_to api_v1_files_create_success_url(@attachment, :uuid => @attachment.uuid, :on_duplicate => params[:on_duplicate], :quota_exemption => params[:quota_exemption])
+ includes = Array(params[:success_include])