Skip to content

Instantly share code, notes, and snippets.

@statico
Last active September 24, 2023 12:15
Show Gist options
  • Save statico/14fa84d7e79722031d5e49694191ba1d to your computer and use it in GitHub Desktop.
Save statico/14fa84d7e79722031d5e49694191ba1d to your computer and use it in GitHub Desktop.

Revisions

  1. statico revised this gist Aug 11, 2020. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions 01_nginx.conf
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,11 @@

    map $request_uri $statico_link {
    include /home/ian/links.conf;

    # Allow hyphens for readability
    ~^/(.+)-(.+)$ /$1$2;
    ~^/(.+)-(.+)-(.+)$ /$1$2$3;
    ~^/(.+)-(.+)-(.+)-(.+)$ /$1$2$3$4;
    }

    server {
  2. statico revised this gist Jul 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 00_statico.link_README.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    **Why?** I wanted an easy way to paste URLs that I use and share a lot.

    **How?** It's just a domain plus a big list of urls (see links.conf) which I edit with a script (see links.sh)
    **How?** It's just a domain plus a big list of urls (see `links.conf`) which I edit with a script (see `links.sh`)

    **Also:** People kept asking for an index page, so I made one (https://github.com/statico/statico-link-list). I'll add social media previews when I can get it to work.

  3. statico revised this gist Sep 26, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 00_statico.link_README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # <a href="https:/statico.link">statico.link</a> short URLs
    # <a href="https://statico.link">statico.link</a> short URLs

    **Why?** I wanted an easy way to paste URLs that I use and share a lot.

  4. statico revised this gist Sep 26, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 00_statico.link_README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # statico.link short URLs
    # <a href="https:/statico.link">statico.link</a> short URLs

    **Why?** I wanted an easy way to paste URLs that I use and share a lot.

  5. statico revised this gist Sep 26, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions 00_statico.link_README.md
    Original file line number Diff line number Diff line change
    @@ -4,3 +4,5 @@

    **How?** It's just a domain plus a big list of urls (see links.conf) which I edit with a script (see links.sh)

    **Also:** People kept asking for an index page, so I made one (https://github.com/statico/statico-link-list). I'll add social media previews when I can get it to work.

  6. statico revised this gist Aug 21, 2019. 1 changed file with 0 additions and 15 deletions.
    15 changes: 0 additions & 15 deletions 01_nginx.conf
    Original file line number Diff line number Diff line change
    @@ -27,19 +27,4 @@ server {
    alias /home/ian/links.conf;
    add_header Content-Type text/plain;
    }
    }

    # HTTPS redirect
    server {
    listen 443 http2;
    listen [::]:443 http2;
    server_name www.statico.link;
    ssl on;
    ssl_certificate /etc/letsencrypt/live/www.statico.link/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/www.statico.link/privkey.pem;
    include /etc/nginx/cipherlist;
    location / {
    return 301 https://statico.link$request_uri;
    }
    include /etc/nginx/letsencrypt;
    }
  7. statico revised this gist Aug 21, 2019. 2 changed files with 8 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions 00_statico.link_README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    # statico.link short URLs

    **Why?** I wanted an easy way to paste URLs that I use and share a lot.

    **How?** It's just a domain plus a big list of urls (see links.conf) which I edit with a script (see links.sh)

    2 changes: 2 additions & 0 deletions 01_nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # From https://stackoverflow.com/questions/29354142/nginx-how-to-mass-permanent-redirect-from-a-given-list

    map $request_uri $statico_link {
    include /home/ian/links.conf;
    }
  8. statico created this gist Aug 13, 2019.
    43 changes: 43 additions & 0 deletions 01_nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    map $request_uri $statico_link {
    include /home/ian/links.conf;
    }

    server {
    listen 443 http2;
    listen [::]:443 http2;
    server_name statico.link;
    root /var/www/html;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/statico.link/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/statico.link/privkey.pem;
    include /etc/nginx/cipherlist;
    include /etc/nginx/letsencrypt;

    add_header Referrer-Policy unsafe-url;
    add_header X-Robots-Tag "noindex, nofollow";

    if ($statico_link) {
    return 302 $statico_link;
    }
    location / { return 302 https://langworth.com/; }
    location /all-links.txt {
    alias /home/ian/links.conf;
    add_header Content-Type text/plain;
    }
    }

    # HTTPS redirect
    server {
    listen 443 http2;
    listen [::]:443 http2;
    server_name www.statico.link;
    ssl on;
    ssl_certificate /etc/letsencrypt/live/www.statico.link/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/www.statico.link/privkey.pem;
    include /etc/nginx/cipherlist;
    location / {
    return 301 https://statico.link$request_uri;
    }
    include /etc/nginx/letsencrypt;
    }
    12 changes: 12 additions & 0 deletions 02_links.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    /10rules https://www.freecodecamp.org/news/ten-rules-for-negotiating-a-job-offer-ee17cccbdab6/ ;
    /1on1 https://randsinrepose.com/archives/the-update-the-vent-and-the-disaster/ ;
    /3paths https://blog.ycombinator.com/three-paths-in-the-tech-industry-founder-executive-or-employee/ ;
    /5000wph https://www.amazon.com/000-Words-Hour-Faster-Smarter-ebook/dp/B00XIQKBT8 ;
    /blog https://statico.github.io/ ;
    /boring https://mcfunley.com/choose-boring-technology ;
    /col https://www.expatistan.com/cost-of-living/index ;
    /crucialconvos https://www.amazon.com/Crucial-Conversations-Talking-Stakes-Second-ebook/dp/B005K0AYH4 ;
    /cto http://www.awadallah.com/blog/2013/03/05/what-does-a-cto-do-2/ ;
    /dh https://www.amazon.com/Developer-Hegemony-Future-Erik-Dietrich-ebook/dp/B0722H41SG ;
    /difficultconvos https://www.amazon.com/Difficult-Conversations-Discuss-What-Matters-ebook/dp/B004CR6ALA ;
    # ...
    13 changes: 13 additions & 0 deletions 03_bin_edit_links.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #!/usr/bin/env bash

    set -eo pipefail

    src=~/links.conf
    tmp=/tmp/links.tmp

    vim $src
    cat $src | sort | sed 's/\s*;*\s*$/ ;/' >$tmp
    cp $tmp $src

    sudo nginx -t
    sudo nginx -s reload