Skip to content

Instantly share code, notes, and snippets.

View crcastle's full-sized avatar
:shipit:

Chris Castle crcastle

:shipit:
View GitHub Profile
@crcastle
crcastle / LeaveVoicemail.js
Created November 10, 2010 05:13
Prompts user to leave voicemail, then records up to 5 minutes
[
{"name":"playback","filename":"vm-theperson"}
,{"name":"playback","filename":"vm-isunavail"}
,{"name":"playback","filename":"vm-leavemsg"}
,{"name":"playback","filename":"beep"}
,{"name":"Record","filename":"sounds/voicemail_test.wav","maxduration":"300"}
]
@crcastle
crcastle / IncomingCallExt1.js
Created November 10, 2010 05:35
Accept incoming call, forward to extension 1 for 20 seconds, then send to voicemail URL
[
{"name":"Dial","destination":"1","url":"http://llama.fm","timeout":"20"}
]
@crcastle
crcastle / cloudvox.rb
Created December 4, 2010 20:54
Talk to cloudvox web API
require 'yaml'
require 'rest_client'
require 'json'
class Cloudvox
def initialize
@cv_config = YAML.load_file 'cloudvox_account.yml'
#cloudvox_account.yml format
#
@crcastle
crcastle / nodejs.sh
Created December 29, 2010 00:39
Node.js tartup script for AWS EC2 Linux box
#!/bin/bash
# nodejs - Startup script for node.js server
# chkconfig: 35 85 15
# description: node is an event-based web server.
# processname: node
# server: /path/to/your/node/file.js
# pidfile: /var/run/nodejs.pid
#
@crcastle
crcastle / gist:1124075
Created August 3, 2011 23:00
C4's janky stuff
<?php
require_once("Net/SSH2.php");
$passwd='sup3rs3cr3t';
$user='username';
$server='remoteserver.com';
$ssh = new Net_SSH2($server);
if (!$ssh->login($user, $passwd)) {
exit('Login Failed');
}
$who = $ssh->exec('whoami');
@crcastle
crcastle / file1.js
Created September 3, 2011 03:56 — forked from TooTallNate/file1.js
module.exports = function (a, b) {
return a + b
}
// Production steps of ECMA-262, Edition 5, 15.4.4.18
// Reference: http://es5.github.com/#x15.4.4.18
if (!Array.prototype.forEach) {
Array.prototype.forEach = function( callback, thisArg ) {
var T, k;
if ( this == null ) {
throw new TypeError( " this is null or not defined" );
}
var O = Object(this);
var len = O.length >>> 0;
@crcastle
crcastle / autoclose_janus
Created September 5, 2011 23:51 — forked from jackkinsella/autoclose_janus
How to add autoclose to Janus
#~/.janus.rake file
vim_plugin_task "autoclose", "git://github.com/Townk/vim-autoclose.git"
#~/vimrc.local file
let g:AutoClosePairs = {'(': ')', '{': '}', '[': ']', '"': '"', "'": "'", '#{': '}', '|':'|' }
let g:AutoCloseProtectedRegions = ["Character"]
@crcastle
crcastle / gist:1295761
Created October 18, 2011 15:46
What to do if a BigTuna build job hangs
# log on to big tuna box
# become tuna user
sudo su tuna
# stop the delayed_job process
cd /home/tuna/bigtuna
RAILS_ENV=production ./script/delayed_job stop
# clear the job queue
RAILS_ENV=production bundle exec rake jobs:clear
@crcastle
crcastle / gist:1524814
Created December 27, 2011 19:04 — forked from arnorhs/gist:1517095
gitopen - Open all files from a git diff or show command
#!/bin/bash
# This script will open all files from a git diff or a git show in vim.
# My bash skills are a bit primitive so this can probably be done more intelligently
# Usage:
# gitopen -- opens all added files that have changed since HEAD
# gitopen diff HEAD -- these are the default parameters
# gitopen diff master -- opens files that have changed from master