Deployed the page to Github Pages.

This commit is contained in:
Batuhan Berk Başoğlu 2024-11-03 21:30:09 -05:00
parent 1d79754e93
commit 2c89899458
Signed by: batuhan-basoglu
SSH key fingerprint: SHA256:kEsnuHX+qbwhxSAXPUQ4ox535wFHu/hIRaa53FzxRpo
62797 changed files with 6551425 additions and 15279 deletions

9
node_modules/qjobs/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,9 @@
language: node_js
node_js:
- "0.10"
- "0.9"
notifications:
email: false
irc:
- "irc.freenode.net#evilprobe"

21
node_modules/qjobs/LICENCE generated vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2013-2018 Franck34
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

5
node_modules/qjobs/Makefile generated vendored Normal file
View file

@ -0,0 +1,5 @@
test:
@find tests/*.js | xargs -n 1 -t node
.PHONY: test

92
node_modules/qjobs/Readme.md generated vendored Normal file
View file

@ -0,0 +1,92 @@
[![Build Status](https://secure.travis-ci.org/franck34/qjobs.png)](http://travis-ci.org/franck34/qjobs)
**qjobs**
==================
***Efficient queue job manager module for nodejs.***
Features
--------------
* Concurrency limiter
* Dynamic queue, a job can be added while the queue is running
* Optional delay before continuing after max concurrency has been reached
* Support of pause/unpause
* Events emitter based: start, end, sleep, continu, jobStart, jobEnd
* Quick statistic function, so you can know where the queue is, at regular interval
For what it can be usefull ?
---------------------
Jobs which needs to run in parallels, but in a controled maner, example:
* Network scanners
* Parallels monitoring jobs
* Images/Videos related jobs
Compatibility :
------------------
* not tested with nodejs < 0.10
Examples
--------------------
(take a look at tests directory if you are looking for running samples)
```
var qjobs = new require('./qjobs');
// My non blocking main job
var myjob = function(args,next) {
setTimeout(function() {
console.log('Do something interesting here',args);
next();
},1000);
}
var q = new qjobs({maxConcurrency:10});
// Let's add 30 job to the queue
for (var i = 0; i<30; i++) {
q.add(myjob,[i,'test '+i]);
}
q.on('start',function() {
console.log('Starting ...');
});
q.on('end',function() {
console.log('... All jobs done');
});
q.on('jobStart',function(args) {
console.log('jobStart',args);
});
q.on('jobEnd',function(args) {
console.log('jobend',args);
// If i'm jobId 10, then make a pause of 5 sec
if (args._jobId == 10) {
q.pause(true);
setTimeout(function() {
q.pause(false);
},5000);
}
});
q.on('pause',function(since) {
console.log('in pause since '+since+' milliseconds');
});
q.on('unpause',function() {
console.log('pause end, continu ..');
});
q.run();
//q.abort() will empty jobs list
```

73
node_modules/qjobs/examples/simple.js generated vendored Normal file
View file

@ -0,0 +1,73 @@
// My non blocking main job
var myjob = function(args,next) {
// do nothing now but in 1 sec
setTimeout(function() {
// if i'm job id 10 or 20, let's add
// another job dynamicaly in the queue.
// It can be usefull for network operation (retry on timeout)
if (args._jobId==10||args._jobId==20) {
myQueueJobs.add(myjob,[999,'bla '+args._jobId]);
}
next();
},Math.random(1000)*2000);
}
// Notice the "new" before require, to be able to use more
// than one queue independently
var myQueueJobs = new require('../qjobs')();
// Let's add 30 job and add them to the queue
for (var i = 0; i<30; i++) {
myQueueJobs.add(myjob,[i,'test1']);
}
// I want to know when the first job has started
myQueueJobs.on('start',function() {
console.log('starting ...');
console.log(JSON.stringify(myQueueJobs.stats()));
});
// I want to know when the last job has ended
myQueueJobs.on('end',function() {
clearInterval(statId);
console.log('end');
console.log(JSON.stringify(myQueueJobs.stats()));
});
// I want to know when each job has started
myQueueJobs.on('jobStart',function(args) {
console.log('jobStart',args);
});
// I want to know when each job has ended
myQueueJobs.on('jobEnd',function(args) {
console.log('jobEnd',args);
// If i'm jobId 10, then make a pause of 5 sec
if (args._jobId == 10) {
myQueueJobs.pause(true);
setTimeout(function() {
myQueueJobs.pause(false);
},5000);
}
});
// I want to know if queue is in pause every sec
myQueueJobs.on('pause',function(since) {
console.log('in pause since '+since+' milliseconds');
});
// JOBS !! leeeeeeeeeet's staaaaaaaart !
myQueueJobs.run();
var statId = setInterval(function() {
console.log(JSON.stringify(myQueueJobs.stats()));
},1000);

30
node_modules/qjobs/package.json generated vendored Normal file
View file

@ -0,0 +1,30 @@
{
"name": "qjobs",
"version": "1.2.0",
"description": "qjobs is a simple and stupid queue job manager for nodejs",
"main": "qjobs.js",
"directories": {
"example": "examples"
},
"scripts": {
"test": "make test"
},
"engines": {
"node": ">=0.9"
},
"repository": {
"type": "git",
"url": "git://github.com/franck34/qjobs.git"
},
"keywords": [
"queue",
"jobs",
"job",
"concurrency",
"control"
],
"author": "Franck TABARY",
"license": "MIT",
"readmeFilename": "Readme.md",
"gitHead": "6b6ea2dd626799e946ab700e4c4902ab792d3bb2"
}

236
node_modules/qjobs/qjobs.js generated vendored Normal file
View file

@ -0,0 +1,236 @@
var util = require('util');
var events = require('events').EventEmitter;
var qjob = function(options) {
if(false === (this instanceof qjob)) {
return new qjob(options);
}
this.maxConcurrency = 10;
this.jobsRunning = 0;
this.jobsDone = 0;
this.jobsTotal = 0;
this.timeStart;
this.jobId = 0;
this.jobsList = [];
this.paused = false;
this.pausedId = null;
this.lastPause = 0;
this.interval = null;
this.stopAdding = false;
this.sleeping = false;
this.aborting = false;
if (options) {
this.maxConcurrency = options.maxConcurrency || this.maxConcurrency;
this.interval = options.interval || this.interval;
}
events.call(this);
};
util.inherits(qjob, events);
/*
* helper to set max concurrency
*/
qjob.prototype.setConcurrency = function(max) {
this.maxConcurrency = max;
}
/*
* helper to set delay between rafales
*/
qjob.prototype.setInterval = function(delay) {
this.interval = delay;
}
/*
* add some jobs in the queue
*/
qjob.prototype.add = function(job,args) {
var self = this;
self.jobsList.push([job,args]);
self.jobsTotal++;
}
/*
*
*/
qjob.prototype.sleepDueToInterval = function() {
var self = this;
if (this.interval === null) {
return;
}
if (this.sleeping) {
return true;
}
if (this.stopAdding) {
if (this.jobsRunning > 0) {
//console.log('waiting for '+jobsRunning+' jobs to finish');
return true;
}
//console.log('waiting for '+rafaleDelay+' ms');
this.sleeping = true;
self.emit('sleep');
setTimeout(function() {
this.stopAdding = false;
this.sleeping = false;
self.emit('continu');
self.run();
}.bind(self),this.interval);
return true;
}
if (this.jobsRunning + 1 == this.maxConcurrency) {
//console.log('max concurrent jobs reached');
this.stopAdding = true;
return true;
}
}
/*
* run the queue
*/
qjob.prototype.run = function() {
var self = this;
// first launch, let's emit start event
if (this.jobsDone == 0) {
self.emit('start');
this.timeStart = Date.now();
}
if (self.sleepDueToInterval()) return;
if (self.aborting) {
this.jobsList = [];
}
// while queue is empty and number of job running
// concurrently are less than max job running,
// then launch the next job
while (this.jobsList.length && this.jobsRunning < this.maxConcurrency) {
// get the next job and
// remove it from the queue
var job = self.jobsList.shift();
// increment number of job running
self.jobsRunning++;
// fetch args for the job
var args = job[1];
// add jobId in args
args._jobId = this.jobId++;
// emit jobStart event
self.emit('jobStart',args);
// run the job
setTimeout(function() {
this.j(this.args,self.next.bind(self,this.args));
}.bind({j:job[0],args:args}),1);
}
// all jobs done ? emit end event
if (this.jobsList.length == 0 && this.jobsRunning == 0) {
self.emit('end');
}
}
/*
* a task has been terminated,
* so 'next()' has been called
*/
qjob.prototype.next = function(args) {
var self = this;
// update counters
this.jobsRunning--;
this.jobsDone++;
// emit 'jobEnd' event
self.emit('jobEnd',args);
// if queue has been set to pause
// then do nothing
if (this.paused) return;
// else, execute run() function
self.run();
}
/*
* You can 'pause' jobs.
* it will not pause running jobs, but
* it will stop launching pending jobs
* until paused = false
*/
qjob.prototype.pause = function(status) {
var self = this;
this.paused = status;
if (!this.paused && this.pausedId) {
clearInterval(this.pausedId);
self.emit('unpause');
this.run();
}
if (this.paused && !this.pausedId) {
self.lastPause = Date.now();
this.pausedId = setInterval(function() {
var since = Date.now() - self.lastPause;
self.emit('pause',since);
},1000);
return;
}
}
qjob.prototype.stats = function() {
var now = Date.now();
var o = {};
o._timeStart = this.timeStart || 'N/A';
o._timeElapsed = (now - this.timeStart) || 'N/A';
o._jobsTotal = this.jobsTotal;
o._jobsRunning = this.jobsRunning;
o._jobsDone = this.jobsDone;
o._progress = Math.floor((this.jobsDone/this.jobsTotal)*100);
o._concurrency = this.maxConcurrency;
if (this.paused) {
o._status = 'Paused';
return o;
}
if (o._timeElapsed == 'N/A') {
o._status = 'Starting';
return o;
}
if (this.jobsTotal == this.jobsDone) {
o._status = 'Finished';
return o;
}
o._status = 'Running';
return o;
}
qjob.prototype.abort = function() {
this.aborting = true;
}
module.exports = qjob;

