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
{ | |
"name": "webserver", | |
"default_attributes": { | |
"apache2": { | |
"listen_ports": [ | |
"8080", | |
"443" | |
] | |
} | |
}, |
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 ruby | |
require 'rubygems' | |
require 'xmlsimple' | |
require 'flotr' | |
log = XmlSimple.xml_in('blah.log') | |
f = Flotr::Data.new(:label => "Total Response", :color => "red") |
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 ruby | |
require 'rubygems' | |
require 'fastercsv' | |
require 'json' | |
class Cvs2json | |
attr_reader :csv | |
def initialize(filename) | |
@filename = filename |
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
// Time interval, this executes one piece of code from time to time | |
// Download Metro lybrary and instructions: | |
// http://www.arduino.cc/playground/Code/Metro | |
#include <Metro.h> | |
int duration = 3500; // duration of the interval in miliseconds | |
Metro intervaller = Metro (duration); | |
// servos minimum and maximum position | |
#define MIN_POS 2700 // the minuimum pulse width for your servos | |
#define MAX_POS 5000 // maximum pulse width for your servos |
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 | |
$result = db_query('SELECT filename, name FROM {system}'); | |
while ($mod = db_fetch_array($result)) { | |
exec('find . -name ' . basename($mod['filename']), $modpath_arr); | |
if (count($modpath_arr) == 1) { | |
$modpath = ltrim($modpath_arr[0], './'); | |
$dbpath = $mod['filename']; | |
if ($dbpath != $modpath) { |
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 | |
DBHOST='localhost' | |
DBUSER='root' | |
SITENAME="${1}" | |
DBNAME="${SITENAME}" | |
stty -echo | |
read -p "MySQL Password: " DBPASS; | |
stty echo |
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 | |
function drupal_commons_add_role($name) { | |
module_load_include('inc', 'user', 'user.admin'); | |
$form_state = array(); | |
$form_state['values']['name'] = $name; | |
$form_state['values']['op'] = "Add role"; | |
drupal_execute('user_admin_role', $form_state); | |
} |
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
[difftool] | |
prompt = false | |
[diff] | |
tool = Kaleidoscope | |
[core] | |
; Don't trust file modes | |
filemode = false | |
[color] | |
ui = auto | |
status = auto |
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 | |
function strip_inline_styles($string, $allowed_styles = array()) { | |
$pattern = '/style="([^"\']+)"/'; | |
$parsed = preg_replace_callback($pattern, function($match = NULL) use($allowed_styles) { | |
// Get style attribute values | |
$styles = $match[1]; | |
// Parse each sytle out | |
$pattern2 = "/(?:([\w-]+?):([\w-]+);?)/"; | |
$parsed_styles = preg_replace_callback($pattern2, function($match2 = NULL) use($allowed_styles, $styles) { |
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 roundup | |
describe drush | |
before() { | |
__DIR__="$PWD" | |
rm -rf .sandbox | |
mkdir -p .sandbox | |
cd .sandbox | |
} |