_     _
                       _ __ | |__ | | ___   __ _
                      | '_ \| '_ \| |/ _ \ / _` |
                      | |_) | | | | | (_) | (_| |
                      | .__/|_| |_|_|\___/ \__, |
                      |_|    ...2017-02-06 |___/

ELK
I'm using the ELK stack to keep log messages from my web server, it's quite
overkill, but it's so easy to setup that a simpler solution would likely have
taken way longer and yielded worse results. It's fun to just mess around with
Kibana and see the different kind of visualizations you can do. So far, there
has not come anything useful out of it, but well, I'm not trying to achieve
anything in particular, so there's a certain consistency in the lack of goals
and the lack of results. I might try sometime to integrate more logging into it
but I'm not quite sure how to do it, I basically forgot to include the field
telling the kind of service the message is coming from, so there's no concept
of a web server, this makes it a bit more difficult to introduce other types
of messages, such as SMART from disks, voltages, temperatures, loads and
whatever else system information I might find interesting to log over time.

How to whale the elk
Someone awesome dockerized the ELK stack, into a "for small scale" image that
is very usable for us normal people who don't have dedicated hardware for our
log capturing. Anyway, getting started is really simple, you can surely find the
full documentation online, but I'd like to show (more or less) the steps I did
to get the setup that I'm currently using:

Create a file ls.cnf:
 input { udp { port => 1337 } }

 filter {
     json { source => "message" }

     mutate {
         convert => { "bytesIn" => "integer" }
         convert => { "bytesOut" => "integer" }
      }
 }

Note: The mutate/convert stuff is just to show how you can convert stuff
from strings to integers, it can be left out if you have no need for ints.

In bash:
sudo sysctl -w vm.max_map_count=262144
docker run -p 5601:5601 -v ls.cnf:/ls.cnf -it --name elk sebp/elk
docker exec -ti elk bash
/opt/logstash/bin/logstash -f /ls.cnf

There you are, your very own ELK stack, ready to eat delicious JSON.
Visit the glorious web-interface on HTTP port 5601.
There are various ways to feed it data, basically, it assumes that a line is a
log entry. You can do: echo '{"Hello":"logging"}'| nc -u ip-of-elk 1337
A quick and dirty way of pouring logs from one container into another, is:
docker logs --tail 0 -f container | nc -u ip-of-elk 1337
PS. You can install jq and use it to get your containers IP:
docker inspect elk | jq -r .[0].NetworkSettings.Networks.bridge.IPAddress
Very easy, so simple, good.

Legacy
I still need to migrate contigrator to the new server.. It's quite a nasty piece
of hackwork, and every time I think about migrating it, I think about rewriting
it instead. I definitely do not want to use Jenkins, and pretty much everything
I find fall into either the "can't do enough" or "does everything, twice" bins.
Still, rewriting it might be the best solution. I'm considering it much, soon...

Android Browser
The Android browser has an interesting feature that I can't figure out what is
called.. When you're on certain websites, if you look in the URL bar, there's a
little "R" icon left of the URL, and if you press it, you get a black-on-white
representation of the document, forcibly reflowed to fit the screen, in a nice
size font.. Basically, it turns the website into a mobile edition. What I don't
get is how this works, because, both the pages in the phlog, and the pages on
dusted.dk works with this, but the phlog index, and the dusted.dk index does not
have this icon, even though they use the same HTML template as their sub-pages.

Phlog++
I'm considering adding search to the phlog. I sometimes write down useful stuff
here, though I admit it happens rarely compared to the amount of nonsensical
whining about nothing in particular I do.. Still, it happens, and I even recall
however vaguely, that I've previously written down stuff. So, I'm thinking about
extending the phlog server to allow searching in the text, and also make some
kind of index of all the headlines, since it's capturing them anyway. However,
trouble is, a good search is difficult to implement, and if you want it to be
responsive (autosuggest) then you need to infest the client with client-side
code which I feel has no place on this page.. So I'm not sure what to do about
that. Either accept that there will be some client-side code on the search page,
or settle for a less fancy search functionality.

Factorio
I made a little setup yesterday, and it was cool, but I want to start over now,
and stream the whole thing, I know nobody is watching, and I even remove the
videos from Twitch, but I like the continuity of knowing that I did in fact
stream everything, even if it is never watched and removed.

More phlog...
I never reached Factorio, I will now however.. I just made code-highlighting
work on the phlog, without adding any weirdness to the plaintext syntax.
It's magic. ;)

javascript.js:
const stuff = "awesome";
console.log(stuff);

Some html:
<!DOCTYPE html>
<html><head><title>No!</title></head><body>Yes!</body></html>

And something weird in a blog that's already plain txt:
There we go, plaintext... because.
Stuff!
                                REASONS
                                                                and Arguments!

So yeah, it can do that now, and it's not messing with the readability of the
plain text verison, which is still beautiful.

Factorio!
Now! Yay! Streaming! :)