Skip to content

Instantly share code, notes, and snippets.

@Sn4kY
Sn4kY / password_generate.php
Last active June 5, 2018 13:00
PHP script to generate password. Call url without any query string to get a medium strength password with 15 char width, or with "length=XXX" for more char, or/and with "nocomplex" OR "complex" : http://example.com/password_generate.php?length=30&complex
<?php
function rand_str($size, $complex)
{
// A-Z a-z 0-9
$source = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9));
$password = "";
if ($complex >= 1) {
$source = array_merge($source, str_split('.-_'));
}
@Sn4kY
Sn4kY / failover.sh
Last active January 30, 2022 00:20 — forked from Apsu/failover.sh
A failover script for dual WAN with dual interfaces, using a ping healthcheck and managing default routes appropriately, with antiflap and back to normal state availability
#!/bin/bash
# Set defaults if not provided by environment
CHECK_DELAY=${CHECK_DELAY:-5}
CHECK_LOOPS_FAIL=${CHECK_LOOPS_FAIL:-3}
CHECK_LOOPS_REVERT=${CHECK_LOOPS_REVERT:-5}
CHECK_IP=${CHECK_IP:-8.8.8.8}
PRIMARY_IF=${PRIMARY_IF:-enp0s17}
PRIMARY_GW=${PRIMARY_GW:-192.168.1.252}
BACKUP_IF=${BACKUP_IF:-enp0s18}