Skip to content

Instantly share code, notes, and snippets.

@pfigue
pfigue / watch.py
Created December 8, 2013 17:39
Python Debugging Werkzeugkiste
def watch(var1):
"""
Helper to watch the value of VARIABLES (not expressions)
in the scope of calling function:
>>> k = 3
>>> watch('k')
"k" := int, "3"
Won't work with expressions like:
@pfigue
pfigue / dnsmasq.pp
Last active December 30, 2015 03:49
dnsmasq Puppet Manifest to serve a local zone and forward external requests to Google's DNS servers.
package { 'dnsmasq':
ensure => present,
}
$dnsmasq_conf = "no-resolv
server=8.8.4.4
server=8.8.8.8
interface=eth0
no-dhcp-interface=eth0
no-hosts
@pfigue
pfigue / timezone.pp
Last active September 23, 2025 16:12
Puppet Manifest to set the timezone in the system.
file { '/etc/timezone':
ensure => present,
content => "Europe/Berlin\n",
}
exec { 'reconfigure-tzdata':
user => root,
group => root,
command => '/usr/sbin/dpkg-reconfigure --frontend noninteractive tzdata',
}
@pfigue
pfigue / ec2-user-data-parser.py
Last active December 29, 2015 15:28
Facter fact code and a python script to read some user defined AWS EC2 instance properties during provisioning.
# Invocation example:
#
# $ curl -s "http://169.254.169.254/latest/user-data/" > /tmp/test.yaml
# $ cat /tmp/test.yaml
# instance:
# flavor: application-server
# $ abc=$(cat /tmp/test.yaml | python ec2-user-data-parser.py instance flavor)
# $ echo $abc
# application-server
# $
@pfigue
pfigue / receiving_cookie.sh
Created October 18, 2012 06:34
Who gives me cookies?
@pfigue
pfigue / cron_alive.sh
Created July 6, 2012 15:53
Icinga Plugin to monitor if cron is alive
#!/bin/bash
# Determine if cron is running
# Comes from https://gist.github.com/3061023
UNKNOWN_STATE=3
CRITICAL_STATE=2
WARNING_STATE=1
OK_STATE=0
@pfigue
pfigue / hosts.txt
Created June 3, 2012 07:12
Subdomain list to use with Pentbox in bruteforcing DNS
0
01
02
03
1
10
11
12
13
14
@pfigue
pfigue / create_rabbit_vhost.sh
Created May 23, 2012 10:52
Create a RabbitMQ vhost and user, and provide permissions
#!/bin/bash
# Syntax: create_rabbit_vhost.sh <vhost> <user> <pass>
if [ $# != 3 ]; then
echo "Fail! Syntax: $0 <vhost> <user> <pass>"
exit 1
fi
rabbitmqctl add_vhost $1
@pfigue
pfigue / bin2dec.erl
Created November 15, 2011 21:25
From binary to decimal, in erlang
-module(bin2dec).
-export([bin2dec/1, bin2dec_/2]).
bin2dec("") ->
0;
bin2dec(List) -> bin2dec_(List, 0).
bin2dec_([], Sum) ->
Sum;
bin2dec_([48 | Tail], Sum) -> %48 is ascii code for 0
@pfigue
pfigue / gist:1368320
Created November 15, 2011 20:57
Example of my Erlang max:max()
6> c(max).
{ok,max}
8> max:max([]).
[]
10> max:max([10]).
10
11> max:max([2, 3, 10]).
10
13> max:max([2, 3, 10, 1]).
10