Skip to content

Instantly share code, notes, and snippets.

View andypiper's full-sized avatar
🛠️
tinkering

Andy Piper andypiper

🛠️
tinkering
View GitHub Profile
@bergie
bergie / README.md
Created February 14, 2012 13:55
MQTT pub/sub example

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.

@adamvr
adamvr / README.md
Created February 15, 2012 00:32
A simple script that publishes that it is online when it starts and publishes that it is offline when it quits. Using mqttjs.

purpose

Lively.js is a simple illustration of using MQTT as a device presence indicator

installation

  1. git clone git://gist.github.com/1832048.git lively
  2. cd lively
  3. npm install .
  4. node lively.js ...
@psychemedia
psychemedia / userPipesExporter.py
Created April 10, 2012 14:06
Yahoo Pipes - Published pipes exporter, by User ID
# 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
@dsyer
dsyer / .gitignore
Created April 10, 2012 17:45
Basic no-op cloudfoundry service gateway
*.gem
.bundle
Gemfile.lock
pkg/*
vendor/
*~
#*
dev.yml
@njh
njh / mqtt-eventsource.rb
Created April 14, 2012 14:09
Subscribe to MQTT messages in browser using HTML5 Server-Sent Events
#!/usr/bin/env ruby
require 'rubygems'
require 'eventmachine'
require 'em-mqtt'
require 'sinatra/base'
require 'thin'
class WebApp < Sinatra::Base
@Elwell
Elwell / mqtt_publish.ino
Created April 23, 2012 12:36
test MQTT flood-publish (wanted as fast as poss sending)
#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);
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,
anonymous
anonymous / transliterate.class.php
Created May 5, 2012 22:05
A php script to provide simple english->arabic arabic->english transliteration
<?php
/*
* Created on 05-Jul-2006
* [email protected]
* Translator class calls external machine translation component
*/
class Phonetics
{
@adamvr
adamvr / client_test.js
Last active September 25, 2022 04:13
Tests for mqtt.js against mosquitto
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'];
@rooreynolds
rooreynolds / sysinfo.sh
Created July 3, 2012 17:53
Publish Raspberry Pi system stats to Cosm
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" \