Skip to content

Instantly share code, notes, and snippets.

View jbinto's full-sized avatar

Jesse Buchanan jbinto

View GitHub Profile
@jbinto
jbinto / howto-recover-google-authenticator-keys.txt
Created February 8, 2014 04:20
Recovering Google Authenticator keys from Android device for backup
### Last tested February 7 2014 on a Galaxy S3 (d2att) running Cyanogenmod 11 nightly, with Google Authenticator 2.49.
### Device with Google Authenticator must have root.
### Computer requires Android Developer Tools and SQLite 3.
### Connect your device in USB debugging mode.
$ cd /tmp
$ adb root
$ adb pull /data/data/com.google.android.apps.authenticator2/databases/databases
@jbinto
jbinto / getTitleNative.js
Created January 13, 2016 07:32
Get title from remote HTML URL - without jQuery
// Only using native browser features (no jQuery).
// Uses `fetch`, `DOMParser` and `querySelectorAll`.
const getTitle = (url) => {
return fetch(`https://crossorigin.me/${url}`)
.then((response) => response.text())
.then((html) => {
const doc = new DOMParser().parseFromString(html, "text/html");
const title = doc.querySelectorAll('title')[0];
return title.innerText;
<#
Create Unix VM's.
PREREQUISITES:
- A VM that has been installed with an OS that supports cloud-init
- cloud-init is installed on the vm
How it works:
- Asks for a bunch of parameters
- Creates a disk from parent vhdx for speed
@jbinto
jbinto / ruby-versions-chruby.md
Created May 5, 2015 19:21
Dealing with Ruby versions - chruby

Dealing with Ruby versions - chruby

Every time I sit down to code, it seems like a new Ruby version is available.

When I first learned ruby I used rvm on my Mac. In production on linux, I use rbenv, likely due to its Capistrano integration.

When I set up my current machine, I found rvm had fallen out of fashion in favour of something called chruby.

Install new ruby

@jbinto
jbinto / node_debugging_tricks.md
Last active April 15, 2023 15:59
Some dumb node debugging tricks

Some dumb Node.js debugging tricks

On Nov 15 2022 @cszatmary DM'd me about a flaky test he was having trouble with.

I don't want to get too in the weeds here about the specific problem or the challenges of our codebase, but if you would like a tl;dr of the actual issue we encountered, click show gory details below:

Click here to show gory details
  • A brand new Supertest test would sometimes time out after 60 seconds, but only on CircleCI
  • Turning gzip compression off would make the tests pass reliably, this turned out to be a red herring
@jbinto
jbinto / mkjira.md
Last active November 5, 2021 21:17
mkjira (quickly make JIRA tickets from the command line)
@jbinto
jbinto / input.scss
Created November 9, 2020 22:06
Generated by SassMeister.com.
h2 {
:global([data-theme="fancy"]) :global([[data-color="pineapple"]]) & :global(em) {
display: none;
}
}
@jbinto
jbinto / ssl-cert-upgrade-cloudfront.md
Last active February 20, 2020 08:28
Upgrading SSL certificate on Cloudfront

Upgrading SSL certificate on Cloudfront

Last year I set up jessebuchanan.ca with an SSL certificate on Amazon S3 / CloudFront.

Now, it's time to renew the certificate.

The first time was fraught with peril, but I eventually got it working.

This time I will document the steps to renew the cert. Most steps for a new installation would be omitted.

@jbinto
jbinto / index.jsx
Created November 28, 2015 22:15
Egghead tutorial - Getting Started with Redux - JSBin implementation
/* global ReactRedux, Redux, ReactDOM */
// "Getting Started with Redux" (by Dan Abramov)
// https://egghead.io/series/getting-started-with-redux
// This file on JSBin (by Jesse Buchanan):
// http://jsbin.com/wuwezo/74/edit?js,console,output
////////////////////////////////////////////////
//
// option 1 to override fetch, using cypress built-in facilities (e.g. sinon)
cy
// sinon syntax ⬇️
.stub(win, 'fetch')
.withArgs('/graphql')
// The pseudocode-ish that this generates, kinda like this:
const realFetch = window.fetch
window.fetch = (arg1) => {