Skip to content

Instantly share code, notes, and snippets.

View zobalogh's full-sized avatar

Zoltan Balogh zobalogh

  • IBM UK Ltd.
  • United Kingdom
View GitHub Profile
@zobalogh
zobalogh / back_up_instagram_photos.json
Created October 3, 2014 13:13
Back up my Instagram photos to Flickr and Dropbox flow
[{"id":"309305f0.cf6cfa","type":"inject","name":"TriggerInstagramCheck","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":true,"x":187,"y":317,"z":"accb4471.5334b8","wires":[["a0deb9f4.5f2148"]]},{"id":"ff6b7b54.009488","type":"function","name":"FileNameGenerator","func":"// initialise the counter to 0 if it doesn't exist already\ncontext.count = context.count || 0; \n\nmsg.filename = \"insta_\" + context.count + \".jpeg\";\ncontext.count += 1;\nreturn msg;","outputs":1,"x":657,"y":317,"z":"accb4471.5334b8","wires":[["84af83a8.7b508","f4df3228.0b20d"]]},{"id":"a0deb9f4.5f2148","type":"instagram","instagram":"","inputType":"photo","outputType":"file","name":"Instagram","x":428,"y":317,"z":"accb4471.5334b8","wires":[["ff6b7b54.009488","b27707f5.4d88f8"]]},{"id":"b27707f5.4d88f8","type":"flickr out","flickr":"","privacy":"fa","tags":"instagram","name":"Back up Photos to Flickr","x":603,"y":148,"z":"accb4471.5334b8","wires":[]},{"id":"84af83a8.7b508","type":"dropbox out","dropbox":
@zobalogh
zobalogh / instagram_media.json
Created October 3, 2014 14:35
Example media returned by Instagram as coming from the API
HTTP/1.1 200 OK
Content-Language:
en
X-Ratelimit-Limit:
5000
Vary:
Cookie, Accept-Language, Accept-Encoding
Date:
Fri, 03 Oct 2014 14:31:36 GMT
Content-Length:
@zobalogh
zobalogh / development_flow.json
Created October 22, 2014 17:00
Global Location Context Storer flow
[{"id":"c9b7b9dd.364848","type":"instagram","instagram":"","inputType":"like","outputType":"link","name":"","x":351,"y":300,"z":"da79d491.258628","wires":[["7cca3aa6.8335c4"]]},{"id":"78a76c3f.875894","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":151,"y":301,"z":"da79d491.258628","wires":[["c9b7b9dd.364848"]]},{"id":"7cca3aa6.8335c4","type":"function","name":"Store Location Globally","func":"// only store location if it's new\nif(msg.lat && msg.lon && msg.time) { // do something\n if(msg.lastGlobalLoc) { // if we're dealing with last known global loc\n if(msg.time > context.time) {\n // nothing to store as the global time of location is more recent\n } else {\n // need to update global location\n context.global.lat = context.lat;\n context.global.lon = context.lon;\n context.global.time = context.time;\n }\n return msg;\n } else { // normal exec, initial s
@zobalogh
zobalogh / location_global_storage_example.json
Created October 23, 2014 13:21
Node-RED location storage flow examples
[{"id":"c9b7b9dd.364848","type":"instagram","instagram":"","inputType":"photo","outputType":"link","name":"","x":362,"y":187,"z":"da79d491.258628","wires":[["7cca3aa6.8335c4","aa1d8742.c673c","ec30d402.13cf28"]]},{"id":"78a76c3f.875894","type":"inject","name":"Trigger real life scenario","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":151,"y":187,"z":"da79d491.258628","wires":[["c9b7b9dd.364848"]]},{"id":"7cca3aa6.8335c4","type":"function","name":"Store Location Globally","func":"// only store location if it's new\nif(msg.lat && msg.lon && msg.time) { // do something\n console.log(\"doing something in storer\");\n if(msg.lastGlobalLoc) { // if we're dealing with last known global loc\n console.log(\"dealing with last global loc\");\n \n if(msg.storeInitialValue && msg.storeInitialValue === true) {\n \tcontext.global.lat = context.lat;\n context.global.lon = context.lon;\n context.global.time = context.time;\n
@zobalogh
zobalogh / loc_weather.txt
Created October 29, 2014 11:29
Location based Weather Example
[{"id":"c9b7b9dd.364848","type":"instagram","instagram":"","inputType":"photo","outputType":"link","name":"","x":355,"y":75,"z":"da79d491.258628","wires":[["aa1d8742.c673c","ec30d402.13cf28"]]},{"id":"78a76c3f.875894","type":"inject","name":"Trigger real life scenario","topic":"","payload":"","payloadType":"date","repeat":"300","crontab":"","once":true,"x":144,"y":43,"z":"da79d491.258628","wires":[["c9b7b9dd.364848"]]},{"id":"7cca3aa6.8335c4","type":"function","name":"Store Location Globally","func":"// only store location if it's new\nif(msg.lat && msg.lon && msg.time) { // do something\n console.log(\"doing something in storer\");\n if(msg.lastGlobalLoc) { // if we're dealing with last known global loc\n console.log(\"dealing with last global loc\");\n \n if(msg.storeInitialValue && msg.storeInitialValue === true) {\n \tcontext.global.lat = context.lat;\n context.global.lon = context.lon;\n context.global.time = context.time;\n msg.storeInit
@zobalogh
zobalogh / bus_or_underground.txt
Created December 1, 2014 11:57
bus_or_underground_flow
[{"id":"4e726fa6.b18d9","type":"tfl-bus","lat":"51.507268","lon":"-0.16573","radius":"600","stopCode1":"71003","lineID":"274","stopName":"Hyde Park Street towards Lancaster Gate or Notting Hill","lineName":"274 to Lancaster Gate","name":"Bus to Acton Green","acceptedtcs":true,"x":317,"y":170,"z":"a163e101.5e9c2","wires":[["94523edd.6badc"]]},{"id":"daa088a3.255f78","type":"tfl underground","line":"Piccadilly","name":"Check Piccadilly line status","acceptedtcs":true,"x":234,"y":261,"z":"a163e101.5e9c2","wires":[["9b69fbc5.649608"]]},{"id":"b65db9d6.49a248","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":111,"y":170,"z":"a163e101.5e9c2","wires":[["4e726fa6.b18d9","daa088a3.255f78","244841bf.dbb7be"]]},{"id":"244841bf.dbb7be","type":"openweathermap","name":"London weather","lon":"","lat":"","city":"London","country":"England","x":236,"y":66,"z":"a163e101.5e9c2","wires":[["a4eb163f.5b14e8"]]},{"id":"9b69fbc5.649608","type":"function","name":"Are the
@zobalogh
zobalogh / transport-uber.flow
Last active August 29, 2015 14:10
Transport uber flow
[{"id":"ecd5e4e2.132a18","type":"tfl underground","line":"Piccadilly","name":"Check Piccadilly line status","x":404,"y":485,"z":"86fba54d.790458","wires":[["c11f5737.3ee0a8"]]},{"id":"dc21420b.23dec","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":55,"y":337,"z":"86fba54d.790458","wires":[["7653e6b2.89ac18"]]},{"id":"5df6386.fa209c8","type":"openweathermap","name":"London weather","lon":"","lat":"","city":"London","country":"England","x":346,"y":140,"z":"86fba54d.790458","wires":[["d18ecefa.2e713"]]},{"id":"c11f5737.3ee0a8","type":"function","name":"Is the Piccadilly line to Action Town OK?","func":"var stations = [\"Hyde Park Corner\", \"Knightsbridge\", \"South Kensington\", \"Earl's Court\", \"Hammersmith\", \"Turnham Green\", \"Acton Town\"];\nvar lineok = true;\nvar minordelays = false;\n\nif (msg.payload.goodservice) {\n // minor delays are reported as good service but sometimes have a info about delay\n\tif (msg.payload.description ===
@zobalogh
zobalogh / strava_to_google_cal.txt
Created December 5, 2014 15:16
Save Strava run record into Google Calendar
[{"id":"5f514c67.a0aeb4","type":"strava","strava":"","name":"Get my latest activity on Strava","x":180,"y":272,"z":"5584402e.aa7bc","wires":[["1c36f3e4.e3c90c","81950bff.7e6af8"]]},{"id":"85c200ee.7a3e","type":"google calendar out","google":"","name":"Save run to Google Calendar","calendar":"","x":175,"y":425,"z":"5584402e.aa7bc","wires":[]},{"id":"1c36f3e4.e3c90c","type":"function","name":"Format activity for Google Calendar \"Quick Add\"","func":"var eventName = msg.payload.name;\nvar when = msg.time.toString();\nvar atLocation = msg.payload.location_city;\n\nmsg.payload = eventName + \" at \" + when + \" at \" + atLocation;\n\nreturn msg;","outputs":1,"x":254,"y":359,"z":"5584402e.aa7bc","wires":[["85c200ee.7a3e","d82cee9f.27d31"]]},{"id":"774161bd.88bea","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":86,"y":211,"z":"5584402e.aa7bc","wires":[["5f514c67.a0aeb4"]]},{"id":"81950bff.7e6af8","type":"debug","name":"","active":true,"console":"true"