Skip to content

Instantly share code, notes, and snippets.

@xdissent
xdissent / super_group_acl.sh
Created March 27, 2010 15:12
Grant all file permissions to a group
chmod +a "group:<group name>:allow:delete,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown,list,search,add_file,add_subdirectory,delete_child,read,write,append,execute,file_inherit,directory_inherit" <directory | file>
@xdissent
xdissent / flac_batch.sh
Created March 26, 2010 23:52
Batch convert FLAC audio files to WAV
mkdir -p wav && for a in *.flac; do flac -d -o "wav/`basename -s .flac $a`.wav" "$a"; done
@xdissent
xdissent / doctrine.php
Created March 19, 2010 14:25
Doctrine CLI script for Zend Server CE on Snow Leopard
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
@xdissent
xdissent / parametize_links.php
Created March 3, 2010 23:11
Add GET params to links in HTML.
@xdissent
xdissent / thesis-span-logo-words.php
Created February 19, 2010 23:55
Wrap logo words in spans for Thesis WordPress theme.
<?php
// Override default header.
function custom_default_header() {
// Get the default header.
ob_start();
thesis_default_header();
$output = ob_get_clean();
@xdissent
xdissent / jcroft regex
Created February 19, 2010 01:04
Regex to convert "Last, First" to "First Last"
s/([^,]+),\s+(.*)/\2 \1/
@xdissent
xdissent / WordPress word count for all posts.
Created October 2, 2009 02:26
SQL to get the WordPress word count for all posts.
SELECT SUM(LENGTH(post_content) - LENGTH(REPLACE(post_content, ' ', '')) + 1) as 'Word Count' FROM `wp_posts` WHERE post_status='publish' AND post_type='post';