I hereby claim:
- I am tbeseda on github.
- I am tbeseda (https://keybase.io/tbeseda) on keybase.
- I have a public key whose fingerprint is 880A 07B8 0FB5 375B 00B3 9C87 D1F7 E2C3 3C5E C513
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
My SmartThings multisensor is a great little piece of technology. It reports, in real time, motion, temperature, and open/close state of my back door. The iOS app is slick, too, but I wanted a way to view it from my computer and have access to historical data.
Enter Dweet and Freeboard from Buglabs.
There's actually no setup required on Dweet (but be sure to check out their nifty demo). It just starts eating data and making it available for use via HTTP/JSON!
| #!/usr/bin/ruby | |
| message_file = ARGV[0] | |
| def app_is_running?(app_name) | |
| `ps aux` =~ /#{app_name}/ ? true : false | |
| end | |
| while true | |
| if app_is_running?('Rdio.app') |
| generate_coordinates = (rows, columns) -> | |
| generated_coordinates = [] | |
| alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('') | |
| for i in [1..rows] | |
| for n in [0..(columns-1)] | |
| a = if n < 26 then alphabet[n] else alphabet[Math.floor(n/26)-1] + alphabet[n%26] | |
| generated_coordinates.push(a + i) | |
| coordinates = generate_coordinates(8, 63) |
| SheetLogger = function() {} | |
| SheetLogger.prototype = { | |
| set_cell: function(sheet_name, range, value) { | |
| var sheet = SpreadsheetApp.getActive().getSheetByName(sheet_name); | |
| sheet.getRange(range).setValue(value); | |
| }, | |
| append_row_to_sheet: function(sheet_name, value) { | |
| var sheet = SpreadsheetApp.getActive().getSheetByName(sheet_name); |
| Github = function(token) { | |
| this.token = token; | |
| this.api_url = 'https://api.github.com/' | |
| } | |
| Github.prototype = { | |
| parseISO8601: function(str) { | |
| // http://anentropic.wordpress.com/2009/06/25/javascript-iso8601-parser-and-pretty-dates/ | |
| // we assume str is a UTC date ending in 'Z' | |
| Ducksboard = function(token) { | |
| this.token = token; | |
| this.api_url = 'https://push.ducksboard.com/v/' | |
| } | |
| Ducksboard.prototype = { | |
| send: function(endpoint, payload) { | |
| var options = { | |
| method: 'post', | |
| headers: { |
| // Simple method to detect a mobile device | |
| function isMobile(){ | |
| return (/iphone|ipod|android|blackberry/).test(navigator.userAgent.toLowerCase()); | |
| } | |
| // Example usage: | |
| if(isMobile()){ | |
| console.log('This is a mobile device.'); | |
| } else { | |
| console.log('This is not a mobile device'); |
| # looks up a set(s) of hashes in redis given the set name as a string | |
| # and redis stores the ids of the sets members and hashes are stored at their id | |
| ### | |
| example redis data structure: | |
| users => ['1','2','3'] // all ids of all user objects | |
| users:2 => {'name':'Bob'} // a redis hash of the user with id == 2 | |
| usage example at the bottom |
| dow = 3 # for Wednesday | |
| this_year = today.getUTCFullYear() | |
| next_year = this_year+1 | |
| wednesdays = [] | |
| days_in_month = (month, year) -> | |
| 32 - new Date(year, month, 32).getDate() | |
| year_number = this_year | |
| while year_number <= next_year |