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 time | |
import tikteck # See https://github.com/mjg59/python-tikteck | |
import urllib2 | |
# Bulb connection information - HW address, name and password specific to your bulb. See tikteck repo for additional info. | |
bulb_config = ("00:21:4d:00:00:01", "Smart Light", "password") | |
def updateColor(bulb): | |
try: | |
latest_color = urllib2.urlopen('http://api.thingspeak.com/channels/1417/field/2/last.txt'); |
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
var seta = 'A train makes only two stops after its starting point. At the first stop, one third of the passengers get off and twenty new passengers get on. At the second stop, the remaining sixty passengers get off. How many passengers were there originally?'.replace(/[.,\/#!$%\^&\*";:{}=\-_`~()?]/g,"").split(' '); | |
["A", "train", "makes", "only", "two", "stops", "after", "its", "starting", "point", "At", "the", "first", "stop", "one", "third", "of", "the", "passengers", "get", "off", "and", "twenty", "new", "passengers", "get", "on", "At", "the", "second", "stop", "the", "remaining", "sixty", "passengers", "get", "off", "How", "many", "passengers", "were", "there", "originally"] | |
var alengths = []; | |
for(var i = 0; i < b.length; i++){ | |
alengths.push(seta[i].length); | |
} | |
[1, 5, 5, 4, 3, 5, 5, 3, 8, 5, 2, 3, 5, 4, 3, 5, 2, 3, 10, 3, 3, 3, 6, 3, 10, 3, 2, 2, 3, 6, 4, 3, 9, 5, 10, 3, 3] |
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
Charltons-MacBook-Air:clevbot charlton$ node main.js | |
BOT 1: What's up? | |
BOT 1: Oh Damn b1 | |
BOT 1: Okay Nothing. | |
BOT 2: Okay, sure. Eggs have nothing to do with the core concepts of Buddhism. | |
BOT 1: Maybe I would if you knew how to keep a relationship intact! | |
BOT 2: Okay Nothing. | |
BOT 1: Okay Nothing. | |
BOT 2: I can't. | |
BOT 2: It is movie with Jennifer Lawrence. |
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
// Have Cleverbot.io talk to itself | |
// Generally somewhat entertaining, see https://gist.github.com/ctrezevant/119a92c430a7a61134505995461abf66 for an | |
// example transcript. | |
// Charlton Trezevant - 2016 - Unlicense | |
var BOT1 = { | |
CLEVERBOTIO_API_USER: ' ', | |
CLEVERBOTIO_API_KEY: ' ', | |
CLEVERBOTIO_NICK: 'none', | |
}; |
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
var request = require('request'); | |
var IMGUR_API_KEY = '<your key here>'; | |
exports.fetchImage = function fetchImage(req, res) { | |
if (req.path === undefined || req.path.length <= 1) { | |
res.status(400).send('{"error":"No Data"}'); | |
return; | |
} |
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
// moved to https://github.com/ctrezevant/speedRacer ! |
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
/* Hardware configuration data is apparently handled by #pragma directives. | |
const static char* MOTOR_NAME = 'forward'; // Name of motor | |
const static POTENTIOMETER_PIN = 1; // analog port on VEX controller where pot connected | |
*/ | |
// Configuration and constants for mathematical calculations | |
const static int DEGREE_DISTANCE_BETWEEN_LETTERS = 10; // degree distance between each letter. Letters are equidistant from one another | |
const static int POINTER_TOLERANCE = 5; // Leeway for pointing to letter | |
const static int MOTOR_SPEED = 32; // Speed at which to move motor | |
const static int WAIT_TIME_SEC = 2; // Number of milliseconds to wait on each letter |
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
#pragma config(Sensor, in1, POT, sensorPotentiometer) | |
#pragma config(Motor, port1, MOTOR1, tmotorVex269_HBridge, openLoop) | |
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// | |
const static int TOLERANCE = 1; // Leeway for pointing to letter | |
const static int MOTOR_SPEED = 32; // Speed at which to move motor | |
const static int WAIT_TIME_SEC = 2; // Number of seconds to wait on each letter | |
// Function should return degree value of position of letters on the dial. | |
// (Forgive me, for I know not of how to implement a proper lookup table in C) |
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
var request = require('request'); | |
var IMGUR_API_KEY = ' '; | |
var PROXY_URL = 'us-central1-[...].cloudfunctions.net'; | |
exports.album = function album (req, res) { | |
if (req.path === undefined || req.path.length <= 1) { | |
res.status(400).send('{"error":"No Data"}'); | |
return; | |
} |
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
/* Documentation: | |
* Assuming an Arduino Mega with the Adafruit Motor Shield and a | |
* stepper motor with a 1.8deg resolution connected to M1 and M2 | |
* Your IDE should have the AFMotor library installed before compilation. | |
* This software manages the movement of a dial connected to a stepper motor, | |
* for use in the demonstration of a caesar cipher (see https://en.wikipedia.org/wiki/Caesar_cipher) | |
* How movement is calculated: | |
* Steps per revolution: (360/motorResolution) + optional stepOffset | |
* Steps to move: (stepsPerRevolution/dialSections) * shiftAmount | |
* Examples: |