Skip to content

Instantly share code, notes, and snippets.

View codec's full-sized avatar

codec

  • Munich
  • 15:51 (UTC +01:00)
View GitHub Profile
#!/usr/bin/ruby
require 'webrick'
require 'json'
req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
req.parse(STDIN)
json_payload = JSON.parse(req.query['payload'])
branch = json_payload['ref'].split('/')[-1]
define foo ($primary_interface='eth0') {
notify { "foo $name local-scope":
message => $primary_interface
} ->
notify { "foo $name top-scope":
message => $::primary_interface
}
}
@codec
codec / child-like-table.vm
Last active December 22, 2015 15:49
Create a table including child pages and likes.
## @noparams
## wtf, seriously!?
#set($containerManagerClass = $action.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod = $containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager = $getInstanceMethod.invoke(null,null))
#set($containerContext = $containerManager.containerContext)
## now what we actually need ...
#set($likeManager = $containerContext.getComponent('likeManager'))
@codec
codec / gist-macro.vm
Last active October 4, 2017 18:25
Confluence User Macro for gists
## @param gist:title=gist URL|type=string|required=true
#set ( $gist = $paramgist.replace("https://gist.github.com/", '') )
#set ( $data = [] )
#foreach($part in $gist.split("/"))
#set ($t = $data.add($part))
#end
#set( $gistuser = $data.get(0) )
#set( $gisthash = $data.get(1) )
@codec
codec / test.pp
Last active December 14, 2015 14:08
class foo {
notify { 'foo': }
}
class bar {
notify { 'bar': message => inline_template("<%= if classes.include?('foo') then 'bar' end %>") }
}
include foo
include bar
root@mirror:/srv/repositories/puppetlabs# ls dists/
hardy oneiric sid testing
hardy-20121220164502045137453 oneiric-20130125153303462683049 sid-20130125153917662426743 testing-20130125155100194065296
lucid precise squeeze unstable
lucid-20130125152713336789991 precise-20130125154646712294437 squeeze-20130125154214238989172 unstable-20130125153620240304389
natty quantal stable wheezy
natty-20130125153016311673059 quantal-20130125154844894669521 stable-20130125154953486972751 wheezy-20130125154438466243674
augeas { 'puppet-onboot':
context => '/files/etc/default/puppet',
incl => '/etc/default/puppet', # http://projects.puppetlabs.com/issues/show/17486
lens => 'Shellvars.lns', # http://projects.puppetlabs.com/issues/show/17486
changes => [
'set START yes',
],
}
Setting up puppet-common (2.7.20-1puppetlabs1) ...
Setting up puppet (2.7.20-1puppetlabs1) ...
* Starting puppet agent /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- puppet/util/command_line (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/bin/puppet:3:in `<main>'
[fail]
invoke-rc.d: initscript puppet, action "start" failed.
@codec
codec / ubuntu-amd64-installer.ipxe
Created November 22, 2012 15:32 — forked from robinsmidsrod/ubuntu-amd64-installer.ipxe
Boot Ubuntu x64 installer directly from the network. Only iPXE needed
#!ipxe
dhcp
echo Starting Ubuntu x64 installer for ${hostname}
set base-url http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64
kernel ${base-url}/linux
initrd ${base-url}/initrd.gz
#imgargs linux auto=true url=http://yourserver/some/path/preseed.cfg
boot ||
# If everything failed, give the user some options
echo Boot from ${base-url} failed
@codec
codec / fpm-gitlabhq.sh
Created July 11, 2012 09:20
Jenkins Execute shell step for gitlab
mkdir -p ${WORKSPACE}/build/etc/init
mkdir -p ${WORKSPACE}/build/etc/init.d
mkdir -p ${WORKSPACE}/build/srv/gitlabhq
mkdir -p ${WORKSPACE}/build/etc/apache2/sites-available
cat >${WORKSPACE}/build/etc/apache2/sites-available/gitlabhq <<EOF
<VirtualHost *:80>
# Passenger options that can be set in a virtual host
# configuration block.
PassengerHighPerformance on