sciolism

Playing around with technology
Categories: Projects

Introducing sciolism 2019

sciolism 2019 header

Roughly a year ago I announced sciolism 2019. Yesterday I finally shipped the initial release of the theme. It look quite a long time to do the final tweaks and make a decision on when to ship the theme — maybe I should write about this process later because it was a very interesting journey.

sciolism 2019 is a light-weighted and minimalistic theme for the static site generator Hugo. The theme was designed for blogs. In fact this is the very theme that you are looking at right now. Further information is available in the theme’s Readme file. The theme is currently available via GitHub but I submitted the theme to the official Hugo Theme gallery, too. Let’s see when it will arrive there.


Categories: Technology

whoami with nginx

Out of the cookbook of services that you need from time to time there is another service which I decided to host myself: whoami. While “whoami” is a rather broadly used term with different meanings in this particular case it means: “what is my external IP address?”.

One way to find out is to use a service that returns your external IP address as a text string. Luckily this can be easily implemented in nginx. The configuration is rather simple:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
server {
    listen          [::]:443 ssl http2;
    listen          443 ssl http2;
    server_name     whoami.mydomain.tld;
    default_type    text/plain;
    return          200 "$remote_addr\n";

    ssl_certificate […]/fullchain.pem;
    ssl_certificate_key […]/privkey.pem;
}

The most important lines are 5 and 6. These tell nginx to return1 a text string with the remote address (external IP) of the visitor. The \n after $remote_addr adds a end-of-line character to prevent issues with programs not recognizing the end of file otherwise. All other lines are commonly used nginx settings in order to use SSL, http2 etc. Further information on these commands is available from the nginx documentation.

So how do I get my IP address once everything is running? For instance you could use curl to get your IPv4 (using the -4 flag) or IPv6 (using the -6 flag) address:

curl -6 https://whoami.mydomain.tld

  1. We make use of the nginx return function which is shipped with the http_rewrite_module module. As long as you have not explicitly disabled building the module it should be available in your installation. ↩︎


Categories: Projects

build-nginx

For obvious reasons it is sometimes good to build programs from source. I frequently do that with nginx. To ease this process I’ve written a small shell script to facilitate this job.


Categories: Projects

hugo-mod-chartist

Since version 0.59.0 Hugo supports modules. To be honest I found it rather hard to understand how this works but also what the use cases are. Maybe my mindset is still too used to the WordPress world with all the hooks and filters.

However, I finally found a use case for a module. The purpose of the module is to bring in chartist.js functionality into Hugo. Basically the module is a wrapper that does all the hassle of providing the required resources so you only have to include the head-chartist.html partial into your theme’s header and you can start to create graphs.

Read more…