Cleaning up Python – and old libraries

Newer Ubuntu releases do not even pre install Python2, and after an upgrade and installing latest Python3.x included in the release, you likely have some old ones there too. Since you most likely will not be using the python2 unless you use some very old library, you can clean them up, clear a lot of disk space and use the “python3” / “pip3” command instead.

Continue reading “Cleaning up Python – and old libraries”

Injecting commands and debugging a running Python program, with Project Euler example

How often has it happened to you… you build a simple script to calculate something, run some bulk process, and coming back after an hour or so it just hangs with no output. Is it doing something or stuck? You could debug it, using WinPdb or Visual Studio Code debugger or GDB to run it step by step, but that would lose the time that it has been processing. Instead, you can use Pyrasite, a program for looking in to a running Python script!

Continue reading “Injecting commands and debugging a running Python program, with Project Euler example”

Machine learning SVM – the usefulness of kernels

If you’ve read through how Support Vector Machines work, you probably know the linear simple SVM might not work in all cases… but how does it fail? Let’s take a look at an example I tried like to my simple example… but change it to be a larger space than just 4, and separated with a region in the middle, and the region around it (positive, negative labelled areas to learn):

Continue reading “Machine learning SVM – the usefulness of kernels”

Human pose estimation with Python and Gluoncv

Human pose estimation is something useful for robotics/programming as you can see what position a person is in a picture. For last weekend’s Hackrithmitic I did an experiment for fun using computer vision pose estimation. To start with I found several possibilities with available libraries:

  • Tensorflow js has been used to say, don’t touch your face, but it takes a massive amount of cpu.
  • Openpose is a popular one, only licensed for noncommercial research use, and there is a Opencv example for it that doesn’t quite show how to use it.
  • AlphaPose is supposedly faster and has a more clear license and possibility for commercial use – if you want that as a possibility. I checked out the install instructions and worked but for “python3” instead of “python”. It also misses obvious step of installing cuda for your Nvidia system before running.
  • GluonCV is another, which seems more user friendly. This one I was able to get running in a few minutes with their example:
Continue reading “Human pose estimation with Python and Gluoncv”

Fixing Ubuntu Python-Pip

After you’ve upgraded your Ubuntu machine a few times, you might find that free disk space is low and some Python commands have issues. Programs like Bleachbit can help you clear old packages or cache that you don’t need, but sometimes you need a minor manual fix as documented here. As you may know, Pip is the main package management you’ll use to install packages you use, so this can be problematic.

After upgrading 16.04 to 18.04, I got an error on command line “pip”:

Continue reading “Fixing Ubuntu Python-Pip”

Hacktoberfest is coming up!

Hacktoberfest is coming up, online this time (well, the core of hacktoberfest always has been online collaboration…), and there are several projects I’ve worked on that welcome contributions:

  • Repeater-START – a useful tool for any ham radio enthusiast looking for repeaters.
  • Hearham Listener – also connects to hearham.com, this is an experimental listener to listen for audible callsigns on the ham radio.
  • Anti-Auto-correct, very useful for students in these remote times!
  • Tunesviewer
  • iosTransferGUI – I had used this for transferring files to iDevices, on Ubuntu.
  • Pylympus – for certain Olympus cameras with wifi-remote, a pure Python remote program.

There are many others and probably plugins or software you use every day that may need contributions or bug fixes, so with less than a month before the start, be thinking about what projects you might contribute to! Check out the full details at https://hacktoberfest.digitalocean.com/events

Possible ABC Proof Conjecture brings Primes into Prime time news again!

Recently a possible proof of the ABC Conjecture has been in the news. Although the proof of this is hundreds of pages long and not really a fun read for most people, this reminded me of the prime spiral, “Ulam spiral” which we explored years ago at a meetup.

The interesting thing about ABC Conjecture is that no matter what examples or counterexamples you find to the inequality, it does not prove or disprove the theory as to where there are only finitely many specific triples to solve the inequality.

Ulam’s spiral is also a look into prime numbers, but from a visual perspective. Nothing to “prove” here but to see an interesting pattern within numbers. It was supposedly thought of by Stanislaw Ulam during a meeting, doodling numbers, and it was later popularized by Martin Gardner’s writings. It is a great way to have some fun learning how to use Matplotlib to draw up some interesting charts, too:

Continue reading “Possible ABC Proof Conjecture brings Primes into Prime time news again!”

The eBook Shuffle

Remember when there were mini mp3 players with one button and a shuffle feature? If like many geeks you have a bunch of interesting ebooks from Humble Bundle, Oreilly or Github or wherever you get technical books, you probably have folders and folders of lots of interesting books. What if you want to “shuffle” or randomly pick one off your virtual bookshelf and read a bit while staying home? Today I’ll show how to virtually “grab a book off the shelf” of your collection with a simple Python script:

Continue reading “The eBook Shuffle”