Skip to content

Instantly share code, notes, and snippets.

Working from home

Michael Richardson rainabba

Working from home
  • Asurion
  • Manassas, VA
View GitHub Profile
rainabba / gist:9996443
Created April 5, 2014 19:06
WKHTMLTOPDF 1.12 using Google-Hosted .woff (Roboto)
View gist:9996443
<title>WKHTMLTOPDF Font Test</title>
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url( format('woff');
rainabba / gist:3f4fe16cc40bf98b2272
Created May 29, 2014 01:37
G+ Comments on any page
View gist:3f4fe16cc40bf98b2272
// Simplified version of what I found at
// This assumes jQuery support as $
<script src=""></script>
<div id="commentscounter"></div>
<div id="gpcomments"></div>
$(function() {
gapi.comments.render('gpcomments', { href: window.location, first_party_property: 'BLOGGER', view_type: 'FILTERED_POSTMOD' });
gapi.commentcount.render('commentscounter', { href: window.location });
rainabba / drive-api-test
Last active May 9, 2018 19:34
google-api-nodejs-client examples using JWT and service account
View drive-api-test
const README = '\n\nThis script is intended to help you use a google API \
client_secret.json file to obtain an OAUTH token (json data) and \
store it next to the source .json for future use. \n\n\
To acomplish this, you will be given an URL that you can follow to \
get a "code" which can then be used to get a token. As an I/O solution \
I run this script with `node --inspect-brk` and then I catch the debugger \
after the URL is logged to the console. Once I have the code, I can run \
`code="{codeFromUrl}"` and resume the script. \n\n\n';
console.log( README );
rainabba / testdeferredpromise.html
Last active September 23, 2015 19:18
Example and differences for A+ Promise using Resolve/Reject and a Bluebird promisify wrapper
View testdeferredpromise.html
<script src=""></script>
<script src=""></script>
<h1>Open the console</h1>
rainabba / saveToDrive.js
Created December 30, 2015 21:37
VERY basic example of how to save content to Google Drive using node.js using googleapis
View saveToDrive.js
// This requires a google developers console project. That UI changes regularly and I found it hard to learn, but at the time I'm creating this, the steps are:
// - At the top-right, select or create a new project (can't give step-by-step details here)
// - Visit
// - Enable API with your options (not sure they matter much, but API must be enabled)
// - Visit
// - Create a new service account if you don't already have one or don't have one you want to use for these API calls. Select the "Furnish new private key" option and the JSON format along with "Enable Google Apps Domain-wide Delegation".
// - Save provided JSON in a SECURE location (don't include in your source code and ensure it's ignored by GIT)
// You can generate new keys and/or revoke this one at
rainabba /
Last active November 13, 2022 05:09
Building ffmpeg on AWS Linux AMI (G2 instance)

First, I should be clear that this was done on a G2 AWS instance and I started with working nvidia support by following

From that (or if you're feeling more bold), the thing to take is getting the right binary install package and running it. Look at and get the package you want (at the time, I'm using 'Latest Long Lived Branch version: 361.45.11'), then run the file you get. For example, sudo sh ./

I do not have time to test on a clean instance so you may need a bit more setup that I've not mentioned and I make no guarantees anyway since I hardly know what I'm doing here :)

The script was mostly copy/paste from the guide at and with significant help from folks on FreeNode #ffmpeg (notably furq and JEEB though there were others).

The steps for adding OpenCL headers support was borrowed

rainabba / gist:ba2a56dbfc64498c8c033a2615a2afe8
Created April 18, 2017 07:47
Windows Explorer search for GSHEET and GDOC remnants
View gist:ba2a56dbfc64498c8c033a2615a2afe8
name:~"*.docx.URL" OR name:~"*.doc.URL" OR name:~"*.gdoc" OR name:~"*.gsheet" OR name:~"*xlsx.URL" OR name:~"*.xls.URL"
rainabba / Promise-all.js
Created June 30, 2017 19:12
Promise.all() demonstration with iterations for refactoring
View Promise-all.js
// Wait for ALL promises to return OR any to crash and then return the array of values to the caller of .all()
// // //Itteration 1
// // function runParallelPromisesSum() {
// // //Our function returns its own promise with our value that needed both the promises to return first
// // return new Promise( ( resolveAll, rejectAll ) => {
// // let promise1 = new Promise( ( resolvePromise1, rejectPromise1 ) => {
// // console.log("resolving 1");
// // resolvePromise1( 1 );
rainabba /
Last active September 6, 2022 03:46
Install docker-ce, docker-compose and docker-sync in Ubuntu for WSL
#This script assumes very little other than a fresh Ubuntu install (using the Windows store) on Win10 1709 or newer with WSL installed already
#In Powershell, run the following to install WSL and Ubuntu
#Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
#Invoke-WebRequest -Uri -OutFile ~/ -UseBasicParsing
#Expand-Archive ~/ ~/Ubuntu
rainabba / pdfToImageTest.js
Created February 8, 2019 16:58
Testing common solutions to PDF -> image conversion
View pdfToImageTest.js
// SPOILER: Only 1 of these tests passes at this point and it bypasses
// all the fluff and complication so it's the one I will end up using
const { expect } = require('code'),
Lab = require('lab'),
lab = exports.lab = Lab.script(),
fs = require("fs"),
path = require("path"),
mkdirp = require('mkdirp'),
rimraf = require('rimraf'),