Skip to content

Instantly share code, notes, and snippets.

View maraca's full-sized avatar

Martin Cozzi maraca

View GitHub Profile
@maraca
maraca / slow.rb
Last active August 29, 2015 14:19
trap('INT') { puts 'Au revoir.'; exit 0 }
require 'someslowassgem'
def main
# do stuff like
loop {}
end
begin
type=SYSCALL msg=audit(1422400641.534:1763): arch=c000003e syscall=59 success=yes exit=0 a0=15caf68 a1=17f3908 a2=1704008 a3=7fffe0699d10 items=2 ppid=24788 pid=30307 auid=2001 uid=2001 gid=2001 euid=2001 suid=2001 fsuid=2001 egid=2001 sgid=2001 fsgid=2001 tty=pts5 ses=627 comm="ls" exe="/bin/ls" key=(null)
type=EXECVE msg=audit(1422400641.534:1763): argc=2 a0="ls" a1="--color=auto"
type=CWD msg=audit(1422400641.534:1763): cwd="/var/log"
type=PATH msg=audit(1422400641.534:1763): item=0 name="/bin/ls" inode=393530 dev=ca:01 mode=0100755 ouid=0 ogid=0 rdev=00:00
type=PATH msg=audit(1422400641.534:1763): item=1 name=(null) inode=526546 dev=ca:01 mode=0100755 ouid=0 ogid=0 rdev=00:00
@maraca
maraca / elb.json
Last active August 29, 2015 14:13
Perfect Forward Secrecy AWS ELB CloudFormation
"PublicELB" : {
"Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
"Properties" : {
"SecurityGroups" : [ { "Ref" : "PublicELBSecurityGroup" } ],
"Subnets" : { "Ref" : "PublicSubnetIds" },
"Listeners" :
[
{ "LoadBalancerPort" : "443",
"InstancePort" : "80",
"Protocol" : "HTTPS",
@maraca
maraca / search.rb
Created August 24, 2014 12:48
search for a statsd node using chef-zero and kitchen-ci
environment = node.chef_environment
role = 'statsd'
# search for statsd host
statsd_host = search(:node, "roles:#{role} AND chef_environment:#{environment}").sort.first
puts statsd_host['ipaddress']
> 10.0.0.75
@maraca
maraca / test-integration-nodes-monitoring.json
Last active August 29, 2015 14:05
monitoring node in your kitchen-ci integration tests.
{
"id": "statsd",
"run_list": ["role[statsd]"],
"automatic": {
"ipaddress": "10.0.0.75",
"roles": ["statsd"]
}
}
@maraca
maraca / .kitchen.yml
Created August 24, 2014 12:34
Use chef-zero in your kitchen-ci configuration file.
---
driver_plugin: vagrant
provisioner:
name: chef_zero
@maraca
maraca / .kitchen.yml
Last active August 29, 2015 14:03
kitchen-ci search nodes.
---
driver:
name: vagrant
provisioner:
name: chef_zero
platforms:
- name: ubuntu-12.04
@maraca
maraca / add_crontab
Created June 24, 2014 17:53
How to add a cronjob to synology.
# Edit the crontab
vi /etc/crontab
# Add your entry
52 10 * * * root echo 'hello' >> /tmp/hello
# Restart crond
RackStation> /usr/syno/etc.defaults/rc.d/S04crond.sh stop
stop crond
RackStation> /usr/syno/etc.defaults/rc.d/S04crond.sh start
@maraca
maraca / meraki_vpn_config.txt
Last active August 29, 2015 14:01
VPN w/ ubuntu & Meraki
sudo add-apt-repository ppa:openswan/ppa
sudo apt-get update
sudo apt-get dist-upgrade
========================================
net.ipv4.conf.all.accept_redirects = 1
net.ipv4.conf.all.secure_redirects = 1
net.ipv4.conf.all.send_redirects = 1
net.ipv4.conf.default.accept_redirects = 1
@maraca
maraca / chef-deregister-service.rb
Created May 13, 2014 06:35
Chef deregistration service
#!/opt/chef/embedded/bin/ruby
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2010 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#