Skip to content

Instantly share code, notes, and snippets.

@thorsummoner
thorsummoner / vmstat-prettyblocks-braille
Created December 20, 2018 08:18
a braille character based vmstat display insired by https://www.reddit.com/comments/9ysbx7
#!/usr/bin/env python3
import argparse
import logging
import psutil
import random
import sys
import time
import shutil
import os
python3 <(printf "import pyfiglet, re, sys, pytz, datetime, time\nwhile True:\n\tprint('\\033[1;1H{}'.format(pyfiglet.Figlet(font=sys.argv[1], width=float('inf')).renderText(' '.join(str(pytz.timezone('utc').localize(datetime.datetime(year=2018, month=10, day=31, hour=23, minute=59, second=59)) - pytz.timezone('America/Los_Angeles').localize(datetime.datetime.now()))))))\n\ttime.sleep(0.02)\n") univers
@thorsummoner
thorsummoner / mcad
Created April 22, 2018 22:13
Minecraft Server Advertizements
#!/usr/bin/env python3
import time
import socket
servers = [
["MOTD", 25565],
]
BROADCAST_IP = "255.255.255.255"
@thorsummoner
thorsummoner / nettest.py
Created July 6, 2017 21:42
Serve file of size N over facecgi.
#!/usr/bin/python3
import os
import subprocess
import re
import humanfriendly
SIZE_RE = re.compile("^\d{,4}([KMG])$")
def main():
file_size = (
@thorsummoner
thorsummoner / nettest.cgi.py
Created March 16, 2017 18:35
Dispatch zero-fill file of user request size over the network.
#!/usr/bin/python3
import os
import subprocess
import re
import humanfriendly
SIZE_RE = re.compile("^\d{,4}([KMG])$")
def main():
file_size = (
my_hello = 'Hello!'
my_world = {
'antartica': 'cold',
}
anonymous_callback = function (injected1, injected2, param1, param2) {
param1 = param1 ? param1 : 'One';
param2 = param2 ? param2 : 'Two';
#!/usr/bin/env python3
""" Example argparser based python file
"""
import argparse
ARGP = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawTextHelpFormatter,
@thorsummoner
thorsummoner / userlogs
Created January 18, 2017 20:20
logrotate user logs
# /etc/logrotate.d/userlogs
/var/run/user/*/log/*.log
/var/run/user/*/log/**/*.log
{
daily
missingok
rotate 7
compress
notifempty
@thorsummoner
thorsummoner / pythonic.md
Created October 21, 2016 22:22
How to be pythonic

To answer "getting a better understanding of python", I feel strongly that

#!/bin/sh
true | openssl s_client -connect outlook.com:443 | openssl x509 -noout -text | grep -B1 DNS: