Skip to content

Instantly share code, notes, and snippets.

View leah's full-sized avatar
:shipit:
Always shipping.

Leah Culver leah

:shipit:
Always shipping.
View GitHub Profile
def make_call():
client = Client(account_sid, auth_token)
client.calls.create(url='http://demo.twilio.com/docs/voice.xml', to='+14155555555', from_=from_number)
@sched.scheduled_job('cron', hour=15)
def scheduled_job():
print('This clock job is run every day at 3pm utc / 8 am pst.')
send_text(message='Good morning from the Banksy pickup app! ☀️ Checking for updates every minute.')
from pytz import utc
from apscheduler.schedulers.blocking import BlockingScheduler
from pickup.send import send_text, check_changes
print('Setting up scheduler...')
sched = BlockingScheduler(timezone=utc)
@sched.scheduled_job('interval', minutes=1)
def timed_job():
# This should probably be done in the background but whatever
from django.http import HttpResponse
from .send import send_text, check_changes
def index(request):
changed, message = check_changes()
send_text(message=message)
return HttpResponse(message)
from twilio.rest import Client
account_sid = 'xxx'
auth_token = 'xxx'
from_number = '+15555555555'
def send_text(message):
client = Client(account_sid, auth_token)
# Send text message
client.messages.create(body=message, from_=from_number, to='+14155555555')
def check_changes():
# HTML from website
req = requests.get('https://grossdomesticproduct.com')
web_text = req.text
# Saved HTML
try:
file = open('grossdomesticproduct.html')
file_text = file.read()
file.close()
@leah
leah / clock.py
Last active October 23, 2019 20:40
A simple Django app to check grossdomesticproduct.com for updates.
from pytz import utc
from apscheduler.schedulers.blocking import BlockingScheduler
from pickup.send import send_text, make_call, check_changes
print('Setting up scheduler...')
sched = BlockingScheduler(timezone=utc)
@sched.scheduled_job('interval', minutes=1)
def timed_job():
# This should probably be done in the background but whatever

Keybase proof

I hereby claim:

  • I am leah on github.
  • I am leah (https://keybase.io/leah) on keybase.
  • I have a public key whose fingerprint is 2D14 C336 3072 06C4 7A73 F36D 345D 052E 584B 5710

To claim this, I am signing this object:

@leah
leah / index.html
Created March 17, 2014 16:20
Lucky Shamrock
<!doctype html>
<html>
<head>
<title>Lucky Shamrock</title>
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://www.dropbox.com/static/api/dropbox-datastores-1.0-latest.js"></script>
</head>
<body>
<h1>Lucky Shamrock</h1>
import json
import urllib
import urllib2
import time
""" Nike plus activity log
https://developer.nike.com
Output:
-- May --