Skip to content

Instantly share code, notes, and snippets.

Michael Richardson rainabba

Block or report user

Report or block rainabba

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rainabba
rainabba / pdfToImageTest.js
Created Feb 8, 2019
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'),
@rainabba
rainabba / config-docker.sh
Last active Sep 10, 2019
Install docker-ce, docker-compose and docker-sync in Ubuntu for WSL
View config-docker.sh
#!/bin/bash
#
#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 https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.zip -UseBasicParsing
#Expand-Archive ~/Ubuntu.zip ~/Ubuntu
#~/Ubuntu/ubuntu.exe
#
@rainabba
rainabba / Promise-all.js
Created Jun 30, 2017
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
rainabba / gist:ba2a56dbfc64498c8c033a2615a2afe8
Created Apr 18, 2017
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
rainabba / README.md
Last active Aug 27, 2017
Building ffmpeg on AWS Linux AMI (G2 instance)
View README.md

First, I should be clear that this was done on a G2 AWS instance and I started with working nvidia support by following http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cluster_computing.html

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 http://www.nvidia.com/object/unix.html 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 ./NVIDIA-Linux-x86_64-361.45.11.run.

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 ffmpeg_build.sh script was mostly copy/paste from the guide at https://trac.ffmpeg.org/wiki/CompilationGuide/Centos 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
rainabba / saveToDrive.js
Created Dec 30, 2015
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 https://console.developers.google.com/apis/api/drive/overview
// - Enable API with your options (not sure they matter much, but API must be enabled)
// - Visit https://console.developers.google.com/permissions/serviceaccounts
// - 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 https://console.developers.google.com/apis/credentials
@rainabba
rainabba / testdeferredpromise.html
Last active Sep 23, 2015
Example and differences for A+ Promise using Resolve/Reject and a Bluebird promisify wrapper
View testdeferredpromise.html
<html>
<head>
<script src="https://www.promisejs.org/polyfills/promise-7.0.1.min.js"></script>
<script src="http://requirejs.org/docs/release/2.1.2/minified/require.js"></script>
</head>
<body>
<h1>Open the console</h1>
<script>
@rainabba
rainabba / drive-api-test
Last active May 9, 2018
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 );
View gist:3f4fe16cc40bf98b2272
// Simplified version of what I found at http://dashburst.com/how-to-add-google-comments-to-any-webpage-or-blog-unofficially/
// This assumes jQuery support as $
<script src="https://apis.google.com/js/plusone.js"></script>
<div id="commentscounter"></div>
<div id="gpcomments"></div>
<script>
$(function() {
gapi.comments.render('gpcomments', { href: window.location, first_party_property: 'BLOGGER', view_type: 'FILTERED_POSTMOD' });
gapi.commentcount.render('commentscounter', { href: window.location });
@rainabba
rainabba / gist:9996443
Created Apr 5, 2014
WKHTMLTOPDF 1.12 using Google-Hosted .woff (Roboto)
View gist:9996443
<html>
<head>
<title>WKHTMLTOPDF Font Test</title>
<style>
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(http://themes.googleusercontent.com/static/fonts/roboto/v10/vzIUHo9z-oJ4WgkpPOtg1_esZW2xOQ-xsNqO47m55DA.woff) format('woff');
}
You can’t perform that action at this time.