Skip to main content

Using IFTTT to syndicate (PESOS) your Reddit saved post to your own IndieWeb website

3 min read

Introduction

This post has been heavily inspired by Chris Aldrich's recent post Using IFTTT to syndicate (PESOS) content from social services to WordPress using Micropub and finally finds an answer to the frustration I had ever since I realised it was not that easy to post bookmark on my Known-based website.

When you own an IndieWeb website, it quickly becomes clear that you want to centralize all your content in one place, including the posts you save on Reddit.

Now, I spend a fair amount of time on Reddit, but i never spend a long time in one go, meaning I usually scroll my feed, save things that catch my eyes, and come back to them later on when I have more time. The frustration comes from the decentralized part : I have saved bookmarks on my browser, in my company's Slack, on Reddit, you name it. The risk is that I finally forgot about some of them and never reads them at all.

If you need more information on IndieWeb, IFTTT, and why this is awesome, I encourage you to read Chris Aldrich's post. In this post, I'll only talk about the particular case I ran into : silo-ing my Reddit saved posts to a Known-based website.

Getting a token

If you played a bit with Known, you know there's no easy way to generate a token on the fly - as opposed to a Wordpress-based website for instance. But that's OK, Give Me A Token is here to save the day.

 The process is not that long nor difficult, and at the end of step 3, you'll have the possibility to download your token file, save it on your disk for later, that's all we need to do with that right now.

The IFTTT recipe

We can now start to create our own IFTTT applet, in the first part (the if), we'll choose Reddit > New post saved by you as a trigger and i the second (the then), we'll choose Webhooks > Make a web request.

All we have left to do is to fill in the 4 fields in the form :

  • URL : your micropub server endpoint (find yours here)
  • Method : POST
  • Content Type : application/x-www-form-urlencoded

The Body part is the trickiest, but once again I encourage you to ready Chris's post which explain it thoroughly. As far as i'm concerned here's what I typed in the Body field - don't forget to replace YOUR_TOKEN_FILE_CONTENT_HERE by the content of the file we previously downloaded :

h=entry&bookmark-of={{PostURL}}&name={{Title}}&content={{Title}}&category[]=reddit&category[]={{Subreddit}}&YOUR_TOKEN_FILE_CONTENT_HERE

And that's it. All you have to do now is going back on Reddit and save a few posts, IFTTT should shortly trigger your webhook call and syndicate your saved posts on your own website.

 

Syndication

Bon, et maintenant, c'est possible de tooter depuis l'#IndieWeb?

‪Playing playmobil with my sons when my 4yo asks "say my name". Apparently "Heisenberg" wasn’t the expected answer.

Hey @LEGO_Group! My 4yo son received his first Lego set for his birthday and he *loves* it. Sadly, one piece is slightly bent & I can't build the third trolley :( Is there a way to order a replacement piece?

Dites, chez @bpost_fr, il y a quelqu'un qui veut bien dire à mon facteur de faire son boulot? Mon épouse est mère au foyer, présente à la maison 99% du temps quand le facteur passe, et pourtant on s'évertue à nous laisser des avis de passage dans la boîte aux lettres. J'aime pas être l'emmerdeur de service, mais là il y a matière à foutage de gueule.

Remove git branches older than X months

1 min read

For the example, we're deleting merged branches older than 3 months :

for k in $(git branch --sort=committerdate --remote --merged | grep -o -P "(?<=origin\/)[^ ]+"); do
  if [[ ! $(git log -1 --since='3 month ago' -s origin/$k) ]]; then
    git push --delete origin $k
  fi
done

Bon, @bpost_fr, les colis qui débordent de la boîte quand on est pas là, c'est une chose; mais l'avis de passage alors qu'on attend un colis urgent et qu'*on est présent* mais que le facteur à la flemme de sonner, ça commence à faire beaucoup.

Uniquement la moitié du temps, l'autre moitié, c'est pour remplir sa déclaration fiscale ^o)

Hello Mastodon

Triggering a command line on file change

1 min read

Today I was migrating a somewhat old codebase to Ruby on Rails 6.0.0. As per usual, this can be a very tidious job requiring a bunch of depencies to be updated as well. In this case, the Gemfile contains around 150 lines.

When I have to do that kind of job, the first thing I do is commenting out every single gem except for rails itself, then bundle update, then I re-add the other gems to the Gemfile.

It rarely goes smoothly, since every gem has it's own dependencies and sometime the bundle command has trouble to find a way to update everything in one go, so I usually re-add 2-5 gems at once then run bundle update on my modified Gemfile, until all the dependencies have been re-added.

The whole process of going back and forth to editing, saving, running the bundle command is somewhat exhausting, so today I decided to have a look at a more productive way to do this : the following command uses inotifywait to detect whenever I save the Gemfile then run bundle update automagically.

while inotifywait -e close_write Gemfile; do bundle update; done