Categories
Linux Software Virtualisation

Feed2Toot

Started looking into a service to auto-post from this blog onto my Mastodon feed. Feed2Toot fit the bill perfectly.

I wanted to run the whole thing from a Docker container, though, so I’ll quickly write a how-to.

This whole thing runs from a Raspberry Pi, as root. No k8s or k3s for me. The path I use is /root/git/feed2toot/, so be sure to modify that to whatever you’re using.

First off, get your credentials for the app. You can either install the Feed2Toot package on a system (i.e. throwaway VM, to keep it clean), or use the Docker container below, but add RUN apk add bash and change the last line to CMD ["bash"] and then chroot into it via docker exec -it feed2toot bash.

This will generate two files (feed2toot_clientcred.txt and feed2toot_usercred.txt). Be sure to save these.

You can also try to run Feed2Toot at least once to make sure it’s working and to fine-tune your ini file. This is mine:

[mastodon]
instance_url=https://mastodon.yeri.be
; Here you need the two files created by register_feed2toot_app
user_credentials=/etc/feed2toot/feed2toot_usercred.txt
client_credentials=/etc/feed2toot/feed2toot_clientcred.txt
; Default visibility is public, but you can override it:
; toot_visibility=unlisted

[cache]
cachefile=/feed2toot/feed2toot.db
cache_limit=10000

[lock]
lock_file=/var/lock/feed2toot.lock
lock_timeout=3600

[rss]
uri=https://yeri.be/feed
; uri_list=/feed2toot/rsslist.txt
toot={title} {link}
; toot_max_len=500
title_pattern=Open Source
title_pattern_case_sensitive=true
no_uri_pattern_no_global_pattern=true
; ignore_ssl=false

[hashtaglist]
; several_words_hashtags_list=/feed2toot/hashtags.txt
; no_tags_in_toot=false

[feedparser]
; accept_bozo_exceptions=true

[media]
; custom=/var/lib/feed2toot/media/logo.png

I have three other files to make this work, first off Dockerfile:

FROM python:3.6-alpine
RUN pip3 install feed2toot && mkdir -p /etc/feed2toot/
COPY feed2toot.ini feed2toot_clientcred.txt feed2toot_usercred.txt /etc/feed2toot/
VOLUME /feed2toot/
CMD ["feed2toot", "-c", "/etc/feed2toot/feed2toot.ini"]

The script I run to build the container (start.sh):

#!/bin/bash
git pull

BASEIMAGE=`cat Dockerfile | grep FROM | awk '{print $2}'`
docker pull $BASEIMAGE
docker stop feed2toot
docker rm feed2toot
docker build -t feed2toot .
./run.sh

And finally, the script to run the container every so often (run.sh):

#!/bin/bash
docker run -d --rm -v /srv/mastodon/feed2toot/:/feed2toot/ --name feed2toot feed2toot

This will save the database file under /srv/mastodon/, to preserve states across rebuilds.

Note that once Feed2Toot runs, it’ll exit, and the container will be stopped. So it does not automatically run all the time.

So, you’ll want to run this every so often. You can add a file to /etc/cron.d/ to run it, for example, every six hours:

#
# cron-jobs for feed2toot
#

MAILTO=root

0 */6 * * *		root	if [ -x /root/git/feed2toot/run.sh ]; then /root/git/feed2toot/run.sh >/dev/null; fi

That’s it. Should do the trick. It’ll now post stuff from your RSS feed onto your timeline.

Oh, and Jeroen has a good post about Mastodon.

Categories
Misc

The World’s Deadliest Thing

Around 1895, whilst investigating the case of a group of musicians who had died after eating cooked ham, a Belgian scientist called Emile van Ermengem identified the bacteria at the heart of Kerber’s sausage poisonings, a disease that had been coined Botulism, after bolutus, the Latin for sausage. Later work showed that these bacteria, which Van Ermengem named Clostridium Botulinum, would only grow under certain conditions. The inside of a piece of badly stored, processed meat was ideal, but when conditions changed, the bacteria would shut down, forming highly resistant spores and remaining in that form until conditions were right again for growth.

A few years later, scientists discovered something even more remarkable. The spores that produce these deadly bacteria were almost everywhere. They were found in the soil, on the surface of vegetables, in animal faeces and within riverbeds. They could survive being boiled, being frozen, and cope with highly acidic environments. Thankfully, these spores were also harmless, passing through humans unchanged if ingested. But under the correct conditions, they would turn back into bacteria, producing a deadly neurotoxin. If this toxin was ingested, even in the tiniest quantities imaginable, it would produce a slow paralysis moving down the body, eventually shutting down vital processes like breathing. For anyone unlucky enough to consume it, the survival rate was around 60%.

