Skip to content

Instantly share code, notes, and snippets.

View amslezak's full-sized avatar

Andy Slezak amslezak

View GitHub Profile
@amslezak
amslezak / for-await-of.js
Last active December 8, 2018 03:06
simple for-await-of snippet/example
// for await of
const fetch = require('node-fetch')
const urls = [
'https://swapi.co/api/people/1',
'https://swapi.co/api/people/2',
'https://swapi.co/api/people/3',
'https://swapi.co/api/people/4',
]
@amslezak
amslezak / haproxy.cfg
Last active January 8, 2022 16:55
Example HAProxy 1.6+ config for serving static content from AWS S3 bucket
# This config will serve up: http://<haproxy>/foo/index.html
#
# This post was indispensable
# https://stackoverflow.com/questions/39964607/haproxy-forward-request-to-s3-hosted-site
global
#debug # Uncomment this line to debug and then comment out daemon
daemon
maxconn 256
@amslezak
amslezak / find process using port PID
Last active January 24, 2020 22:15
find process using port (PID)
lsof -t -i :PORT_NUMBER
@amslezak
amslezak / docker.md
Last active July 17, 2019 15:23
docker commands (cheat sheet)

Docker Cheat Sheet

delete docker managed volumes, but not bind mounted "volumes".

docker-compose rm -v

npm install -g @cacherapp/cli
aws s3 ls --summarize --human-readable --recursive s3://bucket-name/
@amslezak
amslezak / socat
Last active January 24, 2020 22:23
helpful as a quick reverse proxy
snagged from: https://gist.github.com/1901/53a57217b213aab22cfd60152a7f954b
# install socat on CentOS 6.x
rpm -ivh https://forensics.cert.org/cert-forensics-tools-release-el6.rpm
yum install socat
# tcp
nohup socat TCP4-LISTEN:3306,reuseaddr,fork TCP4:192.168.1.2:3306 >> socat.log 2>&1 &!
# udp
ssh -i "key.pem" -D 8123 HOST
FROM ubuntu:18.04
CMD [ "sh", "-c", "tail -f /dev/null" ]
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -outform PEM -pubout -out public.pem