When learning a programming language it is important to start building things quickly and to begin applying the theory. I have a tendency to dive into the books and lose myself in the theory, where I should be getting hands on experience.

Over the past few months I’ve generated a bunch of ideas for projects that I want to write, and I selected my first project today.

https://github.com/mischavandenburg/twitter-cli

https://twitter.com/mischa_vdburg

Twitter CLI

Programs should solve a problem. My problem has to do with Twitter. I recently created a Twitter account, and I want to make a tweet whenever I publish something new on my website. I’m currently doing this by hand, and that needs to stop, obviously.

There are bots out there for this, but I want to build it myself. I’ve created the following user stories for my project.

User Story 1

As a user, I need a command that I can run from a bash shell that will post the standard input to my Twitter account

User Story 2

As a user, I need a command that I can run from a bash shell that will take the latest post from the RSS feed generated by my blog and post it to Twitter

Concepts

By writing this program I’ll need to figure out the following problems in Go:

  • Taking input from the command line
  • Authenticating to the Twitter API
  • Making a POST request to the Twitter API
  • Curling an RSS feed
  • Looping over / reading XML / HTML data
  • Transforming that data to a suitable format to post to Twitter

Expansion

This will be a good start for my project and will keep me busy for a while. When I solved the previous problems I can use the result and expand further. Some thoughts about further expansion:

RSS Feeds

I can use the skills I learn to start crawling Reddit feeds and filter them for keywords. I can automatically generate a curated selection from Reddit which will be easier to consume and will save me time by only serving me content that I might think is interesting to me, based on keywords.

Database

I want to learn more about using databases on Kubernetes and how to interact with databases using Go. For this I’d like to store my RSS feed into a database and keep track of information in the database. I could track whether an article has been posted to Twitter and when.

Bot

Rather than posting my latest blog post to Twitter by manually running a command, I should have a bot scanning my blog and posting to Twitter when it detects a new article. Or I could trigger the bot whenever I make a push to my blog repo.

In any case, I want to have an application running on a server. I’m making plans to start up a proper home lab and this will be a perfect use case to start running on my home Kubernetes cluster.

202304081304

https://github.com/mischavandenburg/twitter-cli

https://twitter.com/mischa_vdburg

[[go]]

[[go-twitter-cli-project]]