64
node_modules/qjobs/tests/abort.js generated vendored Normal file
View file

@ -0,0 +1,64 @@
#!/usr/bin/env node
var assert = require('assert');
var qjob = require('../qjobs');
var maxConcurrency = 2;
var q = new qjob({maxConcurrency:maxConcurrency});
var testExecutedJobs = 0;
var testStartFired = false;
var testEndFired = false;
var testJobsStartFired = 0;
var testJobsEndFired = 0;
var testConcurrency = 0;
var testPause = false;
var testUnpause = false;
var myjob = function(args,next) {
setTimeout(function() {
testExecutedJobs++;
next();
},50);
}
// Let's add 10 job and add them to the queue
for (var i = 0; i<10; i++) {
q.add(myjob,['test'+i]);
}
q.on('start',function() {
testStartFired = true;
});
q.on('jobStart',function() {
var running = q.stats()._jobsRunning;
if (running>testConcurrency) testConcurrency = running;
testJobsStartFired++;
if (testJobsStartFired == 5) {
q.abort();
}
});
q.on('jobEnd',function() {
testJobsEndFired++;
});
q.on('end',function() {
testEndFired = true;
assert.equal(testExecutedJobs, 5);
assert.equal(testJobsStartFired,5);
assert.equal(testJobsEndFired,5);
assert.equal(testConcurrency,maxConcurrency);
assert.ok(testStartFired);
});
var running = q.stats()._jobsRunning;
assert.equal(testExecutedJobs,0);
assert.equal(testJobsStartFired,0);
assert.equal(testJobsEndFired,0);
assert.equal(running,0);
assert.ok(!testStartFired);
assert.ok(!testEndFired);
q.run();

