-
Install and run an MQTT server (mosquitto is a good choise)
-
Install mqtt and ncurses-ruby gems
sudo gem install ruby-mqtt ncurses-ruby
-
Run the client
ruby ./mqtt-chat.rb
| require 'mqtt/client' | |
| mqtt = MQTT::Client.new('10.25.2.4') | |
| loop do | |
| mqtt.connect do |c| | |
| c.publish('test/foo/bar','this is a test message #{Time.now}') | |
| puts "published a msg" | |
| #! /bin/bash | |
| # Based on /etc/init.d/sshd as it came on CentOS 5.6: | |
| # | |
| # Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany. | |
| # | |
| # Author: Jiri Smid <[email protected]> | |
| # /etc/init.d/mosquitto | |
| # |
| #!/bin/sh | |
| # Just copy and paste the lines below (all at once, it won't work line by line!) | |
| # MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
| function abort { | |
| echo "$1" | |
| exit 1 | |
| } | |
| set -e |
| 56k: "https://123.campfirenow.com/images/56k.gif" | |
| bell: ":bell:" | |
| bezos: ":laughing::thought_balloon:" | |
| bueller: "anyone?" | |
| butts: ":open_hands: :smoking:" | |
| clowntown: "https://123.campfirenow.com/images/clowntown.gif" | |
| cottoneyejoe: ":notes::hear_no_evil::notes:" | |
| crickets: "hears crickets chirping" | |
| dadgummit: "dad gummit!! :fishing_pole_and_fish:" | |
| dangerzone: "https://123.campfirenow.com/images/dangerzone.png" |
| // TinyBASIC.cpp : An implementation of TinyBASIC in C | |
| // | |
| // Author : Mike Field - [email protected] | |
| // | |
| // Based on TinyBasic for 68000, by Gordon Brandly | |
| // (see http://members.shaw.ca/gbrandly/68ktinyb.html) | |
| // | |
| // which itself was Derived from Palo Alto Tiny BASIC as | |
| // published in the May 1976 issue of Dr. Dobb's Journal. | |
| // |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| Copyright (c) 2008-2012 Nicholas O'Leary | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, | |
| distribute, sublicense, and/or sell copies of the Software, and to | |
| permit persons to whom the Software is furnished to do so, subject to | |
| the following conditions: |
| /* | |
| Rainbowduino v3.0 Library examples: | |
| Sets pixels on 2D plane (8x8 matrix) | |
| */ | |
| #include <Rainbowduino.h> | |
| uint32_t colorRGB[13] = {0xFFFFFF,0x000000,0xFFFFFF,0x000,0xFF0000,0x00FF00,0x0000FF,0xFF0000,0x00FF00,0x0000FF,0xFF0000,0x00FF00,0x0000FF }; |
| var mqtt = require('mqttjs'); | |
| var mdns = require('mdns'); | |
| var topic = "my.data"; | |
| var connectedClient = null; | |
| discoverService(); | |
| startMessageLoop(); |