Skip to content

Instantly share code, notes, and snippets.

View samuelharmer's full-sized avatar

Samuel Harmer samuelharmer

View GitHub Profile
@samuelharmer
samuelharmer / time_hashing.py
Last active July 8, 2018 17:33
Time and rank `hashlib.algorithms_available` on a given platform
import argparse
import time
import hashlib
import os
from collections import defaultdict
# https://stackoverflow.com/a/1094933/594137
def sizeof_fmt(num, suffix='B'):
@samuelharmer
samuelharmer / connect_to_lab.sh
Last active February 7, 2020 12:36
ConnectToLab
#!/usr/bin/env bash
all_hosts=`echo it{025956..025995}.users.bris.ac.uk
it{052556..052595}.users.bris.ac.uk`
up_hosts=`nmap -sn -PS22 --max-parallelism=100 -T5 ${all_hosts} -oG - | awk -F'[()]' '/Up$/{print $2}'`
rand_up_host=`echo "${up_hosts}" | shuf -n 1`
ssh ${rand_up_host}