Skip to content

Instantly share code, notes, and snippets.

#
# Author:: Christopher Peplin (<peplin@bueda.com>)
# Copyright:: Copyright (c) 2010 Bueda, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
def to_hash_recursive(hash_thing)
new = {}
hash_thing.each do |k,v|
new[k] = v.kind_of?(Hash) ? to_hash(v) : v
end
new
end
@pcn
pcn / tmux.conf
Last active August 29, 2015 13:57 — forked from spicycode/tmux.conf
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys emacs
set -g history-limit 10000
setw -g mode-keys emacs
setw -g mode-mouse off
@pcn
pcn / .tmux.conf
Created March 11, 2014 04:50 — forked from snuggs/.tmux.conf
# SCREENSHOT EXAMPLE: http://grab.by/bzg3
##############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
require 'rbvmomi'
class KnifeVspherePlugin
def data=(cplugin_data)
@mac_address = cplugin_data
end
def reconfig_vm(target_vm)
if (!@mac_address)
abort ("MAC address not provided")
## Install necessary packages
$ sudo apt-get install virtualbox-ose qemu-utils genisoimage cloud-utils
## get kvm unloaded so virtualbox can load
$ sudo modprobe -r kvm_amd kvm_intel
$ sudo service virtualbox stop
$ sudo service virtualbox start
## URL to most recent cloud image of 12.04
$ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
This used to work on 2014.1.13 but fails on 2015.5.0 and 2015.5.2:
state init.sls file content:
{% set TEST_SYMLINK = '/opt/test_symlink' %}
{% if 0 == salt['cmd.retcode']('test -h '~ TEST_SYMLINK ~' ') %}
{{ TEST_SYMLINK }}:
file.symlink:
- target: /opt/yp
@pcn
pcn / gist:d4a9cd1ea42e6e02f5e1
Last active January 13, 2021 15:35 — forked from tbonza2/gist:20757551443a61254aa6
Saltstack mode for emacs

Saltstack mode for emacs

Earlier today I was looking for a Saltstack mode for emacs. Couldn't find one, so I posted the question on Stack overflow. Somebody had a good suggestion about using yaml-mode because a Sublime Text implementation appeared to be taking this approach.Another person thought that Saltstack's use of jinja templates would make an emacs mode easy enough to configure. These were both helpful ideas so I wanted to implement parts of each.

Reasoning

After looking around, I found that someone had configured an emacs mode for a similar situation. They needed to combine HTML and Python to use Mako templates for a project not involving Saltstack. Since Edx uses Mako t

@pcn
pcn / figwheel-emacs-cider.txt
Created October 27, 2015 04:24 — forked from auramo/figwheel-emacs-cider.txt
figwheel emacs cider stuff
## Using Emacs CIDER as the Figwheel REPL tool
project.clj should have this line:
```
:figwheel { :nrepl-port 7888 }
```
At the defproject-level.
It enables external tools to connect to the Figwheel REPL. To connect
@pcn
pcn / tableflip.sh
Last active December 29, 2015 19:59
tableflip.sh: for all your commandline table flipping needs
#!/bin/sh
flip() {
echo;
echo -en "( º_º) ┬─┬ \r"; sleep .2;
echo -en " ( º_º) ┬─┬ \r"; sleep .2;
echo -en " ( ºДº)┬─┬ \r"; sleep 1.2;
echo -en " (╯'Д')╯︵⊏ \r"; sleep .1;
echo -en " (╯'□')╯︵ ⊏ \r"; sleep .1;
echo " (╯°□°)╯︵ ┻━┻"; sleep .1;
}