Skip to content

Instantly share code, notes, and snippets.

View pdeschen's full-sized avatar

Pascal Deschênes pdeschen

  • Montréal, Canada
View GitHub Profile
...
if (mBaseUrl.getProtocol().equals("https"))
{
UsernamePasswordCredentials credentials =
new UsernamePasswordCredentials(mAuthenticationUsername,
mAuthenticationPassword);
mHttpClient.getState().setCredentials(AuthScope.ANY, credentials);
def sequencer =
{ sequence, closure ->
if (dtmfSequencerEnabled)
{
for (dtmf in sequence)
{
switch (dtmf)
{
case "*":say("${baseAudioUrl}/dtmf/star.wav");;
case "#":say("${baseAudioUrl}/dtmf/pound.wav");
sequencer ("C10")
{ say( "Hello, and thank you for calling." ) }
say( "Hello, and thank you for calling." )
sequencer ("C20")
{
event = prompt(text, [
repeat:3,
timeout:7,
choices:listOptions( contacts ),
onEvent:
{ handlingEvent->
handlingEvent.onTimeout( {
sequencer ("C21")
event = prompt(text, [
repeat:3,
timeout:7,
choices:listOptions( contacts ),
onEvent:
{ handlingEvent->
handlingEvent.onTimeout( {
say( "I'm sorry, I didn't hear anything." )
}
)
@pdeschen
pdeschen / TropoSmsNotification.java
Created October 28, 2010 22:07
Sends a SMS message to provided number using Apache HttpClient
// Uses a very very simple tropo script configured for your application
// See http://github.com/pdeschen/nubot-labs/raw/master/tropo/src/Sms.groovy
HttpClient mHttpClient = new HttpClient();
String mBaseUrl = "http://api.tropo.com/1.0/sessions";
GetMethod method = new GetMethod();
// here we have to throttle. We can't have more then x sms/minutes.
@pdeschen
pdeschen / ip.rb
Created December 10, 2010 19:37
http client ip output
#!/usr/bin/ruby
require "cgi"
cgi = CGI.new("html3")
cgi.out() do
ENV['REMOTE_ADDR']
end
@pdeschen
pdeschen / update-dns.sh
Created December 10, 2010 19:46
dynamic geoscaling dns update
IP_ADDRESS=`curl http://labs.rassemblr.com/go/ip`
USERNAME=<yourusername>
PASSWORD=<yourpassword>
HOST=<yourAhost>
curl -u $USERNAME:$PASSWORD /
"http://api.geoscaling.com/dns2/dynamic/?host=$HOST&content=$IP_ADDRESS"
@pdeschen
pdeschen / serviceA.conf
Created December 17, 2010 19:03
Apache Virtual Host for Service A
Listen localhost:88
<VirtualHost localhost:88>
DocumentRoot /var/www/A
<Directory "/var/www/A/">
ErrorDocument 404 /
AddDefaultCharset UTF-8
Options FollowSymLinks MultiViews Includes
AllowOverride All
</Directory>
</VirtualHost>