Skip to content

Instantly share code, notes, and snippets.

View andrewh's full-sized avatar
🛀

andrewh

🛀
View GitHub Profile

Keybase proof

I hereby claim:

  • I am andrewh on github.
  • I am andrewh (https://keybase.io/andrewh) on keybase.
  • I have a public key ASC8teA31aZ0PyFgd7wQIJwy-g3yPmhCtttEZE0eW1nhAwo

To claim this, I am signing this object:

@andrewh
andrewh / greek.py
Created October 22, 2020 23:41
Print the Greek alphabet
#!/usr/bin/env python
print("""
α Α = alpha
β Β = beta
γ Γ = gamma
δ Δ = delta
ε Ε = epsilon
ζ Ζ = zeta
η Η = eta

http-ping

$ http-ping -c 5 -u google.com
Found google.com, assuming you mean http://google.com/
HTTP-PING google.com (62.253.3.89): GET request
11K bytes from www.google.co.uk: http_seq=0 status=200 time=301.44 ms
11K bytes from www.google.co.uk: http_seq=1 status=200 time=186.29 ms
12K bytes from www.google.co.uk: http_seq=2 status=200 time=185.33 ms
12K bytes from www.google.co.uk: http_seq=3 status=200 time=288.65 ms
@andrewh
andrewh / anyconnect.scpt
Last active April 12, 2024 08:48
Applescript to automate the Cisco AnyConnect SSL VPN client on OS X Mavericks
-- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor
-- 2. Substitute "vpn.example.com" and "redacted" for your VPN server and password
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility
-- 4. Enable Applescript Editor and System UI Server
-- 5. Trigger script from the menu
-- 6. Enjoy being connected
tell application "Cisco AnyConnect Secure Mobility Client"
activate
end tell
@andrewh
andrewh / qpasswd
Last active August 9, 2022 21:53
Password generator using a quantum random number generator
#!/usr/bin/env ruby
# qpasswd - password generator from quantum RNG
require 'open-uri'
rng = 'https://qrng.anu.edu.au/wp-content/plugins/colours-plugin/get_block_alpha.php'
ARGV.size < 1 ? pw_size = 16 : pw_size = ARGV[0].to_i
data = open(rng).read.strip.split('')
output = data.sample(pw_size)
#!/usr/bin/env bash
set -e
FILES_TO_PRUNE="path_to_large_file_from_root_of_repo"
# FILES_TO_PRUNE="${FILES_TO_PRUNE} <full_path_from_repo_root>"
catch_error () {
local cmd_name=$1
local ret_code=$2
@andrewh
andrewh / ps.sh
Last active December 17, 2015 06:48
Useful ps commands
# Tested on Ubuntu 12.04
#
# Prints full commands, with environment, with wrapping
ps -efww ef
# Prints all commands with CPU and memory usage, sorted by memory in ascending order
ps -eo cmd,%cpu,%mem --sort +%mem
# Same with descending order
ps -eo cmd,%cpu,%mem --sort -%mem
@andrewh
andrewh / primes.sh
Last active April 13, 2016 14:56
Prints the distribution of primes in the terminal using OpenSSL
#!/bin/sh
die () {
echo $1
exit $2
}
red () {
if [ -x $(which tput) ]; then
tput setaf 1