Skip to content

Instantly share code, notes, and snippets.

View RobSpectre's full-sized avatar

Rob Spectre RobSpectre

View GitHub Profile
@RobSpectre
RobSpectre / app.py
Created February 15, 2014 21:57
Setting a conversation cookie using Flask
from flask import Flask
from flask import session
from flask import make_response
from twilio import twiml
app = Flask(__name__)
@app.route('/tracking_conversation', methods=['POST'])
def tracking_conversation():
@RobSpectre
RobSpectre / app.py
Created February 15, 2014 17:05
Quick sketch of your use case
from flask import Flask
from flask import request
from twilio import twiml
from twilio.rest import TwilioRestClient
# Declare and configure application
app = Flask(__name__, static_url_path='/static')
app.config.from_pyfile('local_settings.py')
@RobSpectre
RobSpectre / app.py
Last active August 29, 2015 13:56
Caller ID Switcheroo
from flask import Flask
from flask import request
from twilio import twiml
# Declare and configure application
app = Flask(__name__)
# First step where we tell the user we are going to connect them to a phone number.
@app.route('/first_step', methods=['POST'])
@RobSpectre
RobSpectre / top.sls
Created November 22, 2013 19:37
Getting KeyError on "development" every time I run highstate. Full stacktrace: 2013-11-22 14:30:19,849 [salt.minion ][WARNING ] The minion function caused an exception: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/salt/minion.py", line 633, in _thread_return ret['return'] = func(*args, **kwargs) File "/usr/lib/pymodules/…
base:
'*':
- git
- users
- vim
- ssh
- python
- apt
- salt
@RobSpectre
RobSpectre / 1_gather.php
Created November 4, 2013 00:23
Example of taking a prompt and forwarding to two different numbers.
<?php
header('Content-type: text/xml');
?>
<Response>
<Gather action='/2_handler.php' numDigits='1'>
<Say>Press 1 for US support.</Say>
<Say>Press 2 for other support.</Say>
</Gather>
</Response>
@RobSpectre
RobSpectre / conference.xml
Created October 28, 2013 12:54
Example of building a conference call for Gabi.
<Response>
<Dial><Conference>Gabi's Conference Call</Conference></Dial>
</Response>
@RobSpectre
RobSpectre / app.py
Created October 18, 2013 11:03
Validating requests on GAE
import webapp2
import logging
from twilio.util import RequestValidator
from twilio import twiml
AUTH_TOKEN = 'xxxxx'
class MainPage(webapp2.RequestHandler):
def twilio_request_validator(self):
@RobSpectre
RobSpectre / anonymous_sms.php
Created September 21, 2013 20:09
Quick example of anonymizing SMS in PHP
<?php
$users = array("+15556667777", "+15556667778");
require_once('auth.php');
require_once('Services/Twilio.php');
$body = $_REQUEST['Body'];
$from = $_REQUEST['From'];
@RobSpectre
RobSpectre / error
Last active December 23, 2015 02:19
host.brooklynhacker.com:
Data failed to compile:
----------
Pillar failed to render with the following messages:
----------
Rendering SLS 'mysql' failed, render error:
found undefined alias 'Bxxxxxxxxxxxxxxxxxxxxxxxxxxx'
in "<unicode string>", line 2, column 18:
root_password: *Bxxxxxxxxxxxxxxxxxxxxxxx ...
@RobSpectre
RobSpectre / app.py
Created September 7, 2013 21:23
Pseudo code example of gather with python
from flask import Flask
from flask import request
from twilio import twiml
app = Flask(__name__)
@app.route('/gather', methods=['POST'])
def gather():
response = twiml.Response()