This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruleset a163x85 { | |
meta { | |
name "RESTful web service" | |
description << | |
Experimenting with creating a RESTful web service with KRL | |
>> | |
author "Steve Nay" | |
logging off | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruleset a163x75 { | |
meta { | |
name "Postmark example" | |
description << | |
Uses the Postmark module to send an email when called through a bookmarklet | |
>> | |
author "Steve Nay" | |
logging off | |
key postmark { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruleset a163x63 { | |
meta { | |
name "StringBin module" | |
description << | |
Module for the StringBin API (http://stringbin.com/). | |
Version 1 of the API provides two functions: read and write. While | |
the API provides the ability to use callbacks, this is not reflected | |
here, as they are not necessary in the context of KRL. | |
>> | |
author "Steve Nay" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageDraw | |
def main(): | |
# Open the original image | |
main = Image.open("12voltm.jpg") | |
# Create a new image for the watermark with an alpha layer (RGBA) | |
# the same size as the original image | |
watermark = Image.new("RGBA", main.size) | |
# Get an ImageDraw object so we can draw on the image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
import time | |
import boto | |
import json | |
from boto.sqs.message import RawMessage | |
AWSKey = "{redacted}" | |
AWSSecret = "{redacted}" | |
testQueue = "testqueue" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Testing Chrome desktop notifications</title> | |
<script type="text/javascript" language="javascript"> | |
var icon = 'http://farm1.static.flickr.com/79/245536726_94521c750d_s.jpg'; | |
function showPopup() { | |
window.webkitNotifications.requestPermission(function() { | |
var popup = window.webkitNotifications.createNotification( | |
icon, 'Message Title', 'Message body'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Submitted an automated comment to that image. | |
Go <a href="http://imaj.lddi.org/view?imagekey=$key">view it</a>.</p> | |
<p><a href="/simpldb">Return</a></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
smsdate = function(d){ | |
datestringA = time:strftime(d, "on %A (%B %d) at %I %M %p"); | |
datestringB = datestringA.replace(re/ 0/g, " ").replace(re/ 0/g, " "); | |
datestringB; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rule sms is active { | |
select when twilio sms | |
pre { | |
messagetext = event:param("Body"); | |
sender = event:param("From"); | |
nextevent = officehours:next("Office hours"); | |
eventtime = nextevent => smsdate(nextevent.pick("$.when[0].start")) | "not scheduled. See the class wiki for info"; | |
} | |
if officehours:onnow("Office hours") then { | |
noop(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rule call is active { | |
select when twilio onanswer | |
if officehours:onnow("Office hours") then { | |
noop(); | |
} | |
fired { | |
raise explicit event call_present; | |
} else { | |
raise explicit event call_not_present; | |
} |