ERROR 1129 (HY000): Host 'xxx.xxx.xxx.xxx' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
Resolve:
mysql -u root -p -e 'flush hosts'
ERROR 1129 (HY000): Host 'xxx.xxx.xxx.xxx' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
mysql -u root -p -e 'flush hosts'
var Q = require("q");
// `condition` is a function that returns a boolean
// `body` is a function that returns a promise
// returns a promise for the completion of the loop
function promiseWhile(condition, body) {
var done = Q.defer();
function loop() {
// When the result of calling `condition` is no longer true, we are
// done.
if (!condition()) return done.resolve();
// Use `when`, in case `body` does not return a promise.
// When it completes loop again otherwise, if it fails, reject the
// done promise
Q.when(body(), loop, done.reject);
}
// Start running the loop in the next tick so that this function is
// completely async. It would be unexpected if `body` was called
// synchronously the first time.
Q.nextTick(loop);
// The promise
return done.promise;
}
// Usage
var index = 1;
promiseWhile(function () { return index <= 11; }, function () {
console.log(index);
index++;
return Q.delay(500); // arbitrary async
}).then(function () {
console.log("done");
}).done();
http://stackoverflow.com/questions/17217736/while-loop-with-promises
r for readingw for writingr+ opens for reading and writing (cannot truncate a file)w+ for writing and reading (can truncate a file)rb+ reading or writing a binary filewb+ writing a binary filea+ opens for appending#ls -l | awk '{print $9}'>> liệt kê cả file ẩn
#ls -la | awk '{print $9}'>> nếu chỉ muốn liệt kê directory
#ls -l | grep ^d | awk '{print $9}'>> nếu chỉ muốn liệt kê file
#ls -l | grep -v ^d | awk '{print $9}'
#find . -maxdepth 1 -type f>> xem kết quả
#str_to_rep=""
#for item in `find . -maxdepth 1 -type f`; do
#filename="${filename//.\//str_to_rep}"
#echo $filename
#done
#find . -not -path '*/\.*' -maxdepth 1 -type f