Skip to content

Instantly share code, notes, and snippets.

@diurnalist
diurnalist / easy_install.sh
Created July 16, 2019 20:43
Easy-install of Chameleon CLI tools (requires auth)
#!/usr/bin/env bash
version="${1:-master}"
tmp_dir="$(mktemp -d)"
repo="https://github.com/ChameleonCloud/climeleon"
install_dir="${CC_INSTALL_PATH:-/usr/local/bin}"
cleanup() {
rm -rf "$tmp_dir"
}
@diurnalist
diurnalist / keybase.md
Created June 29, 2018 16:45
Proof of Keybase identity

Keybase proof

I hereby claim:

  • I am diurnalist on github.
  • I am diurnalist (https://keybase.io/diurnalist) on keybase.
  • I have a public key ASBMcxWpQFXGhNU0nbhulKMKRfw-fzKoJJ-hmbtkl_42sAo

To claim this, I am signing this object:

@diurnalist
diurnalist / kibana-dashboard
Last active July 28, 2017 13:39
Generate links for Kibana4 dashboards. Requires `ipcalc` to expand CIDRs. Set KIBANA_HOST and KIBANA_DASHBOARD accordingly.
#!/bin/bash
set -eu -o pipefail
kibanaBaseUrl="$KIBANA_HOST/app/kibana?#/dashboard/$KIBANA_DASHBOARD"
kibanaGlobalParams="_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-1h,mode:quick,to:now))"
type="${1:-}"
shift
usage() {
@diurnalist
diurnalist / ynab-convert.sh
Last active April 2, 2017 14:40
YNAB4 CSV Conversion Script
#!/usr/bin/env bash
set -e -u -o pipefail
fileType="$1"
file="$2"
case "$fileType" in
deutsche-bank)
# CSV Columns:
# 1 = Booking date
@diurnalist
diurnalist / gzip-css-bench.js
Last active August 29, 2015 14:14
Effects of GZip Compression on Randomly-generated CSS Sheets
#!/env/node
/**
* Measure the effect of "bloat" (repeated property chunks in a stylesheet, as might
* be introduced by a preprocessor and @mixin directives) in a randomly generated
* style sheet. Uses a small pool of property names and possible values for the purposes
* of the benchmark. Can configure the "bloat" factor by tweaking DUPE_FACTOR. That
* factor determines what % of the rules generated will be treated as repeatable,
* mixin-like rules.
*
@diurnalist
diurnalist / gist:2364744
Created April 12, 2012 05:14
Simple JS Multiton/Factory
var Multiton = (function() {
var _instances = {},
_products, _default;
function create_instance(name) {
var prefix = 'Product_',
product_name;
product_name = prefix + name.slice(0, 1).toUpperCase() + name.substring(1);
if (typeof _products[product_name] === 'function') {
@diurnalist
diurnalist / gist:2364711
Created April 12, 2012 05:07
Lightweight Relation Modeling with Backbone (7)
album.bind('trackList:change:name', function(track) { ... });
@diurnalist
diurnalist / gist:2364707
Created April 12, 2012 05:06
Lightweight Relation Modeling with Backbone (6)
var Track = Backbone.Model.extend(),
TrackList = Backbone.Collection.extend({
model: Track
}),
Album = Backbone.RelationalModel.extend({
relations: {
trackList: TrackList
}
});​
@diurnalist
diurnalist / gist:2364703
Created April 12, 2012 05:05
Lightweight Relation Modeling with Backbone (5)
function delegateModelEvents(from, to, eventKey) {
from.bind('all', function(eventName) {
var args = _.toArray(arguments);
if (eventKey) {
args[0] = eventKey + ':' + args[0];
}
to.trigger.apply(to, args);
});
}
@diurnalist
diurnalist / gist:2364701
Created April 12, 2012 05:05
Lightweight Relation Modeling with Backbone (4)
{
"album_id": "1",
"name": "My Track",
"duration": 3600,
"streamUrl": "http://example.com/stream.mp3"
}​