[…]

It is perhaps strange that such a rare poisoning event shapes our modern food system so profoundly, but this is perhaps because the toxin produced is one of, if not the, deadliest on earth. It has been estimated that in its pure crystalline form, six grams of botulism toxin, about one teaspoon full, would be enough to kill 200 million people. The lethal dose when consumed orally is around 30 billionths of a gram, which if you want a relatable comparison, is about the same as if you cut a single poppy seed into ten thousand equal pieces and ate one of them. It is an amount so tiny, it really doesn’t make sense.

[…]

The rapid, long-lasting and highly noticeable cosmetic effects made Botox a near instant success. In small doses, the same nerve damage that causes fatal paralysis in poisoning cases, helps to remove forehead creases and crow’s feet, with the only side effects being an inability to express emotion using your face, and an occasional case of drooping eyelids. A distinctive wrinkle-free and slightly startled look became fashionable among the Hollywood A-List, and eventually across the world. It is of course deeply ironic that many celebrities who publicly advocated a clean living, chemical-free lifestyle, were also early adopters of a treatment that involves injecting the deadliest substance on earth into your face (looking at you, Paltrow). If any of them were surprised at this seeming paradox, they certainly didn’t show it.

[…]

[I]t is likely that the pure crystalline form of Botulinum toxin is now also the most valuable, with an estimated street value of $100 trillion per kilogram. The entire global face paralysing industry is supported by an annual production of just a few milligrams.

Source.

Never linked Botulinum and Botox to one another. Wow.

Categories
Misc

shanwong.design

Shameless plug to get Google to index the website faster. ¯\_(ツ)_/¯

I was playing around with the idea to up the marketing and social media stuff for Shan (WFH is taking its toll — I was bored, always doing the same, saw Shan struggle to do both creative and marketing work, and I had plenty of brainjuice left — and in all fairness I was probably getting a bit frustrated and going “why don’t you just …”. So yeah, decided to actually help out and experiment some).

Since medio April I have been running most of the social media accounts, having content scheduled using Hootsuite, increasing followers, etc.

I did some of this before, but it was mostly some random paid advertisement without a real strategy that didn’t lead to anything very substantial. The ROI wasn’t really there and was mostly just a gamble — so far we’ve had more leads from organic growth than from paid ads on Google or Facebook/Instagram. Soooooo something must be wrong there…?!

Another thing that was missing to make her more prominent as SME (subject matter expert) was to have all the knowledge and experience she has more publicly available; ie give some away for free (and help those that wouldn’t hire the services anyway), and then provide enough of a teaser to reel in customers that want more and have budget. The blog will also hold some reviews, plug some contractors and suppliers (create a bit of a win-win situation and platform), etc.

So yeah — I suddenly had this epiphany to set up a blog (using Medium — and I may have been late to the party, but I’ve been watching and wanted to get to know more about the platform — and so far Medium actually has quite some interesting articles).

Got some interviews going with clients, show casing some projects (the portfolio is nice, but doesn’t have a lot of written content) have some posts about what’s going on in Shan‘s mind (those are the ones that take time as Shan needs to sit down and actually give me content) and even wrote about our house. 🙂

So let’s see how that works out — but so far it’s been worth it.

Categories
Hardware Linux Networking Software Virtualisation www

Theme

I had the same theme for over four years. I’ve made quite a few custom css and PHP edits myself, and it had been outdated for ages… But it served me well.

theme-2011

However, it’s now time for something new.

theme-2015

As always, as minimalistic as possible.

On a side note, this blog has been moved from vm1 (and one before that) a virtual machine running on a dual Xeon 3070 (2.66Ghz) at Databarn to Akama, a VM on an 8 core Xeon E3-1230 (3.2Ghz) at Leaseweb.

I’ve also correctly repaired IPv6 on this blog. Apparently nginx never and/or stopped correctly listening to IPv6 (suddenly my Android devices displayed errors on this page, Chrome & Firefox on OS X seemed to fall back to IPv4 instantly… Not sure how long it was broken, but it’s back).

Note to self:

listen          yeri.be:443;
server_name     yeri.be;

Does not work with IPv6, it has to be

listen          [::]:443;
server_name     yeri.be;
Categories
www

diplomatie.belgium.be

Screenshot_2014-02-17-01-16-55

Screenshot_2014-02-17-01-19-44

odd!