Skip to content

Instantly share code, notes, and snippets.

sterlingwes / Resuable Github
Last active August 16, 2022 18:37
Reusable Github Action Steps (Local Composite Action)
View Resuable Github

Crafting a Reusable Github Action

The documentation for this common use case is sorely lacking...

Why this was needed:

  • I had a bunch of CI jobs (lint, test, type checking) that I wanted to run as separate jobs but share the same common steps for running checkout & dependency install

File structure

sterlingwes /
Last active January 20, 2021 12:55
Debugging a third party gradle plugin

A third party Gradle plugin can be difficult to debug. In my case, I couldn't figure out why an input in my build.gradle file wasn't causing the plugin to add a desired task to a build. It's also not straightforward to inspect the source code of a plugin that arrives prebuilt. Fortunately if the plugin is open source, you can breakpoint in the source.

This thread forms the basis of these steps:

  • clone the source code for the plugin, and checkout the commit or version tag reflecting the version of the plugin you want to debug
  • open the repo in IntelliJ IDEA / Android Studio and allow gradle to sync
  • create a run configuration, selecting Attach to Remote JVM
  • make your breakpoints in the source code
  • in the project with the gradle build you want to debug, run ./gradlew --no-daemon -Dorg.gradle.debug=true app:uploadBugsnagReleaseSourceMaps, gradle will wait for a debugger to attach
  • back in the source code repo for the plug
sterlingwes /
Created October 13, 2019 14:42
Viewing deleted files on unix that are still open (lost disk space)

lsof -nP | grep '(deleted)'

sterlingwes /
Created October 8, 2019 17:57
Generate SSH public key fingerprint (github key check)

Useful for comparing the fingerprint shown by github at against the public key on your machine to see whether it's a match:

ssh-keygen -l -E md5 -f ~/.ssh/

This lists the MD5 fingerprint


sterlingwes / javascript.json
Created July 28, 2017 14:38
React VS Code Snippets
View javascript.json
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
sterlingwes / PerformanceTimer.js
Created May 10, 2017 16:01
Performance timing with window.performance
View PerformanceTimer.js
const perf = window.performance
class PerformanceTimer {
constructor (name) { = name
this.markStart = `${name}-start`
this.markStop = `${name}-stop`
start () {
sterlingwes / loadertest.html
Created May 10, 2017 14:53
Three.js OBJ Loader test
View loadertest.html
<script src="node_modules/three/build/three.js"></script>
<script src="node_modules/three/examples/js/loaders/OBJLoader.js"></script>
const model = ''
.then(response => response.blob())
sterlingwes / loaderHook.js
Last active May 2, 2017 16:04
webpack server side rendering with file loader (ie: require()'d images)
View loaderHook.js
const fs = require('fs')
const utils = require('loader-utils')
const defaultOptions = {
extensions: ['.png', '.jpg'],
filePrefix: 'img/img-',
hashLength: 6
module.exports = function (options) {
sterlingwes /
Last active April 4, 2018 06:05
Getting past cross-origin Web Worker exception

Cross-origin web worker scripts

If you're like me and wanted to serve your main app script from a CDN and still load a web worker, you may have encountered the following error:

Uncaught DOMException: Failed to construct 'Worker': Script at '' cannot be accessed from origin ''

You can get around this fairly simply with importScripts by making the script you instantiate your worker with load the actual worker script from the CDN.

sterlingwes /
Created January 5, 2017 16:53
Convert video to optimized GIF with libav (avconv)


  • avconv
  • gifsicle

If you're on Ubuntu:

  • apt-get install gifsicle libav-tools