This file contains hidden or 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 | |
# encoding: utf-8 | |
""" | |
csv_to_xml.py | |
This script coverts a csv file to an XML. | |
The script takes 2 paramenters | |
* filename | |
* row node name |
This file contains hidden or 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 | |
function control_daemon_repeat() { | |
$ps = "/bin/ps aux | /bin/grep -i ".$_SERVER["argv"][0]." | /bin/grep -v grep | wc -l"; | |
$exec = exec($ps, $output, $return); | |
if ($output[0] > 1) die("*** Ya esta en ejecucion\n"); | |
} | |
// Example | |
control_daemon_repeat(); |
This file contains hidden or 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 | |
class Autokill { | |
var $start_mtime_included_files = array(); | |
function Autokill() { $this->__construct(); } | |
function __construct() { | |
clearstatcache(); | |
$files = get_included_files(); |
This file contains hidden or 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 | |
class GenericVariable | |
{ | |
private $var; | |
function __construct($variable) | |
{ | |
$this->var = $variable; | |
} | |
function __get($var) |
This file contains hidden or 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
# From http://amix.dk/blog/post/19574 | |
def calculate_score(votes, item_hour_age, gravity=1.8): | |
return (votes - 1) / pow((item_hour_age+2), gravity) |
This file contains hidden or 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
from django.core.paginator import ObjectPaginator | |
class QuickObjectPaginator(ObjectPaginator): | |
max_safe_pages = 0 | |
def __init__(self, object_list, per_page, orphans=0, max_safe_pages=0): | |
self.max_safe_pages = max_safe_pages | |
super(QuickObjectPaginator, self).__init__(object_list, per_page, orphans) | |
def validate_page_number(self, page_number): |
NewerOlder