I hereby claim:
- I am cheaproc on github.
- I am cheaproc (https://keybase.io/cheaproc) on keybase.
- I have a public key whose fingerprint is FAAB 66AA 6EFC C1BE 3BDF 0824 5F4C C3B4 E2D1 4580
To claim this, I am signing this object:
:;exec emacs -batch -l "$0" -f nic-custom-self-install "$@" | |
;;; custom.el --- Nic's custom stuff for Emacs | |
;; Copyright (C) 2012 Nic Ferrier <nferrier@ferrier.me.uk> | |
;; Author: Nic Ferrier <nferrier@ferrier.me.uk> | |
;; Keywords: local | |
;; This program is free software; you can redistribute it and/or | |
;; modify it under the terms of the GNU General Public License |
I hereby claim:
To claim this, I am signing this object:
site "http://community.opscode.com/api/v1" | |
cookbook "apt" | |
cookbook "graphite" | |
cookbook "vim" | |
cookbook "statsd", | |
:git => "https://github.com/hectcastro/chef-statsd", | |
:ref => "v1.1.3" |
#!/bin/bash | |
# | |
# Check package.json and npm install after git checkout. | |
# Put this to .git/hooks/post-checkout | |
# | |
PREVIOUS_HEAD=$1 | |
NEW_HEAD=$2 | |
BRANCH_SWITCH=$3 |
This gist uses TK+Berkshelf to drive creating a vagrant virts and converging a simple recipe to install and configure NTPd. This is a simple cookbook that has one recipe, one template (for ntp.conf) and one attribute file. It works on Ubuntu 12.04 and CentOS 6.4 (and derviatives) and the attribute file is used to support both distros.
This should work on Mac (where I developed it) and any chef-supported Linux that you can get Vagrant onto (Ubuntu/CentOS).
Because I use ChefDK and Test Kitchen, I can largely ignore setting up Vagrant and Berkshelf and can get right to work on writing recipe code.
FROM ubuntu | |
RUN apt-get update | |
RUN apt-get install -y software-properties-common python-software-properties | |
RUN add-apt-repository -y ppa:brightbox/ruby-ng | |
RUN apt-get -y update | |
RUN apt-get install -y git ruby2.2 rake curl wget gcc make bison libssl-dev libcurl4-openssl-dev libpcre3 libpcre3-dev | |
WORKDIR /usr/local/src/ |
class ApplicationController < ActionController::Base | |
rescue_from PermissionDenied { |e| http_status_code(:forbidden, e) } | |
rescue_from AccountExpired { |e| http_status_code(:payment_required, e) } | |
def http_status_code(status, exception) | |
respond_to do |format| | |
self.response.headers["X-Exception"] = @exception = exception | |
format.html { render :template => "shared/status_#{status.to_s}", :status => status } | |
format.any { head status } |
#!/usr/bin/env ruby | |
# | |
# How to properly extend String and abstract in new functionality using the Proxy Pattern | |
# without overriding native Ruby primitives. | |
# | |
# [og](http://www.fngtps.com/2006/09/the-proxy-pattern-in-ruby) | |
# | |
require 'rubygems' | |
require 'bacon' |
begin | |
require 'capistrano_colors' | |
rescue LoadError | |
puts "Cannot load Capistrano Colors gem" | |
end | |
set :rails_env, ENV['rails_env'] || ENV['RAILS_ENV'] || 'beta' | |
set :extra_deploys, 'config/deployments/' | |
set :application, 'appname' |
require "benchmark" | |
Benchmark.bm(7) do |x| | |
x.report("#any?") { (0...1_000_000_000_000).any? {|n| break true if n > 999_999} } | |
x.report("#map") { (0...1_000_000_000_000).map {|n| break true if n > 999_999}.is_a?(TrueClass) } | |
x.report("#each") { (0...1_000_000_000_000).each {|n| break true if n > 999_999} } | |
end | |
user system total real | |
#any? 9.210000 3.300000 12.510000 ( 12.554455) | |
#map 9.290000 3.320000 12.610000 ( 12.672998) |