Skip to content

Instantly share code, notes, and snippets.

@DamianZaremba
DamianZaremba / server.py
Created August 2, 2011 22:29
BGPServer written in python - doesn't actually do anything apart from process inotify events right now.
#!/usr/bin/env python3
import argparse
import os
import logging
import sys
import signal
import socket
import pyinotify
'''
#!/usr/bin/perl
use warnings;
use strict;
use Net::LDAP;
use Data::Dumper;
my $ldap = Net::LDAP->new("ldap.cluenet.org", timeout => 10);
my $servers = {
abc => {
@DamianZaremba
DamianZaremba / vm_install.sh
Created August 14, 2011 23:05
virt-install wrapper
#!/bin/bash
#
# Little virt-install wrapper to save typing, supports the following:
# centos - Centos network install with optional ks
# fedora - Fedora network install with optional ks
# debian - Debian network install with optional ks
# ubuntu - Ubuntu network instal with option ks
# pxe - Boot a vm and tell it try PXE
#
# Setup:
@DamianZaremba
DamianZaremba / lastfm.php
Created August 17, 2011 12:45
Wordpress last.fm plugin
<?php
/*
Plugin Name: LastFM
Plugin URI:
Description: Displays data from LastFM
Author: damianzaremba
Author URI: http://damianzaremba.co.uk
Version: 1.0
License: GPL3
*/
#!/usr/bin/env perl
use lib '/home/damianzaremba/software/perlmods/share/perl/5.10.1/';
# We want to know if stuff is going to explode in our face
use warnings;
use strict;
# Awesome logging
use Log::Log4perl;
# Wikipedia client
<?php
class Bob{
function hi() {
print "Hi from " . get_class() . "\n";
}
}
class Damian{
function hi() {
print "Hi from " . get_class() . "\n";
@DamianZaremba
DamianZaremba / update.pl
Created August 22, 2011 15:55
Cluenet graphviz mapping script C=
#!/usr/bin/env perl
# We want to know if stuff is going to explode in our face
use warnings;
use strict;
# Awesome logging
use Log::Log4perl;
# LWP is an awesome HTTP client
use LWP::UserAgent;
@DamianZaremba
DamianZaremba / update_gists.pl
Created August 25, 2011 11:54
Gist update script
#!/usr/bin/perl5.12.4
use JSON;
use LWP::Simple;
use Cwd;
my $data = get "http://gist.github.com/api/v1/json/gists/damianzaremba";
my $json = decode_json($data);
my $gists = $json->{"gists"};
for my $gist (@$gists) {
@DamianZaremba
DamianZaremba / functions.php
Created August 28, 2011 21:31
Wordpress wp_nav_menu walker
<?php
/*
* Footer menu walker - just because wordpress sucks
* See wp-includes/class-wp-walker.php for what the hell this does normally (Class Walker)
*/
class footer_menu_walker {
/*
Output we are aiming for:
<div class="col">
<h3>Some sub menu</h3>
@DamianZaremba
DamianZaremba / digglue.sh
Created August 29, 2011 18:49
Dig glue!
#!/bin/bash
if [ -z "$1" ];
then
echo "Usage: digglue <domain>";
exit 1;
fi
domain=$1
ext=$(echo "$domain" | awk -F. '{print $NF}');
root=$(dig +short $ext NS | head -n1)