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: utf-8 -*- | |
# Author: Viktor Stískala | |
# Contact: viktor (at) stiskala.cz | |
# Copyright: This module has been placed in the public domain. | |
""" | |
This module removes language specific characters from file name | |
and makes it more usable for web. Can be also used as nautilus user script |
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 | |
/** | |
* Extended form renderer. | |
* | |
* @author Viktor Stískala <viktor(at)stiskala.cz> | |
*/ | |
class CustomRenderer extends ConventionalRenderer | |
{ | |
/** | |
* Renders 'control' part of visual row of controls. |
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/bash | |
# Wonder Shaper | |
# please read the README before filling out these values | |
# | |
# Speed/Rate syntax: tcng vs. tc | |
# source: http://www.faqs.org/docs/Linux-HOWTO/Traffic-Control-tcng-HTB-HOWTO.html | |
# | |
# tcng English tc | |
# ---------------------------------------------- | |
# bps bit(s) per second bit |
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/bash | |
# | |
# Transliterate and clean C code using iconv and GNU Indent | |
# Created: 2010-10-21 | |
# Author: Viktor Stískala, viktor@stiskala.cz | |
# | |
filename="$1" | |
encoding="$2" |
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
/* | |
Requires browscap.ini configuration, more info at http://php.net/manual/en/function.get-browser.php | |
*/ | |
$this->template->registerHelper('browser', function($s) { | |
$brs = get_browser($s); | |
if($brs === false) | |
return 'N/A'; | |
// ex.: Firefox 3.6/Linux | |
return $brs->browser . ' ' . $brs->version . '/' . $brs->platform; | |
}); |
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/bash | |
# Resursively change owner to www-data | |
# | |
# Created: 2011-05-12 | |
# Author: Viktor Stiskala <viktor@stiskala.cz> | |
LOGFILE=/var/log/wwwdata | |
## Add following line tu sudoers file (using visudo command) in order to allow | |
## users from www-data group to change owners under /var/www/ |
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/bash | |
# MySQL backup script | |
# Creates database dump file for each database. | |
# Created: 2010-09-27 | |
# config | |
BACKUP_USER=backup | |
BACKUP_DIR=/var/backups/mysql | |
LOGFILE=/var/log/mysql_backup |
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
from django.http import HttpResponse | |
from mimetypes import guess_type | |
import settings | |
import re, os | |
class XSendFileError(Exception): | |
pass | |
class XSendFileResponse(HttpResponse): | |
def __init__(self, file_path, content_type=None): |
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/bash | |
if [ -z $1 ] | |
then | |
echo "Usage: include filename" 1>&2 | |
exit 1 | |
fi | |
filename="/usr/include/$1" | |
if [ ! -f $filename ]; then | |
echo "File not found" 1>&2 |
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 math | |
import hashlib | |
def bytes_to_hex(str): | |
return ''.join( [ "%02x" % ord( x ) for x in str] ).strip() | |
def chunk_hashes(str): | |
""" | |
Break up the byte-string into 1MB chunks and return sha256 hashes | |
for each. |
OlderNewer