Skip to content

109 Sandbox

A website made for testing

Remove a trailing slash in PHP

Published ·UPD ·In Miscellaneous
<?php

rtrim($string, '/');

Documentation

php.net/rtrim

Unban an IP address in fail2ban

Published ·UPD ·In Linux

2020-06-13: Copied to recipes.op111.net

With fail2ban 0.10.0 and later, to remove an IP address from all fail2ban jails as well as from the fail2ban database:

sudo fail2ban-client unban <IP-ADDRESS>

The old syntax, which required to specify a jail, can still be used to remove an IP from a specific jail:

sudo fail2ban-client set <JAIL-NAME> unbanip <IP-ADDRESS>

To view all active jails:

sudo fail2ban-client status

To view all IPs in a jail (most recent entries at the end):

sudo fail2ban-client status <JAIL-NAME>

JavaScript function to parse a URL in a browser

Published ·UPD ·In JavaScript

A small function useful for browsers that do not support the URL interface. It was posted by Freddie Fujiwara at Stack Overflow.

function parseURL(href) {
  let location = document.createElement('a');

  location.href = href;

  return location;
}

The function uses the HTMLAnchorElement interface provided by the DOM and returns an object with the properties supported by HTMLAnchorElement: host, hostname, protocol etc.

Documentation and references

WP-CLI packages

Published ·UPD ·In WordPress

A list of WP-CLI packages I have found useful.

Unicode characters, symbols and icons

Published ·UPD ·In Miscellaneous
Symbol Description Hex Dec
Identical to 0x2261 8801
Telephone recorder 0x2315 8981
Black down-pointing small triangle 0x25BE 9662
Trigram for heaven 0x2630 9776
Neuter 0x26B2 9906