Skip to content

Instantly share code, notes, and snippets.

View flavio's full-sized avatar

Flavio Castelli flavio

View GitHub Profile
@flavio
flavio / main.go
Last active March 2, 2017 13:51
terraform cloudinit merge example
package main
import (
"fmt"
"github.com/imdario/mergo"
"gopkg.in/yaml.v2"
)
type UserData struct {
@flavio
flavio / salt-test.md
Created April 15, 2016 10:29
Messing around with salt on leap 42.1

Installing the master

salt-test-master:~ # zypper in salt-master
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 56 NEW packages are going to be installed:
  dmidecode libblas3 libgfortran3 libgit2-22 liblapack3 libmysqlclient18 libpgm-5_2-0 libquadmath0 libsodium13 libzmq5 mariadb mariadb-client mariadb-errormessages python-backports.ssl_match_hostname python-certifi python-cffi
### Keybase proof
I hereby claim:
* I am flavio on github.
* I am flavio (https://keybase.io/flavio) on keybase.
* I have a public key whose fingerprint is AD5B 286B FC09 361A F047 7FA0 B017 C183 7D5F 0D40
To claim this, I am signing this object:
[vagrant@kubernetes-minion-1 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
01d6ba720de3 docker-registry.in.da.house/brendanburns/php-redis:latest "/bin/sh -c /run.sh" 19 minutes ago Up 19 minutes k8s_php-redis.7723b593_15f6c1f2-53d8-11e4-968e-0800279696e1.etcd_15f6c1f2-53d8-11e4-968e-0800279696e1_0086b796
168a289c3f2d kubernetes/pause:latest "/pause" 20 minutes ago Up 20 minutes 0.0.0.0:8000->80/tcp k8s_net.a7c18396_15f6c1f2-53d8-11e4-968e-0800279696e1.etcd_15f6c1f2-53d8-11e4-968e-0800279696e1_ac4d51dd
8f37f90998eb docker-registry.in.da.house/brendanburns/redis-slave:latest "/bin/sh -c /run.sh" 22 minutes ago Up 22 minutes k8s_slave.1b352a7a_acd07d76-53d7-11e4-968e-0800279696e1.etcd_acd07d
@flavio
flavio / logger_example
Created May 26, 2014 10:06
Simple way to share a logger across a bunch of files without using a global variable
require 'forwardable'
require 'singleton'
require 'logger'
module Silvio
class Logger
include Singleton
extend Forwardable
def_delegators :@logger, :debug, :info, :warn, :error, :fatal
[debug] api.go:933 Calling POST /containers/create
2014/02/12 15:50:14 POST /v1.9/containers/create
[/var/lib/docker|a9ecaa15] +job create()
[debug] deviceset.go:191 registerDevice(202, 6897316605f23e395b4abcf63071f507bb15488f28b07a363671d9f243006624-init)
[debug] deviceset.go:212 activateDeviceIfNeeded(6897316605f23e395b4abcf63071f507bb15488f28b07a363671d9f243006624-init)
[debug] deviceset.go:191 registerDevice(203, 6897316605f23e395b4abcf63071f507bb15488f28b07a363671d9f243006624)
[debug] deviceset.go:212 activateDeviceIfNeeded(6897316605f23e395b4abcf63071f507bb15488f28b07a363671d9f243006624)
[debug] deviceset.go:790 [devmapper] UnmountDevice(hash=6897316605f23e395b4abcf63071f507bb15488f28b07a363671d9f243006624 path=/var/lib/docker/devicemapper/mnt/6897316605f23e395b4abcf63071f507bb15488f28b07a363671d9f243006624)
[debug] deviceset.go:795 [devmapper] Unmount(/var/lib/docker/devicemapper/mnt/6897316605f23e395b4abcf63071f507bb15488f28b07a363671d9f243006624)
[debug] deviceset.go:800 [devmapper] Unmount done
@flavio
flavio / aufs_crash.log
Created September 4, 2013 12:56
Relevant part from /var/log/messages
This file has been truncated, but you can view the full file.
2013-09-04T13:13:42.279434+02:00 roesti kernel: [11570.686358] aufs aufs_migratepage:666:mergesolv[17456]: This operation is not supported. Please report this application to aufs-users ML.
2013-09-04T13:13:42.279460+02:00 roesti kernel: [11570.686364] CPU: 0 PID: 17456 Comm: mergesolv Tainted: G O 3.10.10-3.g8038aea-desktop #1
2013-09-04T13:13:42.279463+02:00 roesti kernel: [11570.686365] Hardware name: LENOVO 6458C98/6458C98, BIOS 7LETC1WW (2.21 ) 07/01/2008
2013-09-04T13:13:42.279465+02:00 roesti kernel: [11570.686367] ffffffff815d1a65 000000000000007d ffffffffa0a90d7f ffff880082cc6b50
2013-09-04T13:13:42.279468+02:00 roesti kernel: [11570.686371] ffffffff81169dea 0000000000000001 ffffffff81174055 ffffea00041bf448
2013-09-04T13:13:42.279470+02:00 roesti kernel: [11570.686374] 0000000000000001 ffffea00038186b0 ffffffff81177030 ffffea00038186b0
2013-09-04T13:13:42.279473+02:00 roesti kernel: [11570.686377] Call Trace:
2013-09-04T13:13:42.279475+02:00 roesti kernel: [11570.686390] [<ffffffff81004
/tmp/python-build.20130722162116.21155 ~
Python-2.6.8/
Python-2.6.8/.hg_archival.txt
Python-2.6.8/README
Python-2.6.8/Makefile.pre.in
Python-2.6.8/Python/
Python-2.6.8/Python/bltinmodule.c
Python-2.6.8/Python/thread_foobar.h
Python-2.6.8/Python/asdl.c
Python-2.6.8/Python/getargs.c
/tmp/python-build.20130722120128.14436 ~
Python-2.6.8/
Python-2.6.8/.hg_archival.txt
Python-2.6.8/README
Python-2.6.8/Makefile.pre.in
Python-2.6.8/Python/
Python-2.6.8/Python/bltinmodule.c
Python-2.6.8/Python/thread_foobar.h
Python-2.6.8/Python/asdl.c
Python-2.6.8/Python/getargs.c
@flavio
flavio / group_logs.rb
Created April 17, 2013 10:24
Small ruby script made for my friend Renato
#!/usr/bin/env ruby
groups = Hash.new{|h,k| h[k] = []}
File.read('foo').lines.each do |line|
ip = line.split(/\s+/).first
next if ip.empty? || ip.nil?
root = ip.split('.')[0,2].join('.')
groups[root] << line.chomp
end