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>
#!/opt/local/bin/python
'''
via @zap42
dnssec-valid.py: DNSSEC validation
Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz)
Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
Copyright (c) 2008. All rights reserved.
@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 / etemp.py
Created January 27, 2012 09:51
Obtain Celsius temperature reading from Entropy Key and submit to Pachube
#!/usr/bin/env python
#(@)etemp.py by Jan-Piet Mens (C)2012
# Obtain Celsius temperature reading from Entropy Key and submit to Pachube
import eeml # git://github.com/petervizi/python-eeml.git
import subprocess
keyslot = "1"
API_KEY = 'TXHh........QXQ0AfEnZp'
@jpmens
jpmens / sshkey-facter.sh
Created February 1, 2012 10:50
Create SSHFP records from facter facts
#!/bin/sh
fqdn=`facter fqdn`
for algo in rsa dsa
do
type=$algo
[ $type == 'dsa' ] && type=dss
facter "ssh${algo}key" | sed -e "s/^/ssh-${type} /" > /tmp/x
ssh-keygen -r $fqdn -f /tmp/x
done
@jpmens
jpmens / Makefile.authdns
Created February 2, 2012 13:11
Makefile for my book (LaTeX)
altdns.ps: altdns.dvi
dvips -f -Ppdf altdns.dvi > altdns.ps
altdns.dvi: altdns.tex chapters/*.tex fmt/*.tex
latex altdns.tex
latex altdns.tex
makeindex altdns.idx
latex altdns.tex
makeindex altdns.idx
latex altdns.tex
@jpmens
jpmens / cloneall.sh
Created February 9, 2012 16:01
Clone all my gists
#!/bin/sh
#cloneall.sh by Jan-Piet Mens, February 2012
# Obtain a list of gists (mine) and clone them into the current directory
# Requires jsonpipe (https://github.com/dvxhouse/jsonpipe)
URL=http://gist.github.com/api/v1/json/gists/jpmens
CLONEURLFMT="git://gist.github.com/%d.git\n"
curl -qs $URL |
jsonpipe -s ' ' |
@jpmens
jpmens / dddns.py
Created February 18, 2012 12:21
Print results of DNS NAPTR records
#!/usr/bin/env python
#(@)dddns.py by Jan-Piet Mens, February 2012
import dns.resolver
import dns.e164
from dns.exception import DNSException
import sys, re
import optparse
def enum(aus, verbose):