Skip to content

Instantly share code, notes, and snippets.

@SuperShinyEyes
Created January 9, 2018 14:46
Show Gist options
  • Save SuperShinyEyes/1c46b05cd16db4ee249c59717386aeb2 to your computer and use it in GitHub Desktop.
Save SuperShinyEyes/1c46b05cd16db4ee249c59717386aeb2 to your computer and use it in GitHub Desktop.
Use with ethics!

First ssh into kosh.org.aalto.fi

Then run

#/usr/bin/python3

from concurrent.futures import ThreadPoolExecutor
import subprocess

paniikki = [
    "befunge","bit","bogo","brainfuck","deadfish","emo","entropy","false","fractran","fugue","glass","haifu","headache","intercal","malbolge","numberwang","ook","piet","regexpl","remorse","rename","shakespeare","smith","smurf","spaghetti","thue","unlambda","wake","whenever","whitespace","zombie"
]
def get_luokka(nimi):
    try:
        return nimi, subprocess.check_output(["ssh", nimi, "uptime"], timeout=1, stderr=subprocess.STDOUT).decode("utf-8").rstrip("\n")
    except subprocess.TimeoutExpired:
        return nimi, "computer doesn't answer"
    except subprocess.CalledProcessError as e:
        return nimi, "error: %s" % e.output.decode("utf-8").rstrip("\n")

executor = ThreadPoolExecutor(max_workers=8)

for nimi, tulos in executor.map(get_luokka, paniikki):
    print("%s: %s" % (nimi, tulos))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment