This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import subprocess | |
import tempfile | |
import urllib | |
with tempfile.NamedTemporaryFile(mode='w', suffix='.png') as f: | |
try: | |
subprocess.check_call('qrencode -V'.split()) | |
except OSError: | |
print "Rendering QR Code using Google Charts API" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// | |
// mysqli-prepared.php | |
// Use PreparedQuery to ease use of prepared query calls | |
// Example: | |
// PreparedQuery($conn, "SELECT id, username FROM users WHERE email = ?", array("s", $_POST["email"]) | |
// | |
function PreparedQuery($connection, $query, $params=array()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Copyright (c) 2010 Erik Karulf ([email protected]) | |
# | |
# Permission to use, copy, modify, and/or distribute this software for any | |
# purpose with or without fee is hereby granted, provided that the above | |
# copyright notice and this permission notice appear in all copies. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def etree(packages=('lxml.etree', 'xml.etree.cElementTree', | |
'cElementTree', 'elementtree.ElementTree')): | |
for pkg_name in packages: | |
try: | |
pkg = __import__(pkg_name) | |
except ImportError: | |
continue | |
else: | |
for subpkg_name in pkg_name.split('.')[1:]: # skip the base package | |
pkg = getattr(pkg, subpkg_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# PROVIDE: minecraft | |
# REQUIRE: DAEMON | |
# | |
# Add the following lines to /etc/rc.conf to run minecraft: | |
# | |
# minecraft_enable (bool): Set it to "YES" to enable minecraft. | |
# Default is "NO". | |
# minecraft_java_flags (flags): Set flags here. More options in java(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: ascii -*- | |
############################################################################## | |
# Copyright (c) 2010, Erik Karulf ([email protected]) | |
# | |
# Permission to use, copy, modify, and/or distribute this software for any | |
# purpose with or without fee is hereby granted, provided that the above | |
# copyright notice and this permission notice appear in all copies. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* NumericRangeCalculator.java | |
* | |
* Created on Sep 13, 2007, 12:14:01 PM | |
* | |
*/ | |
package edu.wustl.asl.gs.common; | |
import edu.wustl.asl.utils.NumericRange; |