Skip to content

Instantly share code, notes, and snippets.

View andreacampi's full-sized avatar

Andrea Campi andreacampi

  • Apple, inc
  • London, UK
View GitHub Profile
### Keybase proof
I hereby claim:
* I am andreacampi on github.
* I am andreacampi (https://keybase.io/andreacampi) on keybase.
* I have a public key ASBWkg3aHfzFAQ2tgp6iZ21y4I3IJefEHs3YssI8mdQkTAo
To claim this, I am signing this object:

Devops is all about making us more productive, right? So here's my current workflow to upload and test a Chef cookbook:

  • edit in Textmate
  • go to the browser and load the web page for the Juniper VPN
  • enter my username
  • enter my 4-digits PIN + 6-digits token from the RSA thingie (assuming I have it with me)
  • wait for the page to load
  • click on a "start VPN" button
  • wait for it to load
  • upload my changes
before_symlink do
new_resource = @new_resource
Chef::Log.info "release path: #{new_resource.release_path}"
end
@andreacampi
andreacampi / start.sh output
Created February 3, 2013 16:17
bookshelf start.sh
[andrea@localhost bookshelf (master)]$ ./start.sh
Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]
=PROGRESS REPORT==== 3-Feb-2013::17:13:42 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.34.0>},
{name,alarm_handler},
{mfargs,{alarm_handler,start_link,[]}},
{restart_type,permanent},
[2013-01-17T11:36:09+00:00] DEBUG: Converging node US15
[2013-01-17T11:36:09+00:00] DEBUG: Saving the current state of node US15
[2013-01-17T11:36:09+00:00] DEBUG: Signing the request as US15
[2013-01-17T11:36:09+00:00] DEBUG: String to sign: 'Method:PUT
Hashed Path:wu79aiW5QknMNapv0l6iz/Rqj38=
X-Ops-Content-Hash:2uYa0YsKiDG4OLMEwoLNL5pFsOE=
X-Ops-Timestamp:2013-01-17T11:36:09Z
X-Ops-UserId:US15'
Header hash: {"X-Ops-Sign"=>"algorithm=sha1;version=1.0;", "X-Ops-Userid"=>"US15", "X-Ops-Timestamp"=>"2013-01-17T11:36:09Z", "X-Ops-Content-Hash"=>"2uYa0YsKiDG4OLMEwoLNL5pFsOE=", "X-Ops-Authorization-1"=>"BnUU05ITt9qM5351YMh5KK2eZhEK7s707rBUEDyDV1gUh1LVEwsDgVAWH7jo", "X-Ops-Authorization-2"=>"r41GCcqzZaV7pP6xUKcsWhRz2xQU58NdVuFTFPeKN6zuUlC0EyB1KqNT/PZE", "X-Ops-Authorization-3"=>"tb55SI9p6x/BjcDCuidDYvSpxw0cwmVeUPy/3WDLhgaXYw+NJPIvCU1zz/C9", "X-Ops-Authorization-4"=>"AllMn7ndTx+ehakcG6FgTrfvtZ7qgnk9M1RBRq9kApFnroiJpQ/4ioQmwbrV", "X-Ops-Authorization-5"=>"SMI+Gvs2ID2BvtKynBL9oZfUDArfZCALxxf90o9nllQIRlzOwNJZ84/+pmNy",
@andreacampi
andreacampi / cluster_test.rb
Created November 30, 2012 12:40
ClusterTest
require 'chef-workflow/helper'
class ClusterTest < MiniTest::Unit::VagrantTestCase
def setup
provision('cluster-db', 2)
provision('cluster-app', 2, ['cluster-db'])
end
def teardown
@andreacampi
andreacampi / consume_json.rb
Created September 28, 2012 21:31
cookbooks/consume_json/libraries/consume_json.rb
class Chef
module Mixin
module ConsumeJson
def consume_json(url)
Chef::Log.debug "consume_json: requesting url: #{url}"
info = nil
fetch(url) do |data|
info = JSON.parse(data)
Chef::Log.debug "consume_json: parsed: #{info.inspect}"
<figure class="zoomable">
<div data-sizes="fallback">
<img src="img/01-2.png" alt="Marley’s Ghost" />
<p class="caption">This is the top of the article editing window, where you can fill in all of the fields that identify your article. From here, among other things, you can choose which layout your article should appear on, add an excerpt and thumbnails to be used in the Table of Contents, and choose or establish a section for your article.</p>
</div>
<div data-sizes="lightbox" class="no-treesaver">
<img src="img/01-2.png" alt="Marley’s Ghost" />
<p class="caption">This is the top of the article editing window, where you can fill in all of the fields that identify your article. From here, among other things, you can choose which layout your article should appear on, add an excerpt and thumbnails to be used in the Table of Contents, and choose or establish a section for your article.</p>
</div>
</figure>
@andreacampi
andreacampi / node_list_all.rb
Created July 20, 2012 06:27
knife node list all
require 'chef/knife'
module Example
class Knife
class NodeListAll < Chef::Knife::NodeList
deps do
require 'chef/knife/node_list'
end
<div class="grid front w9 odd page-1"><div data-ts-template="document">
<div class="container title w6" data-sizes="title"></div>
<div class="container c1 w9" data-sizes="triple"></div>
<div class="column c1"></div>
<div class="column c4"></div>
<div class="column c7"></div>
</div></div>