28
node_modules/qjobs/tests/basic.js generated vendored Normal file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env node
var assert = require('assert');
var qjob = require('../qjobs');
// only 2 jobs in the same time
var q = new qjob({maxConcurrency:2});
var testExecutedJobs = 0;
var myjob = function(args,next) {
setTimeout(function() {
testExecutedJobs++;
next();
},50);
}
// Let's add 10 job and add them to the queue
for (var i = 0; i<10; i++) {
q.add(myjob,['test'+i]);
}
q.on('end',function() {
assert.equal(testExecutedJobs, 10);
});
q.run();

59
node_modules/qjobs/tests/events.js generated vendored Normal file
View file

@ -0,0 +1,59 @@
#!/usr/bin/env node
var assert = require('assert');
var qjob = require('../qjobs');
var maxConcurrency = 2;
var q = new qjob({maxConcurrency:maxConcurrency});
var testExecutedJobs = 0;
var testStartFired = false;
var testEndFired = false;
var testJobsStartFired = 0;
var testJobsEndFired = 0;
var testConcurrency = 0;
var myjob = function(args,next) {
setTimeout(function() {
testExecutedJobs++;
next();
},50);
}
// Let's add 10 job and add them to the queue
for (var i = 0; i<10; i++) {
q.add(myjob,['test'+i]);
}
q.on('start',function() {
testStartFired = true;
});
q.on('jobStart',function() {
var running = q.stats()._jobsRunning;
if (running>testConcurrency) testConcurrency = running;
testJobsStartFired++;
});
q.on('jobEnd',function() {
testJobsEndFired++;
});
q.on('end',function() {
testEndFired = true;
assert.equal(testExecutedJobs, 10);
assert.equal(testJobsStartFired,10);
assert.equal(testJobsEndFired,10);
assert.equal(testConcurrency,maxConcurrency);
assert.ok(testStartFired);
});
var running = q.stats()._jobsRunning;
assert.equal(testExecutedJobs,0);
assert.equal(testJobsStartFired,0);
assert.equal(testJobsEndFired,0);
assert.equal(running,0);
assert.ok(!testStartFired);
assert.ok(!testEndFired);
q.run();

