Skip to content

Instantly share code, notes, and snippets.

@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 / 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: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 / 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 / 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 / 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 / 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 {
%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 / upload
Created October 11, 2011 07:44
Bytemark dns upload script
#!/bin/sh
# Config stuff
UPLOAD_HOST="upload.ns.bytemark.co.uk";
UPLOAD_USERNAME="";
UPLOAD_PASSWORD="";
# This stuff is required
cd `dirname $0`;
export RSYNC_PASSWORD=$UPLOAD_PASSWORD;
@DamianZaremba
DamianZaremba / check_mediawiki_user_edit_time.pl
Created December 10, 2011 00:04
Nagiosified version of gist://1151692
#!/usr/bin/env perl
# We want to know if stuff is going to explode in our face
use warnings;
use strict;
# Wikipedia client
use MediaWiki::API;
# Mediawiki is too awesome to use unix time
use Date::Parse;