This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var obj = [ {"username":"audstanleybot"} ]; | |
| var newObj = '{"username":"audstanleybot2"}'; | |
| function addToObj(anObj) { | |
| return anObj.push(newObj); | |
| } | |
| console.log(addToObj(obj)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Created by audstanley on 01/06/16. | |
| */ | |
| //need to change the path in jsonObj to /home/pi/slackberrypiratebot/json/botlist.json | |
| module.exports = function(robot) | |
| { | |
| robot.respond(/\/[Rr][Ee][Mm][Oo][Vv][Ee]\s+@(\S+)?/, function(res) | |
| { | |
| var role = 'admin'; | |
| // console.log(res); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Created by audstanley on 01/06/16. | |
| */ | |
| //need to change the path in jsonObj to /home/pi/slackberrypiratebot/json/botlist.json | |
| module.exports = function(robot) | |
| { | |
| robot.respond(/\/[Rr][Ee][Mm][Oo][Vv][Ee]\s+@(\S+)?/, function(res) | |
| { | |
| var role = 'admin'; | |
| // console.log(res); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getMovie(movieData) { | |
| var movie = require('node-movie'); | |
| movie('Alien', '1979', function (err, data) { | |
| console.log(data.Poster); | |
| //res.send(data.Poster); | |
| return movieData = data; | |
| }); | |
| } | |
| process.nextTick(getMovie); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function(robot) { | |
| return robot.hear(/\{.?(movie):.?"(.*?)",?.?(year):.?"(.*?)",?.?(opt):.?"(.*?)".?}/, function(res) { | |
| console.log("Got input, using " + res.match[2] + " for the title, and " + res.match[4] + " for the year."); | |
| var movie = require('node-movie'); | |
| var title = res.match[2]; | |
| var year = res.match[4]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| request({'uri' : 'http://' + 'admin' + ':' + 'password2' + '@localhost:8080/gui/token.html'}, function(error, response, body) { | |
| var regex = new RegExp('<div id=(?:\'|")token(?:\'|")[^>]+>(.*)</div>'); | |
| var matches = regex.exec(body); | |
| var ourToken = matches[1]; | |
| console.log(response.body); | |
| request({'uri' : 'http://' + 'admin' + ':' + 'password2' + '@localhost:8080/gui/?token=' + ourToken + '&action=add-url&s=' + lastTorrent, 'cookie': response.headers['set-cookie'].GUID}, function(error, more) { | |
| console.log(more.body); | |
| }); | |
| jf.writeFileSync('/home/audstanley/slackberrypiratebot/json/output.json', response); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ended: false, | |
| endEmitted: false, | |
| reading: true, | |
| sync: false, | |
| needReadable: true, | |
| emittedReadable: false, | |
| readableListening: false, | |
| defaultEncoding: 'utf8', | |
| ranOut: false, | |
| awaitDrain: 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo su; | |
| sudo echo "0/10 * * * * root curl ifconfig.me > /home/pi/myIp.txt" >> /etc/; | |
| exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var bcrypt = require('bcrypt'); | |
| const saltRounds = 10; | |
| const myPlaintextPassword = 'thisisplaintext'; | |
| bcrypt.genSalt(saltRounds, function(err, salt) { | |
| bcrypt.hash(myPlaintextPassword, salt, function(err, hash) { | |
| console.log(hash); | |
| }) |
OlderNewer