Skip to content

Instantly share code, notes, and snippets.

View greyarch's full-sized avatar

Greyarch BV greyarch

View GitHub Profile

Keybase proof

I hereby claim:

  • I am greyarch on github.
  • I am gantcho (https://keybase.io/gantcho) on keybase.
  • I have a public key ASANroBVM3WgnLXfuxyN3vEM1BUoc2K1C-4TCxaDN-cTTwo

To claim this, I am signing this object:

@greyarch
greyarch / gist:7e3a21d8fee2a063324225f87a21d186
Created April 9, 2018 13:28
Hetzner docker install user data (cloud-init script) for CentOS
#cloud-config
repo_update: true
repo_upgrade: all
runcmd:
- [ sh, -c, "yum install -y yum-utils device-mapper-persistent-data lvm2" ]
- [ sh, -c, "yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo"]
- [ sh, -c, "yum install -y docker-ce"]
- [ sh, -c, "systemctl enable docker"]
- [ sh, -c, "systemctl start docker"]
@greyarch
greyarch / app.cljs
Last active February 7, 2017 11:30
cljs reagent firebase
(ns try-clojure.app
(:require
[try-clojure.db :as db]
[try-clojure.ui :as ui]
[reagent.core :as r]))
(enable-console-print!)
(defonce root (db/connect "https://try-clojure.firebaseio.com/counter"))
(defonce state (db/sync (atom {}) root []))
eventData =
prop1:
attr1: 1
attr2: "something"
prop2:
attr1: true
tpl.$("div").trigger $.Event('custom-event', eventData)
#!/bin/bash
JQPATH=$(which jq)
if [ "x$JQPATH" == "x" ]; then
echo "Couldn't find jq executable." 1>&2
exit 2
fi
set -eu
shopt -s nullglob
@greyarch
greyarch / ko-persist.js
Created June 20, 2013 19:44
Knockout persistence to localStorage. This is a very simple way to persist the value of a knockout observable to local storage. Every time you set the value of the observable it is also stored in the localStorage. You can indeed use this mechanism with any storage system.
ko.extenders.persist = function (target, option) {
target.subscribe(function (newValue) {
window.localStorage.setItem(option, newValue);
});
return target;
};
//and use it like this:
var item = ko.observable().extend({persist:"storedItem"});