Skip to content

Instantly share code, notes, and snippets.

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@saruberoz
saruberoz / nginxproxy.md
Created January 21, 2021 15:56 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@saruberoz
saruberoz / nginx.conf
Created January 2, 2019 03:29 — forked from micho/nginx.conf
nginx config for http/https proxy to localhost:3000
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf:
@saruberoz
saruberoz / redis_cheatsheet.bash
Created September 5, 2018 15:07 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@saruberoz
saruberoz / using_nginx_as_a_reverse_proxy.md
Created July 25, 2018 06:15
Use NGINX as a Reverse Proxy

Use NGINX as a Reverse Proxy

What is a Reverse Proxy?

A reverse proxy is a server that sits between internal applications and external clients, forwarding client requests to the appropriate server. While many common applications, such as Node.js, are able to function as servers on their own, NGINX has a number of advanced load balancing, security, and acceleration features that most specialized applications lack. Using NGINX as a reverse proxy enables you to add these features to any application. This guide uses a simple Node.js app to demonstrate how to configure NGINX as a reverse proxy.

Install NGINX

These steps install NGINX Mainline on Ubuntu 16.04 from NGINX official repository

  1. Open /etc/apt/sources.list in a text editor and add the following line to the bottom. Replace CODENAME in this example with the codename of your Ubuntu release.
@saruberoz
saruberoz / sop_add_del_user_debian.md
Last active January 18, 2017 09:31
SOP for adding / deleting user Debian

Adding a new user and password for a user

$ adduser demouser
$ passwd demouser

Double check the user file

$ vi /etc/demouser.conf