Posts | Diogo Peralta Cordeiro

Passionate about the surrounding nature.

HaP Seminar - A Tour of ActivityPub

May 08, 2019 — Diogo Peralta Cordeiro


I'll be doing a seminar on ActivityPub this 2019-05-17 starting at 15:00:42h in FC6-0.29 (Anf. 2), Department of Computer Science - Faculty of Sciences of the University of Porto, 4169-007, Rua do Campo Alegre 1021, Porto.

The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format. It provides a client to server API for creating, updating and deleting content, as well as a federated server to server API for delivering notifications and content.

In this Talks@DCC, we will go for a small tour through the history of the Fediverse, the context in which ActivityPub was introduced, the internals of its implementation among other challenges we find on the software and networks engineering of a federated social network.

Major topics to be covered during the seminar:

  • The IndieWeb
  • Briefing of OStatus
  • WebFinger
  • ActivityStreams
  • Overview of the Actor model
  • ActivityPub

At the end of this journey, we should be able to better understand some of the advantages of this kind of social platforms as well as some of the technical complications in their maintenance and conception.

What is the Fediverse?

January 19, 2019 — Diogo Peralta Cordeiro

The fediverse, a portmanteau of "federation" and "universe", is part of the IndieWeb and consists on a decentralized social network that started with GNU social. Nowadays there are various pieces of software, other than GNU social, in the fediverse, like Pleroma and Mastodon, (all of which can be installed on your own server).

The fediverse has grown to have its own culture and is relevant because, quoting * When you post something on the web, it should belong to you, not a corporation; * Your articles and status messages can go to all services, not just one, allowing you to engage with everyone; * You can post anything you want, in any format you want, with no one monitoring you.

What does it mean to be decentralized in the fediverse context?

Before getting into that, let me just quickly familiarize you with the term Actor from the ActivityStreams 2.0 vocabulary, Actor is someone or something that makes an action:

