Skip to content

Instantly share code, notes, and snippets.

View larstobi's full-sized avatar

Lars Tobias Skjong-Børsting larstobi

  • Skylars AS
  • Oslo, Norway
View GitHub Profile
@larstobi
larstobi / BASH parallel jobs
Created March 25, 2009 09:14
BASH parallell jobs
#!/bin/bash
PID_LIST=""
for i in `seq 1 9`; do
sleep 3s && echo $? > /tmp/PID_${!} &
PID_LIST="${PID_LIST} $!"
echo "Started process with pid $!"
done
wait
for pid in ${PID_LIST}; do
echo "PID: ${pid} EXIT: $(</tmp/PID_${pid})"
<?xml version="1.0" ?>
<layman>
<overlay
type="git"
src="git://github.com/larstobi/lottanzb.git"
name="lottanzb"
contact="larstobi@snota.no">
<link>http://github.com/larstobi/lottanzb/tree/master</link>
<description>LottaNZB overlay</description>
</overlay>
@larstobi
larstobi / boostrap_master.sh
Created October 13, 2011 08:11
Bootstraps a puppet master node until a running puppetmaster server. Uses https://gist.github.com/1283705
#!/bin/bash
source bootstrap_functions.sh
ensure_packages_installed "git ruby ruby-irb rubygems httpd"
ensure_user_present "puppet"
ensure_directory "/etc/puppet"
ensure_file "/etc/puppet/puppet.conf" "puppet.master.conf"
ensure_yum_repo "my.repo"
ensure_vhost_present "yum.conf"
ensure_package_installed "rubygem-puppet"
function package_installed {
name=$1
if `rpm -q $name 1>/dev/null`; then
return 0
else
return 1
fi
}
@larstobi
larstobi / rspec
Created October 19, 2011 18:04
puppet cloud-provisioner rspec
larstobi@mactobi:~/.puppet/modules/cloud_provisioner$ rspec
/Users/larstobi/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- puppet/face/node/terminate (LoadError)
from /Users/larstobi/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /Users/larstobi/.rvm/gems/ruby-1.8.7-p352/gems/puppet-2.7.5/lib/puppet/interface.rb:114:in `load_actions'
from /Users/larstobi/.rvm/gems/ruby-1.8.7-p352/gems/puppet-2.7.5/lib/puppet/interface.rb:111:in `each'
from /Users/larstobi/.rvm/gems/ruby-1.8.7-p352/gems/puppet-2.7.5/lib/puppet/interface.rb:111:in `load_actions'
from /Users/larstobi/.rvm/gems/ruby-1.8.7-p352/gems/puppet-2.7.5/lib/puppet/interface.rb:110:in `each'
from /Users/larstobi/.rvm/gems/ruby-1.8.7-p352/gems/puppet-2.7.5/lib/puppet/interface.rb:110:in `load_actions'
from /Users/larstobi/.rvm/gems/ruby-1.8.7-p352/gems/puppet-2.7.5/lib/puppet/interface.rb:45:in `define'
from /Users
@larstobi
larstobi / my_link.pp
Created November 9, 2011 10:18
TextMate indent selection on Puppet resources
@larstobi
larstobi / Puppet.json
Created November 9, 2011 10:22
TextMate Language syntax for Puppet
{ scopeName = 'source.puppet';
fileTypes = ( 'pp' );
foldingStartMarker = '(^\s*/\*|(\{|\[|\()\s*$)';
foldingStopMarker = '(\*/|^\s*(\}|\]|\)))';
patterns = (
{ include = '#line_comment'; },
{ name = 'comment.block.puppet';
begin = '^\s*/\*';
end = '\*/';
},
@larstobi
larstobi / gist:1351231
Created November 9, 2011 11:55
Puppet TextMate Bundle Preference: Indentation
{ increaseIndentPattern = '^.*(\{|\(|:)\s*$';
decreaseIndentPattern = '^\s*(\)|\}|;)\s*$';
}
@larstobi
larstobi / gitolite.pp
Created November 14, 2011 12:54
Gitolite manifest
file {
"/var/spool/gitolite":
ensure => directory,
owner => "git",
group => "git";
"admin.pub":
ensure => present,
path => "/var/spool/gitolite/admin.pub",
content => "ssh-rsa AAAAB3NzaC1...bmhLcxczOQ== admin@example.net";
@larstobi
larstobi / user_larstobi.pp
Created November 14, 2011 12:59
Puppet user resource
class user_larstobi {
$user = "larstobi"
group { "$user":
ensure => present,
allowdupe => false,
}
user { "$user":
comment => "Lars Tobias Skjong-Borsting",
gid => "$user",