Какие должны быть мои действия?
var path = require('path');
var express = require('express');
var app = express();
app.use(express.static(path.join(__dirname, './public'))); // если сайт лежит в папке public в корне проекта
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
<?php
// script for cron
shell_exec('php script1.php > /dev/null 2>/dev/null &'); // run script1.php as background process
shell_exec('php script2.php > /dev/null 2>/dev/null &'); // run script2.php as background process
shell_exec('php script3.php > /dev/null 2>/dev/null &'); // run script3.php as background process
?>
...
struct argkeys {
const char *name;
int shortname;
char *helpstr;
char *manstr;
char *description;
};
extern const struct argkeys ArgKeys[];
const struct argkeys ArgKeys[] = {
{"help", 'h', "-h, --help", "-h[--help]", "description"},
{"version", 'v', "-v, --version", "-v[--version]", "description"}
};
...
char* generate_password(char *symbols, int length)
{
srandom(time(NULL));
int counter = 0;
char randChar;
char *result = malloc(length + 1); // FIX
if(length < 1) {
printf("Type in a password Length \n");
scanf("%d", &length);
}
while(counter < length)
{
randChar = symbols[random () % strlen(symbols)];
result[counter] = randChar;
counter++;
}
return result;
}
На примере с промисами как не пытался, они не работают.
var getStore = function (sessionID) {
return new Promise(
function (resolve, reject) {
sessionStore.get(sessionID, function(err, session) {
if(err) {
reject(err);
}
resolve(!!session);
});
});
}
// usage
getStore(1).then(function(isAuth){
// isAuth - true or false
}, function(error){
// error
});
#!/usr/bin/python
# -*- coding: utf-8
import sys
import requests
if len(sys.argv) > 1:
proxy_file = sys.argv[1]
url = "http://foto.konkurs.ru/like.php?id=123" # URL фэйковый )))
counter = 0
with open(proxy_file, 'r') as proxyFile:
for proxy_line in proxyFile.read().splitlines():
pr_dict = {"http": "http://%s" % proxy_line}
try:
result = requests.request(
"GET", url, timeout=(5, 10), proxies=pr_dict)
if result.status_code == requests.codes.ok:
counter += 1
print proxy_line
except requests.exceptions.ConnectTimeout:
print "Error: %s" % proxy_line
except requests.exceptions.ReadTimeout:
print "Error: %s" % proxy_line
except requests.exceptions.ConnectionError:
print "Error: %s" % proxy_line
except:
pass
print "Total success requests: %d" % counter
$ cat 1.txt 2.txt 3.txt | sort | uniq > proxies.txt
$ nohup ./votes.py ./proxies.txt &
__get_date() {
local date=$(date --date="-$1 day" +%d.%m.%Y)
echo ${date}
}
__get_url() {
local date="$1"
echo "http://webanetlabs.net/freeproxylist/proxylist_at_${date}.txt"
}
__get_status() {
local offset="$1"
local date=$(__get_date ${offset})
local __url=$(__get_url ${date})
local status=$(wget --spider -S ${__url} 2>&1 | grep "HTTP/" | awk '{print $2}')
echo "${status}"
}
get_proxy_list() {
local savefile=~/.PROXY_LIST
local counter=0
while [ $(__get_status ${counter}) != "200" ]; do
counter=$(($counter + 1))
done
local date=$(__get_date ${counter})
local url=$(__get_url ${date})
wget --output-document=${savefile} ${url} > /dev/null 2>&1
cat ${savefile}
}
function insertAtCursor(myField, myValue)
{
if (document.selection) {myField.focus(); document.selection.createRange().text = myValue;}
else if (myField.selectionStart || myField.selectionStart == '0') {myField.value = myField.value.substring(0,myField.selectionStart) + myValue + myField.value.substring(myField.selectionEnd,myField.value.length);}
else {myField.value += myValue;}
}