This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypt = require('crypto'); | |
const fs = require('fs').promises; | |
const aws = require('aws-sdk'); | |
async function uploadFileToS3WithMd5Hash(bucket, filename, s3Key = null) { | |
const data = await fs.readFile(filename); | |
const md5Base64 = crypt.createHash("md5").update(data).digest('base64'); | |
if (!s3Key) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
### http://docs.pimoroni.com/scrollphat | |
from collections import namedtuple | |
import json | |
import os | |
import sys | |
import time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def postgres_url() | |
postgres_str = `docker-compose port postgres 5432`.strip | |
return "postgres://postgres:postgres@#{postgres_str}/postgres" | |
end | |
desc "Run initial setups needed to get service running locally (also runs all setup_x tasks)" | |
task :setup => [:start_doc, :setup_db] | |
desc "Start docker-compose in background" | |
task :start_doc do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########## C O N F I G ########## | |
DOCKER_HOST_NAME=localhost | |
################################# | |
cmd="curl $@" | |
service_name=`echo $cmd | sed -n 's/.* \([a-zA-Z0-9_][a-zA-Z0-9_]*\)\/.*/\1/p'` | |
row=`docker-compose ps |grep _${service_name}_1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.whenAll = function (deferreds) { | |
function isPromise(fn) { | |
return fn && typeof fn.then === 'function' && | |
String($.Deferred().then) === String(fn.then); | |
} | |
var d = $.Deferred(), | |
keys = Object.keys(deferreds), | |
args = keys.map(function (k) { | |
return $.Deferred(function (d) { | |
var fn = deferreds[k]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# remove existing 9.1 installation | |
sudo /etc/init.d/postgresql stop | |
sudo apt-get --force-yes -fuy remove --purge postgresql postgresql-9.1 postgresql-client | |
# install zip | |
sudo apt-get install -y zip | |
# install 9.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get update | |
apt-get -y upgrade | |
apt-get -y install vim | |
# edit /etc/vim/vimrc to enable syntax, dark mode etc... | |
# edit ~/.bashrc for added aliases... | |
alias lh='ls -lh' | |
alias lah='ls -lAh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== TEST SETUPS === | |
t.plan(x) // Expect x asserts. If less, test will timeout, if more, test fails | |
t.end() // End test if not t.plan() is used | |
t.fail('fail test with this description') | |
t.bailout("en test right here. No more to run") | |
// t.bailsOut() wraps a child test and succeeds if it calls bailout() | |
t.bailsOut(t.test("this should bailout", function (t) { | |
t.bailout("oh noes, bailing out!") | |
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
a = !git add . && git status | |
amend = commit --amend -C HEAD | |
ap = !git add -p && git status | |
au = !git add -u && git status | |
b = branch | |
ba = branch --all | |
bi = for-each-ref --sort=-committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset)) - %(color:magenta dim)%(contents:subject)%(color:reset)' | |
c = commit | |
ch = checkout |