Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
import "Organisation.sol";
import "TokenLedger.sol";
import "EternalStorage.sol";
contract Parent {
event OrganisationCreated(address organisation, uint now);
event OrganisationUpgraded(address organisation, uint now);
mapping(bytes32 => address) public organisations;
@cicorias
cicorias / tmux.md
Created March 20, 2017 19:11 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@cicorias
cicorias / Dockerfile
Created March 27, 2017 19:04 — forked from christianberg/Dockerfile
Sharing a unix socket between a Docker container and it's host
FROM ubuntu
RUN apt-get update
RUN apt-get install -y socat
VOLUME /foo
CMD socat UNIX-LISTEN:/foo/bar.sock -
@cicorias
cicorias / alternate.sh
Last active March 30, 2017 15:40 — forked from madis/gist:4650014
Testing CORS OPTIONS request with curl
curl -H "Origin: http://example.com" \
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: X-Requested-With" \
-X OPTIONS --verbose \
http://localhost:8545
@cicorias
cicorias / Object Flatten
Created March 30, 2017 21:56 — forked from penguinboy/Object Flatten
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;
@cicorias
cicorias / static_server.js
Created May 21, 2017 03:26 — forked from amejiarosario/static_server.js
Node.js quick file server (static files over HTTP) using es6+
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');
const port = process.argv[2] || 9000;
http.createServer(function (req, res) {
console.log(`${req.method} ${req.url}`);
// parse URL
@cicorias
cicorias / azuredeploy.json
Created May 28, 2017 16:18 — forked from christopheranderson/azuredeploy.json
Function App ARM template with MSDeploy
{
"$schema": "http://schemas.management.azure.com/schemas/2015-01-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appName": {
"type": "string",
"metadata": {
"description": "The name of the function app that you wish to create."
}
},
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"eventHubName": {
"type": "string"
}
},
"variables": {
"resourceLocation": "[resourceGroup().location]",
@cicorias
cicorias / expbackoff.sh
Created June 14, 2017 17:28 — forked from nathforge/expbackoff.sh
Exponential backoff in Bash
expbackoff() {
# Exponential backoff: retries a command upon failure, scaling up the delay between retries.
# Example: "expbackoff my_command --with --some --args --maybe"
local MAX_RETRIES=${EXPBACKOFF_MAX_RETRIES:-8} # Max number of retries
local BASE=${EXPBACKOFF_BASE:-1} # Base value for backoff calculation
local MAX=${EXPBACKOFF_MAX:-300} # Max value for backoff calculation
local FAILURES=0
while ! "$@"; do
FAILURES=$(( $FAILURES + 1 ))
if (( $FAILURES > $MAX_RETRIES )); then