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
function pub_subscribe(){ | |
pubnub.subscribe({ | |
channel : channel_output, | |
message : function(m){ | |
console.log(m); | |
message_listing(m); | |
}, | |
error : function (error) { | |
console.log(JSON.stringify(error)); | |
} |
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
function pub_publish(pub_msg){ | |
pubnub.publish({ | |
channel : channel_input, | |
message : pub_msg, | |
callback : function(m){ | |
console.log(m); | |
} | |
}); | |
}; |
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 pubnub = PUBNUB({ | |
publish_key : /* YOUR PUBLISH KEY*/, | |
subscribe_key : /* YOUR SUBSCRIBE KEY*/ | |
}) |
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
db.get(request.message.userMessage).then((database_value)=>{ | |
console.log("FETCHED DATABASE VALUE",database_value); | |
var feedback = request.message.userMessage; // Extract the feedback from the incoming Message. | |
fetchUserFeedback(feedback); | |
console.log(request.message); | |
}); |
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
def _callback(message,channel): | |
if message["type"]=="request" : | |
print" Received message = ", message["play"] | |
status=subprocess.call(["espeak","-s 120 -v en ",message["play"]], stdout=FNULL, stderr=subprocess.STDOUT) | |
if status==0 : | |
pubnub.publish(pubnub_responsechannel, postive_response) | |
elif status!=0 : | |
pubnub.publish(pubnub_responsechannel,negative_response) |
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
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection { | |
// if we're paused don't do anything | |
if(self.currentState==STATE_PAUSED) { | |
// reset our frame counter | |
self.validFrameCounter=0; | |
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
private static PreviewCallback previewCallback = new PreviewCallback() { | |
/** | |
* {@inheritDoc} | |
*/ | |
@Override | |
public void onPreviewFrame(byte[] data, Camera cam) { | |
if (data == null) throw new NullPointerException(); | |
Camera.Size size = cam.getParameters().getPreviewSize(); | |
if (size == null) throw new NullPointerException(); |
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
$('#toggle').click(function(e){ | |
pubmsg = { "req" : "toggle" }; | |
pubnub.publish( | |
{ | |
channel : 'gpio-raspberry-control' , | |
message : pubmsg | |
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 os | |
import sys | |
import glob | |
import dlib | |
from skimage import io | |
from skimage.draw import polygon_perimeter | |
import traceback |
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
# Function to close the dashdb connection | |
def dbclose(self): | |
try: | |
retrn = ibm_db.close(self.connection) | |
return retrn | |
except Exception as dbcloseerror: | |
logging.error("dbclose Exception %s"%(dbcloseerror)) | |
return False |