This is a simple example of the MQTT protocol with Node.js. The client code has also been tested with a combination of C++ servers and clients.
This file contains hidden or 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
| # Simple exporter for published Yahoo Pipes | |
| # For use with (glue still required!) pipe2py - https://github.com/ggaughan/pipe2py | |
| uid='' #Your Yahoo Pipes ID | |
| #------- | |
| import simplejson,urllib,csv | |
| def getPipesPage(uid,pageNum): | |
| print 'getting',uid,pageNum |
This file contains hidden or 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
| *.gem | |
| .bundle | |
| Gemfile.lock | |
| pkg/* | |
| vendor/ | |
| *~ | |
| #* | |
| dev.yml |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'eventmachine' | |
| require 'em-mqtt' | |
| require 'sinatra/base' | |
| require 'thin' | |
| class WebApp < Sinatra::Base |
This file contains hidden or 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
| #include <NanodeUNIO.h> | |
| #include <NanodeUIP.h> | |
| #include <NanodeMQTT.h> | |
| NanodeMQTT mqtt(&uip); | |
| struct timer my_timer; | |
| void setup() { | |
| byte macaddr[6]; | |
| NanodeUNIO unio(NANODE_MAC_DEVICE); |
This file contains hidden or 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
| gem 'signet', '~> 0.3.0' | |
| require 'signet/oauth_2/client' | |
| gem 'google-api-client', '~> 0.4.3' | |
| require 'google/api_client' | |
| require 'google/api_client/client_secrets' | |
| client_secrets = Google::APIClient::ClientSecrets.load('client_secrets.json') | |
| client = Google::APIClient.new( | |
| :authorization => Signet::OAuth2::Client.new( | |
| :client_id => client_secrets.client_id, | |
| :client_secrets => client_secrets.client_secrets, |
This file contains hidden or 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
| <?php | |
| /* | |
| * Created on 05-Jul-2006 | |
| * [email protected] | |
| * Translator class calls external machine translation component | |
| */ | |
| class Phonetics | |
| { | |
This file contains hidden or 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 mqtt = require('mqtt'); | |
| mqtt.createConnection(1883, 'localhost', function(err, client) { | |
| if (err) { | |
| console.dir(err); | |
| return process.exit(-1); | |
| } | |
| var events = ['connack', 'puback', 'pubrec', 'pubcomp']; |
This file contains hidden or 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
| loadAvg=`uptime | cut -f 6 -d,` | |
| upDays=`uptime | cut -f 4 -d " "` | |
| upHours=`uprecords -s | sed -n '3p' | cut -c 23-25` | |
| upMinutes=`uprecords -s | sed -n '3p' | cut -c 27-28` | |
| upD=`echo "scale=5;$upDays + ($upHours / 24) + ($upMinutes / 24 / 60)" | bc` | |
| users=`w | head -1 | cut -f 3 -d, | awk '{print $1}'` | |
| memFree=`free -m | grep Mem | awk '{print $4}'` | |
| swapFree=`free -m | grep Swap | awk '{print $4}'` | |
| processes=`ps aux | wc -l` | |
| wget -O - --header="X-Http-Method-Override:put" \ |