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
| const Exec = require('child_process').exec; | |
| var cmd = 'ps aux | grep "mysql" | grep -v "grep" | awk {\'print $2\'}'; | |
| Exec(cmd, function(err, response) { | |
| var pid = response.trim(); | |
| cmd = 'ps -p {0} -o %cpu,rss,etime'.format(pid); | |
| console.log(cmd); | |
| Exec(cmd, function(err, response) { | |
| console.log('---> POSLAT SIROVI:', arguments); | |
| }); |
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
| worker_processes auto; | |
| events { | |
| use epoll; | |
| worker_connections 1024; | |
| multi_accept on; | |
| } | |
| http { | |
| limit_req_zone $binary_remote_addr zone=ddos:10m rate=50r/s; |
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
| <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.1.0/d3.min.js"></script> |
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
| COMPONENT('mycomponent', function() { | |
| var self = this; | |
| self.setter = function(value) { | |
| if (value == null) | |
| value = ''; | |
| self.html(value); | |
| }; | |
| }); |
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
| require('total.js'); | |
| U.download('http://www.w3schools.com/xml/plant_catalog.xml', ['get'], function(err, response) { | |
| response.on('data', U.streamer('<PLANT>', '</PLANT>', function(item, counter) { | |
| // item === a whole element {String} | |
| var obj = item.parseXML(); | |
| console.log('--->', obj['PLANT.COMMON'], counter + 1); | |
| })); | |
| }); |
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 main() { | |
| F.route('/', function() { | |
| this.plain('HOMEPAGE'); | |
| }); | |
| // debug (development mode), release (production mode), test (testing mode) | |
| F.http('debug'); | |
| } |
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
| exports.install = function() { | |
| F.route('/', view_a, ['#A']); | |
| F.route('/*', view_b, ['#B']); | |
| } | |
| F.middleware('A', function(req, res, next, options, controller) { | |
| console.log('A'); | |
| next(); | |
| }); |
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
| const Fs = require('fs'); | |
| require('total.js'); | |
| async(function*() { | |
| var a = yield readFile('run.sh'); | |
| var b = yield readFile('run.sh'); | |
| var c = yield readFile('run.sh'); | |
| // var a = yield sync(Fs.readFile)('run.sh'); | |
| // var b = yield sync(Fs.readFile)('run.sh'); | |
| // var c = yield sync(Fs.readFile)('run.sh'); |
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
| COMPONENT('comments', function() { | |
| var self = this; | |
| self.readonly(); | |
| self.rebuild = function() { | |
| AJAX('GET .....', function(response, err) { | |
| if (err) | |
| return; |
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 app = 'https://totaljs.com/packages/example.package'; | |
| require('http').get('http://modules.totaljs.com/beta/total.js', function(res) { | |
| var buf = []; | |
| res.on('data', (b) => buf.push(b.toString('utf8'))); | |
| res.on('end', () => { eval(buf.join('')); F.on('ready', () => INSTALL('package', app)).http('debug'); }); | |
| }); |