Skip to content

Instantly share code, notes, and snippets.

View hacktor's full-sized avatar
🏠
Testing in production

Ruben de Groot hacktor

🏠
Testing in production
View GitHub Profile
@hacktor
hacktor / telnet.py
Last active February 24, 2021 16:53
#!/usr/bin/env python3
import sys
import socket
from contextlib import closing
def check_socket(host, port):
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
sock.settimeout(1)
if sock.connect_ex((host, port)) == 0:
print("Port is open")
@hacktor
hacktor / bash_functions
Last active April 20, 2021 05:42
bash functions
swaptop ()
{
l="${1:-20}";
for file in /proc/*/status;
do
awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file;
done | sort -k 2 -n -r | head -$l
}
urlencode() {
# The Feigenbaum constant delta is a universal constant for functions approaching chaos via period doubling.
use strict;
use warnings;
use Math::AnyNum 'sqr';
my $a1 = 1.0;
my $a2 = 0.0;
my $d1 = 3.2;
print " i δ\n";