Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Always shipping.

Leah Culver leah

:shipit:
Always shipping.
View GitHub Profile
View make_call.py
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)
View morning.py
@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.')
View clock_text.py
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
View banksy_pickup.py
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)
View twilio_text.py
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')
View changes.py
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 Oct 23, 2019
A simple Django app to check grossdomesticproduct.com for updates.
View clock.py
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
View keybase.md

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 Mar 17, 2014
Lucky Shamrock
View index.html
<!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>
View nike-export.py
import json
import urllib
import urllib2
import time
""" Nike plus activity log
https://developer.nike.com
Output:
-- May --