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
<%=
class MyHash < Hash
def to_yaml( opts = {} )
YAML::quick_emit( self, opts ) do |out|
out.map( taguri, to_yaml_style ) do |map|
keys.sort.each do |k|
v = self[k]
map.add( k, v )
end
end
@raphink
raphink / hash.erb
Last active December 14, 2015 07:08
<%=
class MyHash < Hash
def initialize(hash)
@hash = hash
end
def test
@hash.is_a?(Hash) ? "yes" : @hash.class
end
end
$ mco inventory wrk4 -v
The inventory application failed to run, use -v for full error details: Received a processing error from RabbitMQ: 'Processing error'
Received a processing error from RabbitMQ: 'Processing error' (RuntimeError)
from /usr/share/mcollective/plugins/mcollective/connector/rabbitmq.rb:162:in `receive' <----
from /usr/lib/ruby/1.8/mcollective/client.rb:89:in `receive'
from /usr/lib/ruby/1.8/mcollective/client.rb:152:in `req'
from /usr/lib/ruby/1.8/mcollective/client.rb:151:in `loop'
from /usr/lib/ruby/1.8/mcollective/client.rb:151:in `req'
network_interface {"eth1":
ensure => up,
macaddress => 'aa:bb:cc:dd:ee:ff',
mtu => '1492',
onboot => true,
ipv4 => {
address => ['192.168.0.5/24'],
gateway => '192.168.0.1,
dhcp => false,
},
@raphink
raphink / check_commits.sh
Created February 7, 2013 10:46
Test all commits in range, performing a `make check` on each. Fail on first failed commit.
#!/bin/bash
RANGE=$1
while read rev def; do
echo -n "Testing $rev ($def) "
git checkout $rev >/dev/null 2>/dev/null
make check > /dev/null 2>/dev/null
[[ $? != 0 ]] && echo "NOK" && exit 1
echo "OK"
STOMP error frame sent:
Message: "Processing error"
Detail: "Processing error\n"
Server private detail: {undef,
[{rabbit_auth_backend_ldap,check_user_login,
[<<"rpinson">>,[{password,<<"mypassword">>}]]},
{rabbit_access_control,
'-check_user_login/2-fun-0-',4},
{lists,foldl,3},
{rabbit_stomp_processor,do_login,7},
module Test =
let number = [ label "number" . store Rx.integer . Util.eol ]
let lns = (Util.comment|Util.empty|number)*
let _ = print_endline (lens_format_atype lns)
@raphink
raphink / augsed.sh
Last active December 11, 2015 02:09
augsed bash poc
#!/bin/bash
BYLINE=0
while getopts "l" opt; do
case $opt in
l)
BYLINE=1
shift
;;
$ cat /etc/passwd | auged --lens Passwd.lns set root/shell /bin/zsh
# passwd content with replacement
$ cat /etc/passwd | auged --lens Passwd.lns -f commands.augtool
# passwd content modified by commands.augtool commands
$ auged --lens Passwd.lns -i 'set root/shell /bin/zsh' /etc/passwd
# no output, replaces /etc/passwd in place
$ auged --lens Passwd.lns 'get root/shell' /etc/passwd
/bin/sh
$ auged --lens Passwd.lns 'get */shell' /etc/passwd
/bin/sh
require 'openvz'
inventory = OpenVZ::Inventory.new()
inventory.load
hostnames=[]
inventory.to_hash.each do |k,v|
hostnames << v.config.hostname
end
puts hostnames.join(':')