Skip to content

Instantly share code, notes, and snippets.

<?php
declare(ticks = 1);
class TimeoutException extends Exception {};
function signal_handler($signal) {
throw new TimeoutException();
}
@soxofaan
soxofaan / README.md
Last active January 19, 2024 17:48
Simple pretty CSV and TSV file viewer.
@6footGeek
6footGeek / ipToAsnLookup.php
Created August 23, 2017 09:54
IP to ASN lookup PHP
private function getAsnFromIP($ip)
{
$query = 'whois -h whois.cymru.com " -f ' . (string) $ip . '"';
$whoisResult = shell_exec($query);
$asnArray = explode('|', $whoisResult);
$cleanAsn = array_map('trim', $asnArray);
return $cleanAsn;
}
@fnky
fnky / ANSI.md
Last active April 18, 2024 09:48
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@dbkinghorn
dbkinghorn / netplan2NM.sh
Created June 23, 2020 17:07
Change Ubuntu 20.04 server netplan to use NetworkManager instead of networkd
#!/usr/bin/env bash
# netplan2NM.sh
# Ubuntu server 20.04 Change from netplan to NetworkManager for all interfaces
echo 'Changing netplan to NetowrkManager on all interfaces'
# backup existing yaml file
cd /etc/netplan
cp 01-netcfg.yaml 01-netcfg.yaml.BAK