Skip to content

Instantly share code, notes, and snippets.

View shyampurk's full-sized avatar

Shyam Purkayastha shyampurk

View GitHub Profile
@shyampurk
shyampurk / EventCustFeedback-Subscribe
Created February 19, 2018 04:58
Event Customer Feedback Subscribe
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));
}
@shyampurk
shyampurk / EventCustFeedback-FormSubmit
Created February 19, 2018 04:52
Event Customer Feedback Form Submit
function pub_publish(pub_msg){
pubnub.publish({
channel : channel_input,
message : pub_msg,
callback : function(m){
console.log(m);
}
});
};
@shyampurk
shyampurk / eventCustFeecback-PubNubInit
Created February 19, 2018 04:45
Event Customer Feedback PubNub Init
var pubnub = PUBNUB({
publish_key : /* YOUR PUBLISH KEY*/,
subscribe_key : /* YOUR SUBSCRIBE KEY*/
})
@shyampurk
shyampurk / fetch-customer-feedback
Last active February 18, 2018 11:47
Watson-NLC-EventFeedback
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);
});
import os
import sys
import glob
import dlib
from skimage import io
from skimage.draw import polygon_perimeter
import traceback
# 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
handleComment = function(obj,commentObj){
var comment = commentObj.commentsAndMeta.comment[0];
var foundComment = false;
var i = 0;
while(i < obj.links.length){
if((obj.links[i].type == 1) && (obj.links[i].target.data.comment_id == comment.comment_id) ){
public static List<decimal> arrUSDEUR = new List<decimal>();// globally declaring list for USDEUR
public static List<decimal> arrUSDAUD = new List<decimal>();// globally declaring list for USDAUD
public static List<decimal> arrUSDCNY = new List<decimal>();// globally declaring list for USDCNY
public static List<decimal> arrUSDINR = new List<decimal>();// globally declaring list for USDINR
public static Dictionary<string, List<decimal>> ArrayDictMap = new Dictionary<string, List<decimal>>()
{
{ "USDEUR", arrUSDEUR },
@shyampurk
shyampurk / trashcan-client.py
Created March 15, 2016 05:57
Smart Trash Can Demo
def distanceMeasurement():
prev_distance = 0
while 1:
ultrasonicSensor_init()
time.sleep(2)
GPIO.output(TRIG, True)
time.sleep(0.00001)
GPIO.output(TRIG, False)
#Starts the timer
while GPIO.input(ECHO)==0:
@shyampurk
shyampurk / weather-infographic
Last active March 11, 2016 20:45
Weather Infographic Gist
function fetch (place, coordinates, i, aggregate) {
async.parallel([
function(callback) {
request
.get('https://maps.googleapis.com/maps/api/timezone/json')
.query('location='+coordinates[1]+','+coordinates[0])
.query({timestamp: Math.floor(new Date().getTime()/1000)})
.query({key: gApiToken})
.end(function(err, res){
if(err) { console.log(err); callback(true); return; }