Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Testing in production

Ruben de Groot hacktor

🏠
Testing in production
View GitHub Profile
@hacktor
hacktor / bash_functions
Last active Apr 20, 2021
bash functions
View 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() {
View telnet.py
#!/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")