Skip to content

Instantly share code, notes, and snippets.

(defn move-hex
[point direction]
(case direction
:ne [(inc (point 0)) (dec (point 1))]
:se [(inc (point 0)) (point 1)]
:s [(point 0) (inc (point 1))]
:sw [(dec (point 0)) (inc (point 1))]
:nw [(dec (point 0)) (point 1)]
:n [(point 0) (dec (point 1))]))
@types.set(image=types.ImageResourceType,
flavor=types.FlavorResourceType)
@validation.image_valid_on_flavor("flavor", "image")
@validation.required_services(consts.Service.NOVA)
@validation.required_openstack(users=True)
@scenario.configure(context={"cleanup": ["nova"]})
def boot_and_get_console_output(self, image, flavor,
length=None, **kwargs):
"""Get text console output from server.
@zeroDivisible
zeroDivisible / file.md
Created September 25, 2014 20:09
Local Checking out of pull requests.

Adding this snippet to your .git/config file:

[alias]
	giveme = "!sh -c 'git fetch origin refs/pull/$1/head && git checkout -b pull/$1 FETCH_HEAD' -"

allows you to run:

["redis-brain.coffee", "shipit.coffee", "9gag.coffee", "animal.coffee", "ascii.coffee", "calm-down.coffee", "cowsay.coffee", "devexcuse.coffee", "futurama.coffee", "gangnam.coffee", "hashing.coffee", "grumpycat.coffee", "gifbin.coffee", "go-for-it.coffee", "haters.coffee", "hello.coffee", "howdoi.coffee", "insult.coffee", "plusplus.coffee", "sloth-me.coffee", "stock.coffee", "thanks-obama.coffee", "url.coffee", "wat.coffee", "commitmessage.coffee","complete.coffee", "clojure.coffee","chat.coffee","brb.coffee", "sensitive.coffee"]
["redis-brain.coffee", "shipit.coffee", "9gag.coffee", "animal.coffee", "ascii.coffee", "calm-down.coffee", "cowsay.coffee", "devexcuse.coffee", "futurama.coffee", "gangnam.coffee", "hashing.coffee", "grumpycat.coffee", "gifbin.coffee", "go-for-it.coffee", "haters.coffee", "hello.coffee", "howdoi.coffee", "insult.coffee", "plusplus.coffee", "sloth-me.coffee", "stock.coffee", "thanks-obama.coffee", "url.coffee", "wat.coffee"]
@zeroDivisible
zeroDivisible / file.md
Created February 5, 2014 22:28
Error - trustAnchors parameter must be non-empty

Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

There’s a simple fix, just link in the same cacerts file that Apple’s JDK 1.6 uses:

cd $(/usr/libexec/java_home -v 1.7)/jre/lib/security
ln -fsh /System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security/cacerts
@zeroDivisible
zeroDivisible / gist:8520427
Created January 20, 2014 14:04
how to get node IP address from within .erb file using chef and vagrant
node[:network][:interfaces][:eth1][:addresses].detect{|k,v| v[:family] == "inet" }.first

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'json'
Vagrant.configure("2") do |config|
config.vm.box = "devvm-centos6.4"
ACTIVEMQ_HOME = '/usr/local/'
# default configuration for the machines, instead of being kept in this file, is saved somewhere
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static