Skip to content

Instantly share code, notes, and snippets.

@hughmp
hughmp / poll.js
Last active January 10, 2020 11:47
generic polling utility
function isTimeExpired(start, delayMs) {
const nowMs = new Date().getTime()
const stopMs = start.getTime() + delayMs
return nowMs > stopMs
}
async function waitMs(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
@hughmp
hughmp / express-generator.md
Created September 23, 2019 10:13
express microservice generator considerations

express-generator

A list of things to consider for inclusion in an express microservice generator.

@hughmp
hughmp / drinking-bird.sh
Created May 14, 2018 08:16
drinking-bird
#!/bin/sh
# colours
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # no colour
# ----------------------------------------------------- prompts
echo "${GREEN}Please enter your cisco credentials (the ones you normally use for http://1.1.1.1) --${NC}"
read -p "username: " USERNAME
@hughmp
hughmp / nginx.conf
Created April 24, 2018 09:43
downgrade public TLS with nginx
# docker run -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf -p 80:80 nginx:1.13.12-alpine
events {
worker_connections 1024;
}
http {
server {
listen 80;
@hughmp
hughmp / id_rsa.pub
Created May 1, 2017 20:27
public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDjM86FsdirFpOplXwqHhC9CuqLZtBFjzC2pUiDQnUMCUg2uShpovJIRlrnPr8UnWgEqXIiFfW4lLNa72Lqh344jl/d8lVHgHw0A7W2jeub/7K/GC0v8KNOv/Pk3Sb/qfwBNmkmM0VkHf3cXsW4cZ4RGZHXWCW8+WKvi3/lYOGfAOzTFG21QU+HLcygDyBXxXXPGL1CcBJPEGq9nxNBkzI6mxsw/IZtAGwNt4pQ3M++DWoxqB1MBcUyYZiQDsShW5HeNu2SjTMFkD79NNA2YmV27jgFxCnggEFE87wfQnXDoovDdlLwsXDSQL+cw2tENqXxq6sgGyFkt+Ime20ffbn5
@hughmp
hughmp / s3-force-delete-all-buckets.sh
Last active April 7, 2017 10:40
recursively delete all buckets and their contents from s3 with s3cli
for bucket in `s3cmd ls | awk {'print $3'}`
do
s3cmd del --force --recursive $bucket
s3cmd rb $bucket
done