Skip to content

Instantly share code, notes, and snippets.

@libryder
libryder / jules-verne-doodle.js
Created November 24, 2011 19:52
Google's Jules Verne doodle obfuscated javascript
<script>
(function() {
var d = true,
g = false,
h = window,
i = h.google,
j = document,
k = "push",
l = "getElementById",
m = "targetTouches",
<!--Begin Report Picker-->
<div class="box2 title1">
<div class="rt-block">
<div class="module-title"><h2 class="title">Reports:</h2></div>
<div class="rt-module-inner">
<div class="module-content">
<form action="" method="POST" accept-charset="UTF-8" name="search">
<div id="modify-search-content" class="">
<select style="width:100%;" name="report_name" value="Select Report" id="report_name" onChange="load_report(this.value, getRefineVals());">
<option selected="selected" value="">Select Report</option>
@libryder
libryder / automount.sh
Created December 14, 2011 15:49
Auto SFTP mount script
#!/bin/bash
#
# Copyright (c) Finnbarr P. Murphy 2011. All rights reserved.
#
#
# ARGUMENTS: All are mandatory.
#
# l - Local folder name. This is the mount point for auto.master
# i - Local indirect name. This is the first field of auto.sshfs
# The combination of l x i provides infinite flexibility
@libryder
libryder / api_class.php
Created December 14, 2011 16:56
LogMyCalls API PHP Sample
<?php
/* LogMyCalls public API
*
* PHP Sample
* Author: David Ryder
* [email protected]
* http://github.com/libryder
*
* The LmcApi is a JSON wrapper using CURL to send and receive data
@libryder
libryder / dialplan.rb
Created January 12, 2012 17:14
Outbound dialer example in Adhearsion
# Check pin number against user's attempt, wait for a number to dial, connect caller to callee and play disclaimer to callee
# The method of setting these variables has been simplified for clarity
pin = '1234'
caller_id = '1112223333'
play_prompt = true
tts = '...'
if play_prompt
tts = format_ssml("Please enter your pin number.")
@libryder
libryder / dialplan.rb
Created January 19, 2012 16:23
Attempt at adhearsion canadian georouting
#return a 6 digit DTMF entry from the caller
postcode = input 6, :speak => { :text => 'enter your postal code' }
postparts = postcode.split(//)
#simple map of possible alphabetical entries for a canadian post code
dtmf_map = { '2' => ['"A"','"B"','"C"'], '3' => ['"E"'], '4' => ['"G"','"H"'], '5' => ['"J"','"K"','"L"'], '6' => ['"M"','"N"'], '7' => ['"P"','"R"','"S"'], '8' => ['"T"','"V"'], '9' => ['"X"','"Y"'] }
#first, third, and fifth characters are always alphabetical
first_char = dtmf_map[postparts[0]].join(',')
@libryder
libryder / app_swift-2.0.patch
Created January 25, 2012 16:30
app_swift patch to fix segfault bug
diff -ruN app_swift-2.0_ast-1.6.orig/app_swift.c app_swift-2.0_ast-1.6/app_swift.c
--- app_swift-2.0_ast-1.6.orig/app_swift.c 2010-06-16 08:35:30.000000000 +0930
+++ app_swift-2.0_ast-1.6/app_swift.c 2010-08-17 20:31:08.000000000 +0930
@@ -409,7 +409,8 @@
ASTOBJ_WRLOCK(ps);
ps->immediate_exit = 1;
ASTOBJ_UNLOCK(ps);
- } else if (f->frametype == AST_FRAME_DTMF && timeout > 0 && max_digits > 0) {
+ } else {
+ if (f->frametype == AST_FRAME_DTMF && timeout > 0 && max_digits > 0) {
@libryder
libryder / medium.rb
Created January 25, 2012 17:15
Convert wav -> mp3 and upload to S3
class Medium < ActiveRecord::Base
attr_accessible :title, :wav
has_attached_file :wav,
:styles => {
:mp3 => {
:params => "-encode --vbr-new -V7",
:format => "mp3" }
},
:default_style => :normal,
:processors => [:wav_mp3],
class CallFlow < ActiveRecord::Base
belongs_to :routable, :polymorphic => true
def dialplan
puts self.routable.description.squeeze("\n").strip
end
def target_route=(params)
self.routable = params[:kind].constantize.new(params.reject {|k,v| k == "kind"})
end
@libryder
libryder / scheduling.rb
Created February 1, 2012 20:34
A sample scheduling solution for rufus-scheduler running in Apache
require 'server_mon'
require 'call_testing'
SCHEDULER = Rufus::Scheduler.start_new
TESTCALL = SCHEDULER.every '10m', :tags => 'testcall' do
CallTesting.test_call
end
CALLENGINE_MON = SCHEDULER.every '5m', :tags => 'callengine' do