linux

A 2-post collection

Using Nginx As A Simple URL Shortener

For a long time I used bit.ly (and tinyurl before that) to provide friends and students with short URLs. But that was not perfect. Using bit.ly meant I lost branding control, and that the URLs I wanted were not always available. Owning a domain and a VPS makes it trivial to build your own url shortener. Here's how. Shortening URLs with nginx A URL shortener is just an HTTP server that responds with 301 when known shortcuts are accessed. The following nginx configuration does

Read more

Bash Scripts Quickstart Guide

Bash scripts are a great way to automate simple tasks in our electronic day-to-day life. Once you get used to writing them, it easily becomes a productivity increasing habit. Here's a list of my most often used bash features and constructs. Shebang and Options I like to start every bash script with the following 3 lines: #!/usr/bin/env bash set -e set -o noclobber The first is the shebang line which lets us run the script as executable. Note the use of env which makes

Read more