61
node_modules/qjobs/tests/interval.js generated vendored Normal file
View file

@ -0,0 +1,61 @@
#!/usr/bin/env node
var assert = require('assert');
var qjob = require('../qjobs');
// maximum number of jobs executed in parallels
var maxConcurrency = 5;
// delay between each group of maxConcurrency jobs done
var interval = 1000;
var q = new qjob({
maxConcurrency:maxConcurrency,
interval:interval
});
// number of total jobs
var maxJobs = 20;
// tests dedicated variables
var testExecutedJobs = 0;
var testNbSleep = 0;
// warning, if you change maxConcurrency, maxJobs
// or interval variable, you will have to review
// the testMaxNbSleep value
var testMaxNbSleep = 4;
var myjob = function(args,next) {
setTimeout(function() {
testExecutedJobs++;
next();
},args[1]);
}
// Let's add 10 job and add them to the queue
for (var i = 0; i<maxJobs; i++) {
q.add(myjob,['test'+i,Math.random()*1000]);
}
q.on('end',function() {
assert.equal(testExecutedJobs, maxJobs);
assert.equal(testNbSleep, testMaxNbSleep);
//console.log('Done');
});
q.on('jobStart',function(args) {
//console.log(args[0]+' wait for '+args[1]+' ms');
});
q.on('sleep',function() {
testNbSleep++;
//console.log('zzZZzzzz for '+interval+'ms',testNbSleep);
});
q.on('continu',function() {
//console.log('WAKE !');
});
q.run();

79
node_modules/qjobs/tests/pause.js generated vendored Normal file
View file

@ -0,0 +1,79 @@
#!/usr/bin/env node
var assert = require('assert');
var qjob = require('../qjobs');
var maxConcurrency = 2;
var q = new qjob({maxConcurrency:maxConcurrency});
var testExecutedJobs = 0;
var testStartFired = false;
var testEndFired = false;
var testJobsStartFired = 0;
var testJobsEndFired = 0;
var testConcurrency = 0;
var testPause = false;
var testUnpause = false;
var myjob = function(args,next) {
setTimeout(function() {
testExecutedJobs++;
next();
},50);
}
// Let's add 10 job and add them to the queue
for (var i = 0; i<10; i++) {
q.add(myjob,['test'+i]);
}
q.on('start',function() {
testStartFired = true;
});
q.on('jobStart',function() {
var running = q.stats()._jobsRunning;
if (running>testConcurrency) testConcurrency = running;
testJobsStartFired++;
if (testJobsStartFired == 5) {
q.pause(true);
}
});
q.on('jobEnd',function() {
testJobsEndFired++;
});
q.on('end',function() {
testEndFired = true;
assert.equal(testExecutedJobs, 10);
assert.equal(testJobsStartFired,10);
assert.equal(testJobsEndFired,10);
assert.equal(testConcurrency,maxConcurrency);
assert.ok(testStartFired);
assert.ok(testPause);
assert.ok(testUnpause);
});
q.on('pause',function(since) {
testPause = true;
if (since>2000) {
q.pause(false);
}
});
q.on('unpause',function() {
testUnpause = true;
});
var running = q.stats()._jobsRunning;
assert.equal(testExecutedJobs,0);
assert.equal(testJobsStartFired,0);
assert.equal(testJobsEndFired,0);
assert.equal(running,0);
assert.ok(!testStartFired);
assert.ok(!testEndFired);
assert.ok(!testPause);
assert.ok(!testUnpause);
q.run();