Each node (a.k.a.: instance) of the network provides content and helps peers to see each other, content is available in the network as long, and to whom, its actor wishes, even if the actor (and/or the actor's node) is offline. In order to this be possible, each node hosts "all" the external nodes addresses and "all" their content (not really "all", just the relevant for the actors involved). Actors send their content to a node and this becomes immediately available to all actors connected to the node, and is distributed to "every" other node (again, not every, it is distributed through the fediverse as it makes sense).

When local actors (actors in the same node) participate in discussions with external actors (from other nodes) or simply subscribe to external actors' content, their node push that content to the relevant other nodes and eventually makes it available to all the connected actors. That selective node-based distribution creates, inside the global network, a more or less extended local aggregation that is called the fediverse.

If this arose your interest, there are various public GNU social nodes for you to try, I'm on LoadAverage!

A brief technical history

At present, there are three super-networks in the federated social communication space, and they run on different protocols. They are known as The Fediverse, The Federation and The ActivityWeb. While these super-networks function in similar ways and even have similar aims, they each come from a different history of development, and by extension, a different stack. The overlapping series of networks can be referred to in macro as The Free Network.

The Fediverse has historically operated as a micro-blogging network, and uses the OStatus protocol for servers to communicate with one another. It was introduced around 2010 and pulls together different platforms, namely: GNU social (and the fork postActiv), Friendica, Hubzilla and Pleroma. Mastodon used to support but has recently dropped. Pleroma won't maintain anymore and may drop in the future.

The Federation has begun in 2010 with servers that only ran Diaspora. Structurally, Diaspora functions more like Facebook: it supports long-form content rather than short-form, and every post has a designated thread for comments. It also supports private statuses and an inbox for direct messages. In all, it pulls together different platforms, namely: Diaspora, Friendica and Hubzilla.

The ActivityWeb was introduced with ActivityPub around 2018, based in's ActivityPump protocol, it pulls together different platforms, namely:, Mastodon, Pleroma, Pixelfed and Nextcloud. GNU social support for ActivityPub is in the works and is expected to be finished in the summer of 2019.

In time, every platform in The Free Network will likely be supporting ActivityPub and therefore these distinct super-networks will fold into one federated super-network containing everybody and maximizing interoperability between all the different systems. When they fold into one, we will call it fediverse because it all started with fediverse and subjectively sounds better and is easier and faster too say. On the other hand, in portuguese, to diminish confusion with Faits Divers (fé-divér), "Rede Livre" might be a better option. OStatus shouldn't be discarded though as it maximizes the compatibility between various different protocols. It would be nice to see ActivityPub being integrated in a newer version of OStatus, or at least have ActivityStreams 2 being adopted by OStatus.

If all those protocols allow the same why is ActivityPub being so widely adopted instead of the already existing ones?

It was essentially a matter of presentation. ActivityPub does solve some technical problems of the already existing alternatives. But, despite its problems and trade-offs (because it isn't perfect either), "ActivityPub is to HTTP what HTTP was to TCP/IP" (in the words of Riley Taylor) whereas older protocols, like OStatus, were shared as a complicated (because it requires implementing various different protocols - which actually is one of its advantages too as maximizes interoperability) solution to build a federated Twitter clone. This fact together with the simplicity claimed to be part of ActivityPub implementation lead to its large and fast adoption.

Final remarks

Some of this publication's content was adapted from Fliphodl's ep. 1 on Social Media Alternatives Series, Sean Tilley's Quick Guide to The Free Network and "Riley Taylor's post on why ActivityPub could be the future" (no longer available online). Even though their content has been heavily edited, that remains as a fact and they are still worth linking to (as I didn't include all of their relevant content).

There are various links in this post that weren't adapted and included as the three above mentioned, that's because, in my opinion, there was no need to either update, add or filter parts of their content in any way. This post is meant to be a, reasonably self contained, short sum up of what the fediverse is, while providing you with various links to good resources containing further details and more comprehensive histories of this amazing world.

* I'm excited to see what GNU social will be doing this summer! :) *

Teaching Robotics to kids

December 22, 2018 — Diogo Peralta Cordeiro

Few days ago I've received an email from a professor asking if I was interested in giving a workshop on Robotics at Happy Code Maia. I naturally was, as it would be a great opportunity to share one of my passions with younger students :)

What is Happy Code?

Happy Code is a school focused in teaching programming to kids; Their goal: "Promote the teaching of programming and computational thinking in youth".

In Portugal's schools we are educated in natural sciences and specialize over time. Despite this, Computer Science, (whose name suggests being a science), is still not covered.

I believe the presence of CS in national school programs is as important as that of any other scientific subjects. There are a number of active initiatives to bring Computer Science to schools, but unfortunately, I believe they fail to grasp the essence of the subject and what ends up being taught is just programming with an apparent claim of being all there is to CS...

Computer Science is much more than just code. If there is interest in introducing students to this world, I would propose a program covering topics in discrete mathematics, the concept of computing, formal languages and just then algorithmic thinking using python (instead of a language like visual basic). Would it make sense to go through such topics at schools? Well, in my humble opinion, I think that would be somewhat similar to what is being done with the other subjects, if that's not appropriate, perhaps we should review the goals of the entire educational program about what tools and mental skills students are expected to have after school. At least this would make the program consistent.

How was the workshop?

The workshop I gave was not about CS nor Programming though. It was about Robotics, a theme vague enough to let me explore a variety of exciting and intriguing subjects. After explaining what automation and robots are about, I've talked about Systems Theory and described what a complex system is, with a special focus on network science. The Internet of Things (IoT) was obviously the best example of a complex graph I could approach as it was an opportunity to talk about how robots can use it to exchange data between them. Furthermore, I wanted to make a bridge between Systems, Control and Robotics, so complex systems was the way to expose some of the challenges faced in the field of Intelligent Robotics (like path planning) and Mobile Robotics (like dynamical systems). We have then moved to Digital Electronics and basic Physics, where principles like Ohm's law and Linear Momentum were covered to explain how Circuits and Photoresistors work, respectively.

"Education is the kindling of a flame, not the filling of a vessel." - Socrates

Although it may look like I spent 3 hours throwing advanced course material at the poor little kids, that was not the case. It is true that I have introduced a variety of hard academic modules. But I'm excited about those things and I believe I was able to share that enthusiasm with them. By the end, some of the students have both asked me to talk more about some things that I didn't originally intend to cover and where they could further learn about this. I've obviously suggested DCC-FCUP!

I think we shouldn't be selecting "the easy stuff" to captivate students, we can't forget what the subjects are about, we should pick the subject and show what it is and why so many people became passionate about it, otherwise we are basically saying people just enrolled because they didn't know what it really was about.

Computer Science is huge and I'm only sad for not being able to "take it all". I'm not following CompSci because it is easy, it's not easy at all. I am taking various elective modules and I choose those that covers "powerful stuff", stuff that will allow me to make change, not easy stuff that I could eventually learn in a work week. I believe this is what quality successful education does with students.

Final remarks

I've enjoyed the overall experience and I'm thankful I was given this opportunity. When teaching kids this young it is a challenge to keep them focused and still show the essence of a topic. Despite that, it was fun and they enjoyed toying with Arduino, sensors and actuators. Furthermore, at the end, when I quizzed them, they were able to explain how to build circuits we'd built and to propose solid solutions for somewhat different situations.

On the other hand, I would rather see them exploring Nature, Literature, Arts and Philosophy than locked in a room exploring science. Kids these days already have a lot of science at school and, IMHO, spend there far more hours than what they really need or should. There will be time for them to explore science, no need to rush things.

Arts, Literature and Philosophy are sometimes dismissed by those in the world of STEM and that's sad, but there are some initiatives working to change that. I really feel those are an essential part of me and play an important role in my life.

I'll be giving a more advanced version of this workshop in Hackers at Porto. I started HaP because I wanted to spend some of my free time, i.e. when not busy learning science in college, with colleagues exploring technology. I think this is a fun way of discovering more about what we want and helps expanding our horizons.

Happy hacking!

Download Workshop Materials

Why University of Porto?

December 14, 2018 — Diogo Peralta Cordeiro

I am an undergraduate student from Faculty of Sciences, University of Porto in Computer Science since 2017 and so I thought I would write a post about the experience. Most of the information below is available in U.Porto's official website and Wikipedia, all I've done was to sum up and translate some bits.

About U.Porto

The University of Porto is the most sought-after university in Portugal and one of the world top 500 universities (according to CWTS Leiden Ranking) for the field of Mathematics and Computer Science regarding scientific impact (PP(top 10%) = 9.4%). Close to 32,000 students and 2,000 teaching and research staff attend its 15 colleges and nearly 50 research units, covering the whole fields of knowledge and all levels of higher education.

Representing itself as a leading research university, the University of Porto is responsible for almost 25% of all Portuguese scientific production and for some of its greatest innovations. The Science and Technology Park of the University of Porto, with its 180 startups, is the center of Porto’s innovation ecosystem, considered one of the strongest in Europe.

Embedded in a city classified as a UNESCO World Heritage Site and elected as Best European Destination for the third time in five years, the University of Porto offers a vibrant and multicultural environment, to which more than 4000 international students, comprising 167 nationalities, contributes each year.

About Porto City

Porto is one of the oldest cities in Europe and thanks to its fierce resistance during two battles and sieges in history, it has earned the epithet of ‘Cidade Invicta’ (Invincible City). Unique, hospitable and cosmopolitan, the city of Porto is situated in the north of Portugal. It is the second largest city in the country, with approximately 237,000 inhabitants and, in total, the district of Porto has 1,300,000 inhabitants. It lies in a very special geographical setting, between the river and the sea, and can easily be described as the amphitheatre overlooking the Douro River, beside which it was born and presides.

The city has good public transports and concert halls of a rare beauty and elegance such as the "Coliseu do Porto" by the Portuguese architect Cassiano Branco; an exquisite example of the Portuguese decorative arts.

Porto's most popular event is St. John ("Festa de São João") on the night of 23–24 June. In this season it's a tradition to have a vase with bush basil decorated with a small poem. During the dinner of the great day people usually eat sardines and boiled potatoes together with red wine.

Another major event (and more academical) is Queima das Fitas, that starts in the first Sunday of May and ends in the second Sunday of the month. Basically, before the beginning of the revision to exams period preceding the college year’s last exams, students tries to have as much fun as possible. The week has 12 major events, starting with the Monumental Serenata on Sunday, and reaching its peak with the Cortejo Académico on Tuesday, when about 50,000 students of the city's higher education institutions march through the downtown streets till they reach the city hall. During every night of the week a series of concerts takes place on the Queimódromo, next to the city’s park, an average of 50,000 students attend these shows.

Due to its long history, the city of Porto carries an immense architectural patrimony. From the Romanesque architecture of Porto Cathedral to the Social Housing projects developed through the late 20th century, much could be said about the surrounding architecture.

Porto is also home to a number of dishes from traditional Portuguese cuisine. The ''Francesinha'' – literally Frenchy, or more accurately ''little French'' (female) – is the most famous popular native snack food in Porto. It is a kind of sandwich with several meats covered with cheese and a special sauce made with beer and other ingredients. Porto wine, an internationally renowned wine, is widely accepted as the city's dessert wine, especially as the wine is made along the Douro River which runs through the city.


I'm studying Computer Science so I've been most of my time at DCC-FCUP (DCC stands for Department of Computer Science and FCUP stands for Faculty of Sciences of U.Porto).

The department has quality modern infrastructures with wifi and 10 labs (more than 200 workstations). It is a small department, which results in a informal environment that encourages contact with the professors. DCC is close to U.Porto's Botanical Garden which is one of the most beautiful spaces of this University. The department itself and the Faculty of Sciences are also surrounded by many green spaces.

The professors at FCUP promote international high quality research and are known and respected by their contributions. This leads to trust on what is being taught. Furthermore, and thanks to how active the professors are, DCC features a large curricular offer with flexible study options allowing students to have a personalized and always updated training according both to nowadays academical and industrial needs.

U.Porto has various student societies, (I've already counted over 15 in FCUP), which helps the integration of newcomers and allows exploring other extra-curricular activities that would be harder otherwise. I'm myself the founder of one, Hackers at Porto, which is hosted at DCC-FCUP.

DCC Talks is another important aspect of DCC-FCUP, organized by the department's professors, local and foreign reputed lecturers are invited to talk about their current research and/or work. This allows students to make important connections and opens interesting research opportunities.

GSoC 2018

September 20, 2018 — Diogo Peralta Cordeiro

While searching about self hosting services and some kind of distributed social network I found about GNU social, a federated social network. GNU social wasn't in its most active year and I thought about helping them out as I had some experience with PHP! I had also recently read about GSoC in a forum and so figured that maybe I could make some while coding :)

I checked GNU's SoC Ideas page and there was nothing about GNU social, so I mailed them asking about it. Mikael Nordfeldth rapidly proposed some ideas and we made it formal with an HTML snippet!

Okay, now I just had to get a proposal done, easy, right? Right... Maybe not that easy but I was decided to get ActivityPub implemented, so the learning had started!

Initial learning about ActivityPub whiteboard image

I got to know the fediverse and understanding both ActivityPub and GS's plugins interface. Before I actually started implementation of the plugin I have, fortunately, met Daniel Supernault who would become my co-mentor (and friend). He was equally interested about this plugin and helped me when AP would become overly confusing and when the implementation would reveal harder than anticipated.

I think GSoC 2018 worked fairly well with me, mostly due to the incredible folks around GS, it has had its highs and lows as everything, but in general... :) If you're interested in learning more about what was accomplished, refer to my tech report.

I'm happy that I've not only developed something useful but also met various new interesting friends during the summer. I wouldn't say this was only possible due to Google's initiative, in fact, I don't think this would have been much different without it, but I agree it's important that initiatives like these exist and that some people wouldn't have this chance otherwise.

The GSoC advantage: offers some structure and organization, (which you can use without being a participant), provides a helpful stipend and maintains a goal. I've had a lot of fun but I've also ended very tired which wasn't that good given that it ended in the beginning of the new academic year :/

I'm now organizing GNU social's Summer of Code 2019. Did I say that in the end of GSoC you earn a t-shirt and a sticker? The ultimate form of motivation!!!

GSoC Goodies image