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 handleSignals(){ | |
helpers.log(p_id,`------------SIGINT Detected1!-------------`); | |
helpers.log(p_id,`------------SIGINT Detected2!-------------`); | |
req.post(`${webdomain}/api/p_id/end/${p_id}`, {form:{error:'',msg:'SIGINT DETECTED!'}}, function(err, res, body) { | |
helpers.log(p_id,`------------SIGINT Detected3!-------------`); | |
}); | |
helpers.log(p_id,`------------SIGINT Detected4!-------------`); |
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 handleSignals(){ | |
helpers.log(p_id,`------------SIGINT Detected!1-------------`); | |
request(`${webdomain}/api/p/end/${p_id}`,{ | |
method: 'POST', | |
form: { | |
error: '', | |
msg:'SIGINT DETECTED!' | |
}, |
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
#!/bin/bash | |
main() { | |
pm2-docker start ${BOT_NAME}.json & | |
# Setup signal handler | |
trap 'sigtermHandler' SIGTERM | |
sleep 10 |
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
await retryTimeout(() => async () => { | |
await retryGoTo(() => page.goto(url, {timeout:120000,waitUntil: 'networkidle0'}),3, 20000); | |
await page.waitForSelector('html',{timeout:timeout_value}) | |
await page.waitForSelector('div.controls', {timeout:5000}); | |
await page.click('button.action-force',{delay:helpers.getRandomInt(100, 500)}); | |
await page.waitFor(time*1000); | |
isPlayed=true; | |
return isPlayed |
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
Hericks-Mac-Pro:docker-chrome-vnc herickpaiva$ docker run -p 5900:5900 hmpmarketing/chrome-vnc:2 | |
(EE) | |
Fatal server error: | |
(EE) Server is already active for display 1 | |
If this server is no longer running, remove /tmp/.X1-lock | |
and start again. | |
(EE) | |
xvfb failed to start. |
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
FROM ubuntu:trusty | |
RUN apt-get update; apt-get clean | |
# Add a user for running applications. | |
RUN useradd apps | |
RUN mkdir -p /home/apps && chown apps:apps /home/apps | |
# Install x11vnc. | |
RUN apt-get install -y x11vnc |
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
FROM ubuntu:trusty | |
RUN apt-get update; apt-get clean | |
# Add a user for running applications. | |
RUN useradd apps | |
RUN mkdir -p /home/apps && chown apps:apps /home/apps | |
# Install x11vnc. | |
RUN apt-get install -y x11vnc |
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 Promise = require('bluebird'); | |
const mysql = require("../modules/mysql.js"); | |
const es = require("../modules/es.js"); | |
const cache = require("../modules/memcached.js"); | |
const redis = require("../modules/redis.js"); | |
const helpers = require("../modules/helpers.js"); | |
const FpToMemcache = require("../modules/fptomemcache.js"); | |
exports.iframe = function(req, 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
async function has(id) { | |
const val = await cache.has(`actioncookiecap-${id}`); | |
return { val, id }; | |
} | |
actionFilter.filterVisited = async function (actions) { | |
const results = await Promise.all(actions.map(has)); | |
console.log(results) //Returns [ { val: false, id: 39708 }, { val: false, id: 39709 } ] | |
return results.filter(v => v.val).map(v => v.id); | |
} |
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
actionFilter.filterVisited = function (actions) { | |
actions.forEach(function (action_id) { | |
let actioncookiecap_key = 'actioncookiecap-'+action_id; | |
return cache.has(actioncookiecap_key).then(function(val){ | |
if(val!==false){ | |
let index = actions.indexOf(action_id); | |
actions.splice(index, 1); |