Skip to content

Instantly share code, notes, and snippets.

View retrohacker's full-sized avatar

William Blankenship retrohacker

View GitHub Profile
@retrohacker
retrohacker / dockeri.co
Created March 31, 2015 19:06
Example Debian init.d file for Docker
#!/bin/sh
### BEGIN INIT INFO
# Provides: dockerico
# Required-Start: docker
# Required-Stop: docker
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: A badging service for the docker registry.
# Description:
@retrohacker
retrohacker / getTags.js
Created June 3, 2016 04:39
Get Tags of Docker Image
#!/usr/bin/env nodejs
/*****************
* Bring in deps *
*****************/
var request = require('request')
var async = require('async')
/***************************
### Keybase proof
I hereby claim:
* I am retrohacker on github.
* I am retrohacker (https://keybase.io/retrohacker) on keybase.
* I have a public key ASBV4vwsEVtKRg2DmXkhKUZ1KUOsyCNIdwsOSgs2xdfV1Ao
To claim this, I am signing this object:
@retrohacker
retrohacker / config.json
Created March 30, 2017 18:01
storj-fuse
{
"privateKey": "[PRIVATE_KEY]",
"publicKey": "[PUBLIC_KEY]",
"encryptionKey": "[ENCRYPTION_KEY]"
}
@retrohacker
retrohacker / async-order.js
Last active April 17, 2017 21:38
async-order
function loadFile() { // 1
fs.readFile('./foobar.txt', 'utf8', saveFile); // 5
}
function saveFile(e, contents) { // 2
if(e) { // 6
// Stop executing function, we encountered an error
return console.error(e); // 7
} // 8
fs.saveFile('./buzzbazz.txt', 'utf8', done); // 9
@retrohacker
retrohacker / solarized_mocha
Created January 24, 2019 21:53
Make all mocha dependencies in your project solarized friendly
#!/bin/bash
# Save this in your path as `solarized_mocha` and then run `solarized_mocha` in the root of your project
find . -name mocha -type d | xargs -I{} sed -i 's|\(.*:\) 90|\1 92|g' {}/mocha.js {}/lib/reporters/base.js
@retrohacker
retrohacker / compress.sh
Last active August 21, 2019 00:54
Using patch files for storing the npm registry
#!/bin/bash
# Remove anything that may have been left over by a previous run
rm -rf patch orig new
mkdir patch
for TARBALL in `ls - | node semver-sort.js`
do
tar -xzf "./-/${TARBALL}"
@retrohacker
retrohacker / index.js
Created February 6, 2020 18:00
Modify a tarball's header content
const fs = require('fs');
const Header = require('tar/lib/header');
const fd = fs.openSync('./service.tar', 'r+');
const childProcess = require('child_process');
const args = require('yargs')
.option('u', {
alias: 'user',
demandOption: true,
describe: 'the user to set permission bits to',
@retrohacker
retrohacker / index.test.js
Created July 21, 2020 20:16
power-assert with tape output
const test = require('ava')
test('Should render power-assert', async t => {
const three = 3;
const x = [1,2,3]
t.assert(x.length > three, 'rendering power-assert')
})
@retrohacker
retrohacker / main.js
Last active June 2, 2022 18:19
Handling dynamic content with greasemonkey
// ==UserScript==
// @name Apply rules to dynamically loaded content
// @version 1
// @grant none
// ==/UserScript==
// Create a new mutation observer
const observer = new window.MutationObserver(() => {
// Apply your rules here