Skip to content

Instantly share code, notes, and snippets.

View seanmtracey's full-sized avatar

Sean M. Tracey seanmtracey

View GitHub Profile
#!/bin/bash
cf start "${CF_APP}-green"
cf map-route "${CF_APP}-green" choirless.com -n www
cf map-route "${CF_APP}-green" eu-gb.mybluemix.net -n choirless
cf unmap-route "${CF_APP}" choirless.com -n www
cf unmap-route "${CF_APP}" eu-gb.mybluemix.net -n choirless
cf push "${CF_APP}"
@seanmtracey
seanmtracey / Word Counter Node Codes
Last active April 21, 2020 13:39
The code for the IBM Developer UK word counter tutorial
This is all of the code needed to follow the IBM Developer UK word counter tutorial.

CODE OF CONDUCT

AIJS London, hereinafter referred to as the Event Organizers, are dedicated to providing a safe, respectful, comfortable, and harassment-free environment for all event participants.

Event Organizers expect that all participants, including delegates/attendees, speakers, volunteers, and guests, will conform to the following Code of Conduct.

UNACCEPTABLE BEHAVIOUR

Participants will not engage in unacceptable behaviour which includes, but is not limited to:

from ibmpairs import paw
import pandas as pd
PAIRS_SERVER = "https://oxaihack2020.eu-gb.mybluemix.net"
PAIRS_USER = ""
PAIRS_PASS = ""
PAIRS_CREDENTIALS = ( PAIRS_USER, PAIRS_PASS )
query_json = {
"layers" : [

CODE OF CONDUCT

The London Devrel Salon, hereinafter referred to as the Event Organizers, are dedicated to providing a safe, respectful, comfortable, and harassment-free environment for all event participants.

Event Organizers expect that all participants, including delegates/attendees, speakers, volunteers, and guests, will conform to the following Code of Conduct.

UNACCEPTABLE BEHAVIOUR

Participants will not engage in unacceptable behaviour which includes, but is not limited to:

[{"id":"657d785c.a755d8","type":"http in","z":"d7f421c3.87cf2","name":"","url":"/cinelist","method":"get","upload":false,"swaggerDoc":"","x":250,"y":240,"wires":[["683f655.3cdba9c"]]},{"id":"c8db0462.894fd8","type":"http response","z":"d7f421c3.87cf2","name":"","statusCode":"","headers":{},"x":860,"y":180,"wires":[]},{"id":"66fc158.8d674ec","type":"template","z":"d7f421c3.87cf2","name":"HTML / CSS","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n\t<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\">\n\t<title>CineList</title>\n\t<link rel=\"shortcut icon\" href=\"https://cinelist-public-dev.herokuapp.com/favicon.png\">\n\t<style>\n\n @charset \"UTF-8\";\n /* CSS Document */\n\n *{\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n box-sizing: border-box;\n }\n\n .inactive, [data-is-loading=false], [data-visible=false]{\n display: none !impor

Instructions for plugging a website into Watson Assisstant with Node-RED + WebSockets

Okie dokie, so you want to plug your website into Watson Assistant, well, here's how you can do that.

First, you'll need to set up a Node-RED server which can talk to Watson Assistant. The demo-flow.json contains a demo flow that will hook up a websockets endpoint to a Watson Assistant instance enabling you to talk to the Assistant instance with a web page.

  1. Copy the contents of demo-flow.json into your clipboard and then head to any Node-RED flow.
  2. Top right of the Node-RED UI, hit the hamburger menu and then hover over "import" and then select "clipboard" from the context menu that appears.
  3. In the dialog box that appears, paste the content of your clipboard and then click "import"
  4. A flow will appear in your workflow, click to place it, you now have a websocket connection configured to talk to Watson Assistant
@seanmtracey
seanmtracey / GlowOrbWordCounter.md
Last active September 24, 2018 19:59
A Node-RED flow that turns a glow orb different colors depending on how fast I'm talking

Steps for use:

  1. Import the flow to a Node-RED instance
  2. Add credentials to the speech-to-text node
  3. Configure your MQTT node to communicate with your Gloworb / MQTT enabled device
  4. Click 'Deploy'
  5. Open up https://<YOUR_NODE_RED_HOST>/word-count. You'll be asked to enable your microphone, this will begin the capture of audio from your mircophone for counting.
  6. Once you enable the microphone, you can click the 'Start' button to stream the audio over web sockets to your Node-RED instance.
  • NB: If you hit the 'stop' button, you'll need to refresh the page to start streaming again, I haven't finished that bit of the code yet.
  1. Voila! If you're speaking at an acceptable rate, your glow orb will be green. If you're going a little fast, it will turn orange. If you're WWAAAYYYYY out, it will turn blue (because red is an alarming color for anyone to see.)
@seanmtracey
seanmtracey / instructions.md
Created September 3, 2018 09:40
Instructions to clear CloudantDB Documents
  1. First up, head to https://console.bluemix.net and find your Cloudant DB instance. Click on it to be taken to the service page.
  2. Next, click on the "Launch Cloudant Dashboard" button at the top-right of your screen. This will take you to the dashboard for your Cloudant DB instance
  3. You should be taken to the 'databases' view (if not, click on the icon on the far left of the screen that looks like stacked pancakes). Click the database that you would like to delete the records from
  4. A table with rows of your documents should appear.
  • If you only want to delete select documents from your database, click the individual checkboxes on the left-hand side of each row in the tabl
  • If you want to delete all of the documents in this view, clickbox just above the table on the left-hand side
  1. When you've selected some (or all) of your records, a trash can icon will appear at the top left of the table. Click it to delete the selecte rows.
@seanmtracey
seanmtracey / instructions.md
Created September 3, 2018 09:40
Instructions to clear CloudantDB Documents
  1. First up, head to https://console.bluemix.net and find your Cloudant DB instance. Click on it to be taken to the service page.
  2. Next, click on the "Launch Cloudant Dashboard" button at the top-right of your screen. This will take you to the dashboard for your Cloudant DB instance
  3. You should be taken to the 'databases' view (if not, click on the icon on the far left of the screen that looks like stacked pancakes). Click the database that you would like to delete the records from
  4. A table with rows of your documents should appear.
  • If you only want to delete select documents from your database, click the individual checkboxes on the left-hand side of each row in the tabl
  • If you want to delete all of the documents in this view, clickbox just above the table on the left-hand side
  1. When you've selected some (or all) of your records, a trash can icon will appear at the top left of the table. Click it to delete the selecte rows.