Skip to content

Instantly share code, notes, and snippets.

@jgillich
jgillich / ghost
Created October 18, 2013 18:01
Ghost service script for FreeBSD
#!/bin/sh
# PROVIDE: ghost
# KEYWORD: shutdown
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
. /etc/rc.subr
name="ghost"
rcvar=${name}_enable
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCxR6b5+s/Z4sMtSe0p23Vw8o8d7BCQdYy/PUuUloCVArz8A1wx37yOn5Rd1CtS7uGXQYQv1XtEexXv9bSqNHeTcr//ie0R/QVSXilMRlmYH92lXOGwnAaaylgiZ5de8TQ609maiZkAuyMJONRkOhFmGxnKn6VShRS30Dwrsz7zyF5eOyOhMdRPZdrSzPt8MU23OuBfVwhL1gcbAYZP/ujvqgNzv1ba31L+eRnryWaJXpI1D3N21hjVNlZlM3/P5HjpzEDobl+lH0xNtt8bPGQYErNf3jmypRLbzdBiDEa/nNC/22TWCjHeUAlfAqU26ZHPoV3//C08e/5CF9hILok3 jakob@gillich.me
@jgillich
jgillich / handlebars.localisation.js
Last active January 4, 2016 16:49
Handlebars localisation helper, inspired by https://gist.github.com/tracend/3261055
Handlebars.registerHelper('loc', function(keyword) {
var lang = navigator.language || navigator.userLanguage;
// If lang is not found, try without subtag and fall back to en
lang = locale[lang] || (lang.indexOf('-') !== -1 && locale[lang.split('-')[0]]) || locale['en'] ;
return lang && _.template('<%= ' + keyword + ' %>', lang) || keyword;
/* without underscore
var keys = keyword.split(".");
for (var i in keys) {
@jgillich
jgillich / js.py
Last active August 29, 2015 14:05
# -*- coding: utf-8 -*-
'''
JavaScript Renderer for Salt
Example SLS file:
#!js
module.exports.wget = function () {
return { pkg: ['installed'] };
# yum update
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 26 kB 00:00:00
epel | 3.7 kB 00:00:00
extras | 3.3 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/6): base/7/x86_64/group_gz | 157 kB 00:00:00
(2/6): epel/x86_64/group_gz | 163 kB 00:00:00
updates/7/x86_64/primary_db FAILED
# API Usage
RatticDB include an API that you an use to programatically acces the data you have stored. Currently the API only supports read access for credential, however we expect this to change at time progresses.
## Authentication
To authenticate to RatticDB you can choose to use either session authentication, or API Key authentication. Sessions keys require a user to have logged in with their username, password and if configured their one time pad device. API keys on the other hand are static values that are designed for systems that may not have interactive access.
To use the session based authentication simply use your browser to log into RatticDB and then browse to the API endpoints. Because the Accept header cannot usually be controlled in most web browsers you need to provide a hint as to the format of the request via the query string. So for example if you wanted to hit the `/api/v1/cred/1/` endpoint and get JSON data returned you would append `?format=json` which would make the URL be `/api/v1/
sudo yum install http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm
sudo yum install @development qemu qemu-kvm libvirt libvirt-python wget man python-pip sqlite-devel libxml2-python libxml2-devel libxslt-devel
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
sudo echo '[Remote libvirt SSH access]
Identity=unix-user:virtkick
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
@jgillich
jgillich / rendering_hack.rb
Created October 12, 2015 16:02
Hack for Middleman, allows usage of erb in markdown files without the .erb extension.
module Middleman
module CoreExtensions
module Rendering
# Rendering instance methods
module InstanceMethods
def _render_with_all_renderers(path, locs, context, opts, &block)
# Keep rendering template until we've used up all extensions. This
# handles cases like `style.css.sass.erb`
content = nil
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
index 79e4366..aa90c23 100644
--- a/pkgs/build-support/rust/default.nix
+++ b/pkgs/build-support/rust/default.nix
@@ -26,6 +26,8 @@ in stdenv.mkDerivation (args // {
configurePhase = args.configurePhase or "true";
+ unpackPhase = args.unpackPhase or "unpackPhase";
+
<!DOCTYPE html>
<html>
<body>
<div id="terminal"
style="position:relative; width:100%; height:500px"></div>
</body>
<script src="hterm_all.js"></script>
<script>
hterm.defaultStorage = new lib.Storage.Local()