Skip to content

Instantly share code, notes, and snippets.

View brianloveswords's full-sized avatar

Brian J Brennan brianloveswords

View GitHub Profile
// @ts-check
// I run this in a folder using `caddy file-server` with the two files below
// and an index.html that's more or less just including this file as a script,
// `<script src="/audio.js"></script>`
// prerequisite: two files representing a transition that should be gapless. I
// used the first two tracks off Meshuggah's "Catch Thirtythree" because I
// happen to know that album is intended to be gapless.
function cursedPromise() {
return new Promise(resolve => {
if (Math.random() > 0.5) resolve();
async function main() {
await cursedPromise();
console.log("after await");
return "ok";
#!/usr/bin/env bash
function example() {
set -o errexit
set -o nounset
## only needed for the example
local worktime=0
# how many concurrent operations to perform
brianloveswords /
Last active April 26, 2021 04:55
BigQuery Cost Estimator

BigQuery Cost Estimator

Get an estimate of how much a query is going to cost before you run it.


  1. Create a new bookmark with the contents of 2-bookmarklet as the URL.
  2. Whenever you open a new BQ session, click the bookmarklet to attach the observer. You only have to do it once per session.
function addH1() {
document.body.innerHTML += '<h1>okay!</h1>';
// this lets callers from `file.js` through to the original version of
// innerHTML but not other callers
const innerHTMLDesc = Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML');
Object.defineProperty(Element.prototype, 'innerHTML', {
get() {
brianloveswords / mkbin
Last active October 3, 2018 19:06
mkbin: a shell script that makes shell scripts
# mkbin: create a new shell script and open the editor
if [ "$1" = "-e" ] || [ "$1" = "--edit" ]; then

Identifying Non-Chronological Tweets In Timeline

[jump to complete source]

There are two stages to this:

  1. identify initially loaded non-chrono tweets
  2. identify newly loaded non-chrono tweets as user scrolls


There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.


  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
/// Print out 140 characters of random celebratory emoji.
package main
import (
brianloveswords / follower-csv.js
Last active November 3, 2017 22:47
Copy a CSV of your followers to your clipboard
// put this in the console on<username/followers
timer = setInterval(() => window.scrollTo(0, document.body.scrollHeight), 100);
// wait until the document stops scrolling...
// this will copy the CSV to your clipboard