Skip to content

Instantly share code, notes, and snippets.

@jpmens
jpmens / json.pl
Created July 28, 2011 13:08 — forked from mschmitt/json.pl
Playing with the Firefox session file...
#!/usr/bin/perl -w
use strict;
use diagnostics;
use JSON;
use Data::Dumper;
my $sessionstore = '/home/martin/.mozilla/firefox/12345678.default/sessionstore.js';
my $json_raw;
open my $fh_in, "<$sessionstore" or die "Can't open $sessionstore: $!\n";
@jpmens
jpmens / gist:1489841
Created December 17, 2011 10:00 — forked from jakedouglas/gist:135109
Simple UDP Growl packets in Lua
require "luarocks.require"
require "pack"
require "socket"
require "md5"
Growl = {version = 1, registration = 0, notification = 1}
function Growl.new(hostname, appname)
local mysock = assert(socket.udp())
#define UNBOUND_CONTROL_VERSION 1
#define UNBOUND_ETC_DIR "/var/unbound/etc"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
@jpmens
jpmens / withings.py
Created January 26, 2012 14:16 — forked from gregorynicholas/withings.py
Withings Python OAuth Wrapper
# -*- coding: utf-8 -*-
# Based on https://github.com/ikasamah/withings-garmin/blob/master/withings.py
import urllib
from datetime import datetime
import urlparse
import oauth2 as oauth
try:
import json
@jpmens
jpmens / gist:2145573
Created March 21, 2012 08:20 — forked from mkyed/gist:1694240
Installing PowerDNS 3.0.1 on Mac OS X Lion
1) Install MySQL <http://dev.mysql.com/>
2) Install Homebrew <http://mxcl.github.com/homebrew/>
3) $ brew install boost boost-jam lua pkg-config wget
4) $ wget http://downloads.powerdns.com/releases/pdns-3.0.1.tar.gz && tar xzf pdns-3.0.1.tar.gz
5) $ cd pdns-3.0.1 && ./configure --with-mysql-includes=/usr/local/mysql/include && make && make install
6) Adjust /usr/local/etc/pdns.conf to your mysql setup
7) cat /System/Library/LaunchDaemons/pdns_server.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@jpmens
jpmens / .gitignore
Created April 13, 2012 10:02 — forked from eatnumber1/.gitignore
NSD OpenDNSSEC Notifier
nsd-notify
@jpmens
jpmens / dhcp-event.py
Created June 14, 2012 09:59 — forked from darac/dhcp-event.py
Thingy for updating powerdns backend when stuff changes
#!/usr/bin/env python
import MySQLdb
import syslog
import sys
import pprint
pp = pprint.PrettyPrinter()
mysql_host = "localhost"
mysql_user = "dbusername"
mysql_pass = "dbpassword"
@jpmens
jpmens / tmp_files
Created June 14, 2012 10:01 — forked from tomoconnor/tmp_files
Very simple example munin plugin
#!/usr/bin/env python
import os
from munin import MuninPlugin
class TmpFileCount(MuninPlugin):
title = "Number of Files in /tmp"
args = "--base 1000 -l 0"
vlabel = "files"
scaled = False
@jpmens
jpmens / pedantically_commented_playbook.yml
Created June 19, 2012 15:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@jpmens
jpmens / gist:3276101
Created August 6, 2012 16:19
Logstash input config for Beaver/Redis

On the command line:

REDIS_NAMESPACE='logstash:app:unmappable' REDIS_URL='redis://redis-internal:6379/0' beaver -f /apps/production/current/log/unmappable.log -t redis

My logstash input:

redis {
  host => 'redis-internal' # this is in dns for work

data_type => 'list'