Skip to content

Instantly share code, notes, and snippets.

%define contentdir /var/www
%define apiver 20041225
%define zendver 20050922
%define pdover 20060409
Summary: The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)
Name: php
Version: 5.1.6
Release: 27%{?dist}
License: The PHP License v3.01
@DamianZaremba
DamianZaremba / find_changes.pl
Created September 28, 2011 02:14
POC for updating files as needed from an external source
#!/usr/bin/env perl
use strict;
use warnings;
use Digest::MD5;
use Cwd 'abs_path';
my $base_dir = './testdata/';
my $updates = 0;
# This is neater
sub hexdigest_file {
@DamianZaremba
DamianZaremba / anamon.py
Created September 26, 2011 21:40
Anamon
#!/usr/bin/python
import os
import sys
import time
import base64
import urllib
import traceback
class watch_file:
def __init__(self, file_path, server_addr, server_port):
@DamianZaremba
DamianZaremba / check_cluebot3.pl
Created September 17, 2011 20:48
ClueBot edit time checker
#!/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;
# Wikipedia client
use MediaWiki::API;
@DamianZaremba
DamianZaremba / test_score.py
Created September 16, 2011 18:18
Test CBNG scoring from python
import socket
import xml.etree.ElementTree as etree
def xmlize_edit(edit, part=False):
xml = ''
if not part: xml += '<?xml version="1.0"?><WPEditSet><WPEdit>'
for key,val in edit.iteritems():
# Dicts
if type(val) == type(dict()):
@DamianZaremba
DamianZaremba / gist:1209849
Created September 11, 2011 17:22
JOTI safety notice for reference/template of IAP
---------------------------For Your Safety!-----------------------------
1. It's easy on the Internet to pretend to be someone else. It is possible for
people on the Internet to pretend to be a Scout, or a Scout Group.
So to be safe, never give out your full name or your home
address when sending e-mail or chatting with IRC.
2. If you receive an E-mail or other Internet communication that you
think is strange or unusual, tell your leader or one of your parents
to have a look at it, just to be safe.
3. If you receive an E-mail or other Internet communication from anyone
that WANTS TO MEET YOU, or asks for any personal information, DO NOT
@DamianZaremba
DamianZaremba / retrieve.py
Created September 3, 2011 16:54
Quick py hack to scrape table data from wikipedia (ISO codes right now)
#!/usr/bin/env python
import urllib
import sys
import json
from mwlib import parser
from mwlib.refine import compat
if __name__ == "__main__":
params = urllib.urlencode({
"format": "json",
@DamianZaremba
DamianZaremba / gist:1191455
Created September 3, 2011 16:52
Wikipedia ISO 3116-1 codes
[damian@finnix getISO3166Codes]$ ./retrieve.py
ISO English country names (short name and lower case) || Alpha-2 code || Alpha-3 code || Numeric code
Afghanistan || ttAF || ttAFG || tt004
Aland Islands|flag|Åland Islands || ttAX || ttALA || tt248
Albania || ttAL || ttALB || tt008
Algeria || ttDZ || ttDZA || tt012
American Samoa || ttAS || ttASM || tt016
Andorra || ttAD || ttAND || tt020
Angola || ttAO || ttAGO || tt024
Anguilla || ttAI || ttAIA || tt660
@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)
@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>