Blog
- 
        Nginx CertbotFinally, after a week of headbanging, I managed to figure out certbot’s installation process with nginx and how to deploy python apps with uwsgi. 1. Make sure that existing nginx is not listening on port 443There was a tiny trick with certbot’s nginx plugin - if you have a virtualhost, say, in /etc/nginx/sites-available/test.com, you must not listen on port 443. In other words, make sure that:server { # MAKE SURE THESE TWO LINES ARE COMMENTED # listen 443 ssl default_server; # listen [::]:443 ssl default_server; ... }Otherwise, you might get a ‘connection reset by peer’ error. This is because there is already a listen on 443 on the default server block. 2. Make sure that server_name is definedNginx needs a virtualhost to be configured, so if you don’t include a configuration file with the server_name directive set, it will not work: server { # This does not work - this is the default configuration server_name _; # Works server_name test.com www.test.com; ... }
- 
        Calling map on NodeListThis blog post sums it up beautifully, though I don’t understand how a NodeList can be tricked so that one can call ‘map’ on it. If NodeList is a ‘subclass’ of Array, then it should ‘inherit’ the map function. For reference, if the link goes dead, here is how to call map on NodeList: 1 2 3Array.prototype.map.call(nodelist, n => { console.log(n.innerHTML) })
- 
        Init SystemsTo learn what init system your linux box uses, you can do sudo stat /proc/1/exe, since init always runs with pid 1.The ansible servicemodule is an abstraction over the underlying OS’s default init system. It’ssystemdon Ubuntu 16.10 “Yaketty” (butupstarton 16.04 “Xenial”)Similarly, packageis an abstraction over package managers,apton Ubuntu butyumon Fedora. Each of these abstractions allow users to write more generic code, at the loss of more specific functionality that their OS specific counterparts provide(There areaptandyummodules, for example).