View memcached-tool
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/perl | |
# | |
# memcached-tool: | |
# stats/management tool for memcached. | |
# | |
# Author: | |
# Brad Fitzpatrick <brad@danga.com> | |
# | |
# License: | |
# public domain. I give up all rights to this |
View gist:70a802c015ce74d610e3
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/sh | |
# | |
# Run `drush updb` in parallel in groups of 5. | |
# | |
# The for loop is populated by running `drush sa`, but this could also be a | |
# file with aliases on each line. | |
# | |
# The | |
i=0 |
View war.pas
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
program WAR; | |
uses crt,DispANS,TextCursor; | |
const | |
top = 1; | |
whichCards : array[2..14] of char = | |
('2','3','4','5','6','7','8','9','0','J','Q','K','A'); | |
type setCards = array[2..14] of integer; |
View gist:2dd1ad7f5092e4846fb9
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
# | |
# Create random password for every Drupal user from uid 1 to uid 45 | |
# @todo - variable user ID sequence? | |
# | |
for uid in $(seq 45); do uname=$(drush user-information $uid 2>/dev/null | grep -oP "(?<=User name \: ).+"); if [ -n "${uname}" ]; then drush user-password "$uname" --password=$(date | md5sum); fi done |
View gist:b0c7cb8cc1bba905f804
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
for alias in `drush sa`; do echo $alias; drush @$alias updb -y; done |
View basicauthtest.sh
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 | |
vhosts=/etc/apache2/sites-enabled/* | |
for f in $vhosts | |
do | |
servername=`grep ServerName $f | sed 's/\s*ServerName\s*//g' - | head -n1` | |
for s in $servername | |
do | |
url="http://$s https://$s" | |
for protocol in $url |
View theme_D6MODULE_table_form.php
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 | |
/** | |
* Theme a series of form elements into a table (Drupal 6), with optional | |
* tabledrag.js support. | |
*/ | |
function theme_D6MODULE_admin_table_form($form) { | |
$header = array(); | |
$rows = array(); |
View gist:5706405
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 | |
if ($order_id = db_result(db_query("SELECT order_id FROM {fundraiser_webform_order} WHERE sid = %d", $_GET['sid']))) { | |
$order = uc_order_load($order_id); | |
$order_total = isset($order->order_total) ? $order->order_total : 0; | |
} | |
?> |
View wordcount.php
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 | |
/** | |
* @file | |
* Find out which words are most commonly used in song lyrics. | |
*/ | |
$wordcounts = array(); | |
$lines = file('album/song.txt'); | |
foreach ($lines as $line_num => $line) { |
View .profile
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
alias now='/bin/date +%s' | |
# Convert a timestamp | |
unixtime() { | |
php -r 'if (isset($argv[1]) && is_numeric($argv[1])) print date(DATE_RSS, $argv[1]) . "\n";' $1 | |
} | |
# Local VM config | |
export localvmname="Debian32" |
NewerOlder