Add to JAILS section:
[ip-blacklist]
enabled = true
banaction = iptables-allports
port = anyport
filter = ip-blacklist
logpath = /etc/fail2ban/ip.blacklist
/* | |
Include SweetAlert before this script | |
http://t4t5.github.io/sweetalert | |
*/ | |
function alert(message, callback) | |
{ | |
callback = callback || function(){} | |
var options = | |
{ |
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]) |
Array.prototype.forEach = function(fn) | |
{ | |
"use strict" | |
var l = this.length | |
for(var i = 0; i < l; ++i) | |
{ | |
fn(this[i], i, this) | |
} | |
} |
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])}()) |
#!/usr/bin/env python3 | |
import http.server | |
import socketserver | |
socketserver.ThreadingTCPServer.allow_reuse_address = True | |
HOST = "127.0.0.1" | |
PORT = 8000 | |
handler = http.server.SimpleHTTPRequestHandler |
"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])) | |
{ |