Skip to content

Instantly share code, notes, and snippets.

View justinclayton's full-sized avatar

Justin Clayton justinclayton

View GitHub Profile
@lutter
lutter / README.md
Created June 25, 2014 12:17
Hook design document

Hooks

Hooks provide a way to be notified of certain events during the operation of the Razor server; the behavior of a hook is defined by a hook type.

File layout for a hook type

Similar to brokers and tasks, hook types are defined through a .hook directory and files within that directory:

@curator
curator / YAML.tmLanguage
Created June 26, 2014 22:18
Updated YAML that deals with hiera data a bit better (double colons)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>yaml</string>
<string>yml</string>
</array>
<key>foldingStartMarker</key>
#!/usr/bin/env ruby
require 'fileutils'
class VmList
@@cache_file = ENV['vm_list_cache_file'] || '/tmp/vm_list_cache'
@@cache_ttl = ENV['vm_list_cache_ttl'] || 60
def self.get_vm_list
vmware = %x{"/Applications/VMware\ Fusion.app/Contents/Library/vmrun" list | grep -v Total}.split("\n")
@matt-deboer
matt-deboer / Bakefile
Last active September 2, 2016 22:33
Bakefile to create a docker 1.12 swarm on OSX with docker-machine-driver-xhyve support
#!/bin/bash
set -u
#. creates a new swarm. params name, [driver], [workers], [managers]
create-swarm() {
bake_params name
local driver=${driver:=virtualbox}
local workers=${workers:=2}
local managers=${managers:=1}
@vStone
vStone / test.txt.erb
Created December 4, 2012 07:05
Puppet Template Headers
Original header used now:
### File managed with puppet ###
## Served by: '<%= scope.lookupvar('::servername') %>'
## Module: '<%= scope.to_hash['module_name'] %>'
## Template source: 'MODULES<%= template_source.gsub(Regexp.new("^#{Puppet::Node::Environment.current[:modulepath].gsub(':','|')}"),"") %>'
Problem: When using puppet apply with relative modulepath, the information can be wrong or messy.
Alternative 1:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.20784313976764679</real>
@zanedeg
zanedeg / aync.js
Created June 1, 2018 00:10
NodeJS async comparisons
'use strict';
const promisify = require('util').promisify;
const delay = (interval, cb) => {
console.log(`Waiting ${interval}s`);
setTimeout(() => cb(null, interval), interval);
}
const delayAsync = promisify(delay);
@stevschmid
stevschmid / api-doc.md
Created September 5, 2015 15:26
How the Track-o-Bot API works

Authentication

Access any profile page by providing the username and API key (generated in the settings -> API) , e.g. https://trackobot.com/profile/history.json?username=cool-ancient-tree-1337&token=fhyf238cv2eh879

JSON

Any profile page can be requested as JSON. Simply add .json at the end of the url (but before the query string which starts with ?), see example above.

Use the browser to see the JSON structure. JSONView is an excellent browser extension which shows JSON in a nice way.

@apolloclark
apolloclark / reverse-engineer a server build
Last active October 29, 2021 17:57
Audit Debian and Ubuntu servers
#!/usr/bin/env bash
# Script to reverse engineer the build of a given Debian / Ubuntu server
# I do this all the time: take an existing server, create a Bash / Ansible / Puppet / Chef
# built script, to allow Continuous Depoyment.
# It's tedious, but this script will give you the basics to get started.
# Make sure you have "sudo" access to get all the details.
# setup folders
@X0nic
X0nic / disable-vagrant-time-sync.sh
Last active February 4, 2022 04:52
Disable vagrant time sync
#List vms
VBoxManage list vms
#get status of time sync
VBoxManage getextradata <vm-name> VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled
#NOTE: Make sure to restart the VM after changing these settings.
#disable time sync
VBoxManage setextradata <vm-name> VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled 1