Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweet your current IP addr #50

Open
zenfish opened this issue May 15, 2015 · 0 comments
Open

tweet your current IP addr #50

zenfish opened this issue May 15, 2015 · 0 comments
Labels

Comments

@zenfish
Copy link
Owner

zenfish commented May 15, 2015

It might be too difficult to set up for most users... but maybe it could be done... everytime your d3ck moves you could have it tweet it's current location. That way your d3ck simply needs to follow its pals on twitter (or do ad-hoc lookups) and any lookups or whatnot are obviated. Twitter IDs would usually map to d3ck ids, probabably not a lot of competition for user "CE8394545CB81F25E1132A1BFEC7D1F5AB705318" ;) You need to get all that API keys, which is a bit of a pain.

POC code for a d3ck to tweet (with hardcoded IP......) below.

!/usr/bin/env node

var fs = require('fs')
var Twitter = require('node-twitter');

var keyz_loc = '/etc/d3ck/conf/twitter.json'

var twit_keyz = JSON.parse(fs.readFileSync(keyz_loc).toString())

console.log('keyz: ' + JSON.stringify(twit_keyz))

var twitterRestClient = new Twitter.RestClient(
twit_keyz.CONSUMER_KEY,
twit_keyz.CONSUMER_SECRET,
twit_keyz.TOKEN,
twit_keyz.TOKEN_SECRET
)

var my_ip = JSON.stringify({d3ck_ip: '63.225.191.45'})

console.log('my_ip: ' + my_ip)

twitterRestClient.statusesUpdate({ status: my_ip }, function(error, result) {
if (error) {
console.log('Tweet Errz: ' + (error.code ? error.code + ' ' + error.message : error.message));
}
else if (result) {
console.log(result);
}
else {
console.log('tweet-no-zone... hmm, not sure how to deal with this :)')
}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant