Skip to content

Instantly share code, notes, and snippets.

@zerocrates
zerocrates / trac-to-github.py
Created August 12, 2011 19:49
Python Trac ticket to Github issue importer for Issues API v3
#!/usr/bin/env python
#be lazy about unicode
import sys; reload(sys); sys.setdefaultencoding('utf-8');
import sqlite3
import urllib2
import json
import base64
import re
@zerocrates
zerocrates / gist:1029997
Created June 16, 2011 19:14
modified WEB_ROOT definition for Omeka to handle non-standard ports
function _define_web_root()
{
// Create base URL
$base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
// As $_SERVER['HTTP_HOST'] is user input, ensure it only contains
// characters allowed in hostnames.
$base_url = $base_root .= '://' . preg_replace('/[^a-z0-9-:._]/i', '', $_SERVER['HTTP_HOST']);
// Handle non-standard ports