Add to JAILS section:
[ip-blacklist]
enabled = true
banaction = iptables-allports
port = anyport
filter = ip-blacklist
logpath = /etc/fail2ban/ip.blacklist
Array.prototype.forEach = function(fn) | |
{ | |
"use strict" | |
var l = this.length | |
for(var i = 0; i < l; ++i) | |
{ | |
fn(this[i], i, this) | |
} | |
} |
def pascalsTriangle(n): | |
triangle = [[1]] | |
for i in xrange(1, n): | |
row = [] | |
for j in xrange(len(triangle[i-1]) + 1): | |
if j-1 >= 0 and j < len(triangle[i-1]): | |
row.append(triangle[i-1][j-1] + triangle[i-1][j]) |
function htmlToPlainText(html) | |
{ | |
var text = html | |
var aRe = /<a\s+href=['"]([^'"\s]+)['"][^>]+>((?!<\/a>).+)<\/a>/i | |
while(aRe.test(text)) // replace anchors | |
{ | |
text = text.replace(aRe, "$2 ($1)") | |
} | |
text = text.replace(/<!--(?:(?!-->)[\w\W]*?)-->/gi, "") // remove comments |
// Bookmarklet | |
javascript:(function(){var windowSize=[];while(windowSize.length!==2){var windowSize=prompt("Window Size:","1024x768").split("x")}window.open(top.location.href,document.title,"left=0,top=0,height="+windowSize[1]+",width="+windowSize[0])}()) |
"use strict" | |
// Iterator with generator | |
let fibonacci = | |
{ | |
[Symbol.iterator]: function*() | |
{ | |
let pre = 0, cur = 1 | |
while(true) |
#!/usr/bin/env node | |
// Refer to: https://github.com/saadq/koa2-skeleton for more | |
if(process.env.NODE_ENV === "production") | |
{ | |
require("newrelic") | |
} | |
import {install} from "source-map-support" | |
install() |
const mergeObjects = (target, source) => | |
{ | |
const isObject = item => item && typeof item === "object" && !Array.isArray(item) && item !== null | |
if(isObject(target) && isObject(source)) | |
{ | |
for(let key in source) | |
{ | |
if(source.hasOwnProperty(key) && isObject(source[key])) | |
{ |
var XOR = | |
{ | |
encrypt: function(input, key) | |
{ | |
input = typeof input === 'object' ? JSON.stringify(input) : input.toString(); | |
key = typeof key === 'object' ? JSON.stringify(key) : key.toString(); | |
var cipherText = ''; | |
var length = input.length; | |
for(var i=0; i < length; i++) |
const calculate = (expression) => | |
{ | |
return new Function(`return ${expression}`)(); | |
} | |
calculate('1+2/3*4') |