Skip to content

Instantly share code, notes, and snippets.

View detelin's full-sized avatar

Detelin Aleksandrov detelin

  • Bulgaria, Sofia
View GitHub Profile
@detelin
detelin / commit-msg
Created February 16, 2018 13:13 — forked from bean5/commit-msg
#!/usr/bin/env ruby
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary and install it in a path listed by `hunspell -D`
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
# 3. Move this file into your repository
# $ mv commit-msg /path/to/repo/.git/hooks
@detelin
detelin / nginx.conf
Created February 2, 2018 03:17 — forked from sansmischevia/nginx.conf
nginx http proxy to s3 static websites
##
## This nginx.conf servers as the main config file for webflow reverse proxy
##
## RCS:
## https://gist.github.com/sansmischevia/5617402
##
## Hardening tips:
## http://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html
##
@detelin
detelin / nginx-lua-s3.nginxconf
Created February 2, 2018 02:57 — forked from raucao/nginx-lua-s3.nginxconf
Nginx proxy to S3
location ~* ^/s3/(.*) {
set $bucket '<REPLACE WITH YOUR S3 BUCKET NAME>';
set $aws_access '<REPLACE WITH YOUR AWS ACCESS KEY>';
set $aws_secret '<REPLACE WITH YOUR AWS SECRET KEY>';
set $url_full "$1";
set_by_lua $now "return ngx.cookie_time(ngx.time())";
set $string_to_sign "$request_method\n\n\n\nx-amz-date:${now}\n/$bucket/$url_full";
set_hmac_sha1 $aws_signature $aws_secret $string_to_sign;
set_encode_base64 $aws_signature $aws_signature;
@detelin
detelin / save-load-docker-images.sh
Created January 25, 2018 11:45 — forked from mmrko/save-load-docker-images.sh
Script to (selectively) save/load multiple Docker images
#!/usr/bin/env bash
# Script to (selectively) save/load multiple Docker images to/from a directory.
# Run ./save-load-docker-images.sh for help.
set -e
directory=$PWD
filter=""
compress=0
@detelin
detelin / 01-docker-tls.sh
Last active January 16, 2018 09:06
Generate Docker certificates for training on TLS
# Configuration
export PUBLIC_DNS=<public hostname>
export PUBLIC_IP=<public host IP>
export PRIVATE_IP=<private host IP>
mkdir docker-ca
chmod 0700 docker-ca/
cd docker-ca/
# CA key
@detelin
detelin / nginxoptimization.config
Created October 11, 2017 12:44 — forked from wearhere/nginxoptimization.config
Optimized nginx configuration for an AWS Elastic Beanstalk environment using an Application Load Balancer.
files:
"/opt/elasticbeanstalk/#etc#nginx#optimized-nginx.conf":
mode: "000644"
owner: root
group: root
encoding: plain
content: |
# Elastic Beanstalk Managed
# Elastic Beanstalk managed configuration file
@detelin
detelin / elasticbeanstalk-environment-nginx.sh
Last active October 19, 2017 08:27
AWS: Copy Elastic Beanstalk environment variables to NGINX config
/opt/elasticbeanstalk/bin/get-config environment | python -c 'import json,sys;obj=json.load(sys.stdin);open("/etc/nginx/nginx_environment_variables", "wb").write("\n".join(["set $%s \"%s\";" % (key, obj[key]) for key in obj]));'