Skip to content

Instantly share code, notes, and snippets.

View raphink's full-sized avatar
🐝
eBPF everything!

Raphaël Pinson raphink

🐝
eBPF everything!
View GitHub Profile
@raphink
raphink / forked.html
Last active December 25, 2015 16:49
Lists forked Puppet modules. Require 'octokit' and 'netrc' gems.
<html>
<head>
<script src="base64.js"></script>
<script src="underscore-min.js"></script>
<script src="github.js"></script>
<script language="JavaScript">
var github = new Github({
username: "user",
password: "pass"
})
@raphink
raphink / apache2.conf
Created October 15, 2013 12:01
`apache_directive` type and provider for Puppet. Context must exist before it is used (`VirtualHost` and `IfModule`)
<VirtualHost *:80>
Options Indexes FollowSymLinks MultiViews
</VirtualHost>
<IfModule mpm_prefork_module>
StartServers 4
</IfModule>
SetEnv SPECIAL_PATH /foo/bin
rpinson@wrk15 (wrk/c2c):~/dev/puppet-augeasproviders$ rspec
/home/rpinson/dev/puppet-augeasproviders/lib/augeasproviders/provider.rb:6:in `<top (required)>': uninitialized constant Object::Puppet (NameError)
from /home/rpinson/dev/puppet-augeasproviders/spec/lib/augeas_spec.rb:6:in `require'
from /home/rpinson/dev/puppet-augeasproviders/spec/lib/augeas_spec.rb:6:in `<top (required)>'
from /home/rpinson/.rvm/gems/ruby-1.9.2-p320@rspec-puppet/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `load'
from /home/rpinson/.rvm/gems/ruby-1.9.2-p320@rspec-puppet/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /home/rpinson/.rvm/gems/ruby-1.9.2-p320@rspec-puppet/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `each'
from /home/rpinson/.rvm/gems/ruby-1.9.2-p320@rspec-puppet/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /home/rpinson/.rvm/gems/ruby-1.9.2-p320@rspec-puppet/gems/rspec-core-2.14.5/lib/rspec/
--- ec2.rb.ori 2013-10-07 14:06:14.391700848 +0200
+++ ec2.rb 2013-10-07 08:58:28.690642654 +0200
@@ -40,9 +40,9 @@
mac_address_re = case kernel
when /Windows/i
- /fe-ff-ff-ff-ff-ff/i
+ /(fe-ff-ff-ff-ff-ff|12-ea-49-c0)/i
else
- /fe:ff:ff:ff:ff:ff/i
@raphink
raphink / apache.pp
Created October 2, 2013 08:43
`puppet:///` URI with query string for templates in file serving
file { '/etc/apache2/apache.conf':
ensure => present,
source => 'puppet:///modules/apache/apache.conf?wwwdir=/var/www&user=apache',
}
module AIX_Security =
let comment = Util.comment_generic /[ \t]*\*[ \t]*/ "* "
let empty = Util.empty_generic /[ \t]*\*?[ \t]*/
let record =
let section = label "section" . store /[^:=*\r\n]+/ . Sep.colon . Util.eol
in let entry = Util.indent . Build.key_value_line Rx.word Sep.space_equal (store Rx.space_in)
in [ section . (entry|comment|empty)* ]
@raphink
raphink / pre-commit
Last active December 23, 2015 21:29
#! /bin/bash
# If we don't have a HEAD, then this is the first commit and we can't do any of this
git show > /dev/null 2>&1
if [ $? -ne 0 ]; then exit 0; fi
# first stash any on-disk changes so we're actually validating
# what's staged to be committed and not just what's on disk.
git diff --full-index --binary > /tmp/stash.$$
git stash -q --keep-index
[fstab_missing_opt]
path = /files/etc/fstab/*[label()=~regexp('[0-9]+') and count(opt[.='foo'])=0]
method = label
type = multiple
sep = ,
#!/bin/sh
LOGS=$1
grep scope $LOGS | awk '{print $1" "$14}' | while read f l; do
echo $f: $(sed "${l}q;d" $f)
done
@raphink
raphink / augeas.rb
Last active December 20, 2015 21:19
Puppet::Type.type(:simpleline).provide(:augeas) do
desc "Uses Augeas API to update simple line conffiles"
include AugeasProviders::Provider
lens { 'Simplelines.lns' }
confine :feature => :augeas