Skip to content

Instantly share code, notes, and snippets.

View RobSpectre's full-sized avatar

Rob Spectre RobSpectre

View GitHub Profile
@RobSpectre
RobSpectre / test_script.py
Created November 24, 2015 19:40
Test new Twilio certificate
from twilio.rest import TwilioRestClient
ACCOUNT_SID = "ACxxxxxxxx"
AUTH_TOKEN = "yyyyyyyyyyy"
TWILIO_NUMBER = "+15556667777"
NUMBER_TO_TEXT = "+12223334444"
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN, base="https://api.twilio.com:8443")
client.messages.create(from_=TWILIO_NUMBER, to=NUMBER_TO_TEXT, body="Your system is ready for the upcoming change to the Twilio API's SSL certificate. No further action is needed.")
@RobSpectre
RobSpectre / insta_script.py
Created November 16, 2015 21:07
Instagram user search
from instagram.client import InstagramAPI
api = InstagramAPI(
client_id='XXXXXXXXXXXXXXXXXXXXXXXXX',
client_secret='YYYYYYYYYYYYYYYYYYYYYYYYYY')
search_results = api.user_search(q='natgeo')
print(search_results)
@RobSpectre
RobSpectre / sms.php
Created November 9, 2015 21:42
Get body of a Twilio SMS message in PHP
<?php
header('Content-type: text/xml');
$body = $_REQUEST['Body'];
?>
<Response />
for i in range(1, 17):
the_word = 'Bird'
if i % 4 == 0:
print "%s is the word." % the_word
else:
print "%s" % the_word
@RobSpectre
RobSpectre / app.py
Created September 5, 2015 20:34
Art museum example
from flask import Flask
from flask import request
from twilio import twiml
app = Flask(__main__)
@app.route('/sms', methods=['POST'])
@RobSpectre
RobSpectre / app.py
Last active September 5, 2015 21:13
Example Twitter alert checker using Twilio
from twilio.rest import TwilioRestClient
import simplejson as json
from time import sleep
class SocialAlarm(object):
def __init__(self):
self.counter = 1
@RobSpectre
RobSpectre / verify.txt
Created July 28, 2015 00:10
Onename.io
Verifying I am +robspectre on my passcard. https://onename.com/robspectre
from errbot.backends.test import testbot
from errbot import plugin_manager
class TestTwilioLookup(object):
extra_plugin_dir = '.'
def setUp(self):
self.plugin = plugin_manager.get_plugin_obj_by_name('TwilioLookup')
import logging
from errbot import BotPlugin
from errbot import botcmd
from twilio.rest.lookups import TwilioLookupsClient
import phonenumbers
@RobSpectre
RobSpectre / voice.xml
Created June 26, 2015 23:39
TwiML for Respect Our Privacy
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Play method="GET">https://s3.amazonaws.com/respect-our-privacy/message.mp3</Play>
<Dial>+13103015800</Dial>
</Response>