Skip to content

Instantly share code, notes, and snippets.

@maxlinc
maxlinc / use-go
Last active December 20, 2015 02:39
use-go ci-addon for cloudbees
#!/bin/bash
if [[ -z $GOLANG_VERSION ]]; then
GOLANG_VERSION=1.1.1
echo "No version provided for go, will use the last one: $GOLANG_VERSION" 1>&2
fi
set -e
ARCH=`uname -m`
@maxlinc
maxlinc / spec_helper.rb
Created August 29, 2013 19:57
rspec puppet debugging
RSpec.configure do |conf|
conf.module_path = File.join(fixture_path, 'modules')
conf.manifest_dir = File.join(fixture_path, 'manifests')
conf.hiera_config = File.join(fixture_path, 'hiera.yaml')
end
# Not sure this works for all types of https://github.com/rodjek/rspec-puppet tests. I think it works with host tests
if ENV['PUPPET_DEBUG']
Puppet::Util::Log.level = :debug
Puppet::Util::Log.newdestination(:console)
@maxlinc
maxlinc / spec_helper.rb
Created October 29, 2013 00:20
VCR to Pacto
def vcr_to_pacto_request vcr_request
uri = URI(vcr_request.uri)
definition = {
'method' => vcr_request.method,
'path' => uri.path,
# How do we get params from VCR?
'params' => {},
'headers' => vcr_request.headers
}
Pacto::Request.new uri.host, definition
@maxlinc
maxlinc / search.rb
Created March 12, 2014 21:04
Check for trailing blank lines
Dir['**/*.rb'].each do |f|
begin
puts f unless File.read(f) =~ /^$\Z/
rescue => e
$stderr.puts "Couldn't read #{f}: #{e.message}"
end
end
@maxlinc
maxlinc / Gemfile
Created April 1, 2014 21:16
Using vagrant-rackspace and vagrant-aws together
# If you just do:
# $ vagrant plugin install vagrant-aws
# $ vagrant plugin install vagrant-rackspace
# $ vagrant plugin list
# Then it will downgrade vagrant-aws to 0.0.1 (rather than downgrading fog)
# A sample Gemfile
source "https://rubygems.org"
group :plugins do
@maxlinc
maxlinc / Gemfile
Last active August 29, 2015 13:58
DOAPLite - Extract a simplified YAML version of DOAP (Description of a Project) from RDF or GitHub. Useful for static site generators like Jekyll or other places where full RDF queries aren't practical
source "http://rubygems.org"
group :development do
gem 'jekyll', '~> 1.5.0'
gem 'stringex', '~> 1.4.0'
gem 'rake'
end
group :semantic_web do
# rdf-raptor requires libraptor
@maxlinc
maxlinc / Vagrantfile
Last active August 29, 2015 14:00
Proposed Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
@maxlinc
maxlinc / android_lexer.rb
Created May 8, 2014 04:48
Workaround for java vs android in slate
require 'rouge'
module Rouge
module Lexers
class Android < Rouge::Lexers::Java
tag 'android'
end
end
end
@maxlinc
maxlinc / dash_property_handler.rb
Last active August 29, 2015 14:01
Start of a Hashie::Dash yard extension?
# Usage: `yardoc -e dash_property_handler.rb lib/**/*.rb`
class DashPropertyHandler < YARD::Handlers::Ruby::AttributeHandler
handles method_call(:property)
namespace_only
def process
name = statement.parameters.first.jump(:tstring_literal, :ident).source
scope = :instance
namespace.attributes[scope][name] ||= SymbolHash[:read => nil, :write => nil]
o = YARD::CodeObjects::MethodObject.new(namespace, name)
@maxlinc
maxlinc / broken_spec.rb
Created May 30, 2014 20:49
unexpected token tNL
# You'll receive "E: unexpected token tNL" if you run rubocop broken_spec.rb
module A
module B
class C
end
end
end
module A
module B do