Skip to content

Instantly share code, notes, and snippets.

@prufrock
prufrock / createProjectsDomain.php
Created March 3, 2012 22:53
create a simpleDB domain named projects
<?php
$sdb = new AmazonSDB("accessKey", "secretKey");
$sdb->setRegion(AmazonSDB::REGION_US_E1);
$response = $sdb->create_domain("projects");
print_r($response);
@prufrock
prufrock / queuesNstuff.php
Created February 22, 2012 02:12
Use the AWS sdk for PHP to retreive a single record by ID or by scanning based the value of an attribute
<?php
require_once('aws-sdk-for-php/sdk.class.php');
$table_name = "queuesNStuff";
function outputArray($output)
{
print_r(nl2br(print_r($output->body->to_array(), TRUE)));
}
function outputJson($output)
{
@prufrock
prufrock / appendWordToAnkiQuestion.pl
Created February 4, 2012 07:07
a quick script I threw together to append the word "perl" to my deck of anki cards
#!/usr/bin/perl
use DBI;
use Data::Dumper;
# Configuration Information
my $EOL = "\n";
my $dbFile = "perl.anki";
my $scriptStarting = "starting$EOL";
my $scriptComplete = "done$EOL";
my $sqlSelectAllCards = "SELECT * FROM cards";
@prufrock
prufrock / OpenTest.vim
Created September 1, 2011 05:02
A vim function that tries to guess where a PHP unit test is at.
function! OpenUnitTest()
let file = expand("%:p")
let words = split(getline(search('^class ')))
let words = split(words[1],"_")
let paths = matchlist(file, '\([A-Za-z0-9/].*\)/application')
let head = paths[1]
let path = "/tests"
let counter = 0
for word in words
if counter < 2
@prufrock
prufrock / simpleform.js
Created August 14, 2011 02:40
JSON object of objects
var simpleForm = { "elements":
{ "verb" :
{ "label" : "verb",
"id" : "verb",
"type" : "text",
"size" : "50" ,
"element" : "input"
},
"url" :
{ "label" : "url",
@prufrock
prufrock / ViewHelperSkeleton.php
Created April 7, 2011 02:46
A Skeleton of a Zend_View_Helper should be placed in application/views/helpers/ViewHelperSkeleton.php.
<?php
class Zend_View_Helper_ViewHelperSkeleton extends Zend_View_Helper_Abstract
{
public $view;
/**
* Allows the view to be passed into the helper for later use.
*/
public function setView(Zend_View_Interface $view)
{
@prufrock
prufrock / SkeletonControllerTest.php
Created March 31, 2011 03:08
A skeleton for Zend Framework controller tests.
<?php
if(!defined('TEST_PATH')){
DEFINE('TEST_PATH', '../..');
}//if
require_once TEST_PATH . '/library/ControllerTestCase.php';
require_once APPLICATION_PATH . '/controllers/SkeletonController.php';
/**
* Test class for SkeletonController.
*/
@prufrock
prufrock / incrementVersion.sh
Created March 30, 2011 03:39
uses perl in an awk like manner to increment a version number
#!/bin/sh
perl -i -pe ';s/(Version: [0-9]+\.[0-9]+\-)([0-9])//; if($1){print $1 . ($2 + 1)}' package/DEBIAN/control
@prufrock
prufrock / copyIso.bat
Created March 29, 2011 02:28
copy iso files to a windows file share
copy *.isp \\server\home\ubuntu\iso
@prufrock
prufrock / chrootForSflPhoneBuild.sh
Created March 28, 2011 14:57
packages installed into a bare ubuntu chroot to build sflphone
#!/bin/sh
package=sflphone_20110328-1_amd64.deb
packageDir=sflphone_20110328-1_amd64
apt-get install libtool autoconf pkg-config libasound2-dev libpulse-dev libsamplerate0-dev libcommoncpp2-dev libccrtp-dev libzrtpcpp-dev libssl-dev libexpat1-dev libpcre3-dev libgsm1-dev libspeex-dev libspeexdsp-dev libyaml-dev
cd /opt/SFLWebService/sflphone-0.9.11/sflphone-common/libs/pjproject
./autogen.sh
./configure
make dep && make
cd /opt/SFLWebService/sflphone-0.9.11/sflphone-common
./autogen.sh