Lightweight text indexer for PHP
Uses the dba extension (with db4)
Hello my name is Arnold and I'm not crazy. Arnold's kids are crazy though.
| #!/bin/bash | |
| #### | |
| # Split MySQL dump SQL file into one file per table | |
| # based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump | |
| #### | |
| if [ $# -lt 1 ] ; then | |
| echo "USAGE $0 DUMP_FILE [TABLE]" | |
| exit |
| <?php | |
| /** | |
| * Turn all URLs in clickable links. | |
| * | |
| * @param string $value | |
| * @param array $protocols http/https, ftp, mail, twitter | |
| * @param array $attributes | |
| * @return string | |
| */ | |
| public function linkify($value, $protocols = array('http', 'mail'), array $attributes = array()) |
| <?php | |
| /** | |
| * Parent class | |
| */ | |
| class mother | |
| { | |
| protected $myvar; | |
| function __construct($value) |
| <?php | |
| $secretword = "secret"; # Change this before use | |
| $matches = null; | |
| if (!empty($_REQUEST['AUTH']) && preg_match('/^(\w++):(\d++):(\w++)$/', $_REQUEST['AUTH'], $matches)) { | |
| $username = str_rot13($matches[1]); | |
| $time = (int)$matches[2]; | |
| $authhash = $matches[3]; | |
| $logged_in = md5($username . $time . $secretword) === $authhash && $time >= time() - 3000; | |
| } |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteRule ^(.*)$ ../thumb.php [QSA,L] | |
| </IfModule> |
| #!/bin/bash | |
| for ID in $(xinput list | grep "Logitech Unifying Device" | perl -pe 's/^.*?id=(\d+).*$/\1/'); do | |
| xinput set-button-map $ID 1 2 3 4 5 6 7 8 9 2 11 12 13 14 15 16 17 18 19 20 2>/dev/null | true; | |
| done |
| function mvdown { mv "$1" /tmp/_mvdown_; rmdir $(dirname "$1"); mv /tmp/_mvdown_ $(dirname "$1"); } |
| <?php | |
| /** | |
| * A very simple autoloader | |
| */ | |
| class Autoloader | |
| { | |
| /** | |
| * Only use this class statically. | |
| * @ignore |
| <?php | |
| $files = array_slice($argv, 1); | |
| foreach ($files as $file) { | |
| $picture = file_get_contents($file); | |
| $size = getimagesize($file); | |
| // base64 encode the binary data, then break it into chunks according to RFC 2045 semantics | |
| $base64 = chunk_split(base64_encode($picture)); |