02 Jun 2021
I love tinkering with the Raspberry Pis, but one annoying thing about the Raspberry Pi OS (previously called Raspbian) is that it doesn’t always ship with the latest version of Python. As of this writing, that’s Python version 3.9.5.
(Note: To use this tutorial for a newer version of Python, you just need to modify any references to 3.9.5 to the version you want.)
To install the latest version of Python, we have to build it from the source and install it. I will walk through the steps that I followed to get up and running.
Build
To get started, we need to fire up the terminal and install the dependencies.:
sudo apt-get update
sudo apt-get install -y build-essential libbz2-dev libdb5.3-dev libexpat1-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev libncursesw5-dev libreadline6-dev libsqlite3-dev libssl-dev tk-dev zlib1g-dev
Now we download the latest version of Python using wget. At this time, the newest version is Python-3.9.5. You can check the listings from the ftp site here:
wget https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tar.xz
Extract the files with tar:
tar xf Python-3.9.5.tar.xz
Enter extracted directory and compile. Running 4 simultaneous jobs should be good for the Pi 3/4 with the make command:
cd Python-3.9.5
./configure --prefix=/usr/local/opt/python-3.9.5
make -j 4
Install
Now install with:
You can now remove the files that you downloaded and unpacked:
cd ..
sudo rm -r Python-3.9.5
rm Python-3.9.5.tar.xz
Create an alias for your newly installed Python in your .bashrc file.
Open the .bashrc file with your chosen editor, vim, nano, etc. I’ll use nano in this example:
Add the following at the end of the file:
alias python=/usr/local/opt/python-3.9.5/bin/python3.9
Run
Restart your terminal or reload bash:
Verify your Python version:
and you should get:
That’s it! Now you should be ready to start building your next cool project with the latest version of Python on your Raspberry Pi.
Happy hacking :-)
11 Mar 2021
Webhooks are powerful. By themselves, they are relatively simple but can be an integral part of very complex systems. The key to their power is the modularity of systems. A lot of services we use work together with other services to get the job done.
Say you have an online store. You may use one service for your storefront, another service for processing payments, another for generating invoices, accounting, reporting, tracking errors, support tickets, etc. Unless you use a service that does it all, you may need a simple way to connect these parts of your store. Webhooks can help with that.
At the core, webhooks are signals - callbacks made with an HTTP request. They are used to announce some event or state of one system to another system or multiple systems. They are like the long axons in the brain that carry signals from one region to another. While the signals may not necessarily hold a lot of data, they can represent a lot of information and get a lot done.
What makes webhooks great is that they are relatively simple to implement and utilise instead of APIs or sockets. Webhooks are event-driven, which makes them useful for a lot of things, but not all.
Example time
Let’s say that every time someone places an order in your store, you want to update a dashboard that you’ve set up.
Now, let’s say someone has just placed an order for $41.99 (so close!), and their invoice number is 01023. We’ll call the values Amount and Invoice.
Amount = $41.99
Invoice = 01023
Key = ultra-SeCrEtE-key
You’ll notice I added a ‘Key’ there. Using some key or token is one way of ensuring that the message originated from a source you trust.
The request sent from your storefront application to your dashboard app may look something like this, depending on how you chose to send it:
https://yourdashboard.app/orders?Amount=$41.99&Invoice=01023&Key=ultra-SeCrEtE-key
And that’s it. Your dashboard is updated every time there is an order placed. The simplicity of the webhook makes it a great way to connect different services. The complexities of the services used are hidden behind the simple structure of the interaction between the services using webhooks.
12 Sep 2019
This website doesn’t have any tracking or analytics set up. I have no idea who’s reading or where they are coming from. I think this is fine.
By focusing on the process of documenting content and communicating ideas, I get better at it and I’m intrinsically motivated to do more of it. I’ve gained, and continue to gain, a lot of value from the work that other people have put out there and I feel obligated to make some kind of contribution.
I recently finished reading the book Ultra-learning and it ties in brilliantly with my commitment to being a life long learner - I am definelty applying some of the techniques in there. I think in this time, it’s very important to get good at whatever it is you do, not just for your own sake but also to the benefit of others who are direclty or indirectly affected by your work.
18 Aug 2019
I’ve just finished reading James Clear’s book, Atomic Habits, and I found it quite brilliant.
One of the biggest lessons from the book is the power of making small changes and how they compound over time - it’s articulated beautifully in the book. I’m paraphrasing here:
you get what you repeat – time will magnify it
I love this idea and it’s one more thing I’m going to be more deliberate about in my work flow.
I wrote so many notes on this book, it almost felt like I was quoting every sentence! No matter, I will go through the notes and post my full review on Saccader.
04 Aug 2019
Well, I’ve decided to spruce things up a bit.
Panashe’s panache -> Panashe’s Panache Panacea
I’m really making this my space. As in a space that’s mine. So I’ve gone further down the rabit hole and added another noun to the title. I’m not sure if and when this train will come to a stop but I’m too far gone now.
Fails
As much as I like to share what’s worked and all things bright and beautiful, I think it’s important to share my fails – there are quite a few of them. I’ve linked them in the side bar and I’ll keep updating the list as I go. The list will continue to grow, no doubt.
Going dark
I’ve also decided to throw in a new coat of paint on the site that’s slightly darker and easier on the eyes. Hopefully it looks better.