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/perl -wl | |
use strict; | |
use File::Glob ':glob'; | |
my $sitesdir = shift || "/mnt/Sites/"; | |
sleep 1 while (!(chdir($sitesdir))); | |
my @sites = bsd_glob('*/{repo,trunk}'); |
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/perl | |
use Sys::Syslog qw( :DEFAULT setlogsock ); | |
openlog('httpd', 'cons,pid', LOG_LOCAL0); | |
while ($log = <STDIN>) { | |
syslog(LOG_NOTICE, $log); | |
} | |
closelog |
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
# Go to a specified git repo in $HOME/Sites | |
repo() { | |
local reponame=$1 | |
local jumpto_type=$2 | |
local jumpto_which=$3 | |
local basedir="$HOME/Sites/$reponame" | |
local cd_to | |
if [ -z $reponame ]; then | |
echo "usage: repo reponame [type [which]]" |
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 | |
/** | |
* Memcache config | |
*/ | |
// Check that one of the two memcache extensions are loaded. | |
if (extension_loaded('memcache') || extension_loaded('memcached')) { | |
if (!is_array($conf)) { | |
$conf = array(); |
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
-- Use this query when preparing to move cache tables into memcache bins | |
-- to estimate how big the bins should be (or how many will be necessary). | |
SELECT count(*) tables, | |
concat(round(sum(data_length)/(1024*1024),2),'M') data, | |
concat(round(sum(index_length)/(1024*1024),2),'M') idx, | |
concat(round(sum(data_length+index_length)/(1024*1024),2),'M') total_size | |
FROM information_schema.TABLES | |
WHERE table_schema LIKE '<<DRUPAL DATABASE NAME>>' | |
AND table_name like "cache%" | |
-- Exclude any cache tables you know won't be in memcache: |
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
#!/bin/sh | |
nice -n 20 /Applications/Phoshare.app/Contents/MacOS/Phoshare -o -d -u -l -e . --export ~/Dropbox/Photos/Phoshare\ Backup/ |
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 | |
/** | |
* Theme a series of form elements into a table (Drupal 6). | |
*/ | |
function theme_D6MODULE_table_form($form) { | |
$header = array(); | |
$rows = array(); | |
foreach (element_children($form) as $i) { |
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 | |
/** | |
* Theme a series of form elements into a table (Drupal 7). | |
*/ | |
function theme_D7MODULE_table_form($variables) { | |
$form = $variables['form']; | |
$header = array(); | |
$rows = array(); |
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
# Gist tag Jekyll plugin | |
# | |
# From: | |
# http://brandontilley.com/2011/01/30/gist-tag-for-jekyll.html | |
require 'cgi' | |
require 'digest/md5' | |
require 'net/https' | |
require 'uri' |
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 | |
/** | |
* @file | |
* Example of how to take a textarea form element and explode it into an array | |
* before saving it to a variable via `system_settings_form()`. | |
*/ | |
/** | |
* Admin settings form. |