Skip to content

Instantly share code, notes, and snippets.

@joewilliams
joewilliams / async_nif.h
Created December 10, 2012 20:48 — forked from gburd/async_nif.h
Technique for running Erlang NIFs functions asynchronously, not on scheduler threads.
/*
*
* async_nif: An async thread-pool layer for Erlang's NIF API
*
* Copyright (c) 2012 Basho Technologies, Inc. All Rights Reserved.
* Author: Gregory Burd <greg@basho.com> <greg@burd.me>
*
* This file is provided to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain
@joewilliams
joewilliams / sudo.sh
Created November 12, 2012 19:23 — forked from boorad/sudo.sh
sudo to sesudo
#!/bin/bash
declare -a args
while [ $# -gt 0 ] ; do
case "$1" in
-n) shift ;;
*) args=("${args[@]}" "$1") ; shift ;;
esac
done
{
"id": "0123456789abcdef",
"name": "myname",
"provider": "puppet",
"role": "some_identifier_from_cm_system_can_be_nil?",
"timestamp": 1290616560,
"provisioned": "true",
"os": {
"name": "linux",
"version": "2.6.35-22-generic",
require 'ostruct'
UFW_SECTIONS = [:ufw_new_resource, :ufw_protocol, :ufw_src_addr, :ufw_src_port, :ufw_dest_addr, :ufw_dest_port]
def build_cmd
UFW_SECTIONS.collect{ |action| self.send(action)}.join(" ")
end
def ufw_new_resource
"ufw #{new_resource.action}"
#
# Cookbook Name:: heartbeat
# Attributes:: heartbeat
#
# Copyright 2008, Wikia, Inc.
#
# 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
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Adam Jacob (<adam@opscode.com>)
#
# Copyright:: 2009, Opscode, Inc
#
# 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
#!/bin/bash
# 1st install Apple's XCode (dev tools, gcc, etc)
# Then... Setup
cat >$HOME/.bash_profile <<\THEEND
export PATH=$HOME/bin:/opt/local/bin:$PATH
export MANPATH=$HOME/man:/opt/local/man:$MANPATH
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion