Skip to content

Instantly share code, notes, and snippets.

View amslezak's full-sized avatar

Andy Slezak amslezak

View GitHub Profile
@amslezak
amslezak / cloud9_ide
Last active May 16, 2022 12:26
make cloud9 IDE a native mac app
npm install nativefier -g
curl -sL https://github.com/c9/core/raw/master/build/osx/c9.icns > c9.icns
nativefier --app-name "Cloud9 IDE" --icon c9.icns --conceal --overwrite https://ide.c9.io/[user-name]/[workspace-name]
@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 / ssl-alb
Last active May 9, 2020 00:31
tl;dr of https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-ssl.html Used for many generating self-signed certificates for backend services and uploading to AWS ACM
#!/bin/bash
# generate private key to create certificate signing request
# privatekey.pem
openssl genrsa 2048 >private.pem
# create a certificate signing request (CSR)
# csr.pem
openssl req -new -key private.pem -out csr.pem
@amslezak
amslezak / mysqldump
Last active May 1, 2020 20:16
dumps just structure. useful for rds dumps
/usr/local/mysql/bin/mysqldump --host=${hostname} --port=${port} --user=${dbuser} --password=${dbpass} --lock-tables=false --no-data --routines=true --verbose --set-gtid-purged=OFF --skip-tz-utc ${dbname} > ../dumps/AWS_${dbname}_${dt}.dump
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -outform PEM -pubout -out public.pem
@amslezak
amslezak / nodemon.json
Created March 12, 2020 17:27
clear nodemon after each save
{
"events": {
"start": "cls || clear"
}
}
FROM ubuntu:18.04
CMD [ "sh", "-c", "tail -f /dev/null" ]
ssh -i "key.pem" -D 8123 HOST
@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
@amslezak
amslezak / gist:dbecd23215a6be215e71edb19337f341
Last active January 24, 2020 22:15
basic key/value object loop pattern
json.forEach(function(val){
var keys = Object.keys(val);
console.log(keys)
html += "<div class='cat'>"
keys.forEach(function(key) {
html += "<strong>" + key + "</strong>: " +val[key]+ "<br>";
});
html += "</div><br>"
})