#! Ramblings
of an autodidact...
#! Ramblings

Archives

More advanced Dataclass sorting

More advanced Dataclass sorting While checking my email this morning I came across another useful Pybites tip. It was a great little tip, but I wondered, "what if I wanted to sort by bite level?" Pretty up the output I know it's just an example code, but I like to make my output a bit more readable. A simple loop of the results is all it takes: for bite in sorted(bites

Troubleshooting Connectivity Issues

Troubleshooting Connectivity Issues My son likes to live stream on Youtube and was in the middle of one the other day when his phone ran out of space. He asked me to backup his images and videos for him so that he could make some room. Some Background I've been an avid Linux user for ages so I've gotten used to not having to use iTunes. I recently made the move back to Windows 10, but I detest having to...

Benchmarking Python Code

Need to compare which code is faster, read on to find out how A friend of mine, Mridu Bhatnagar, has been posting some really cool articles explaining how she's gone about solving some LeetCode challenges. They are all interesting, but due to time constraints, I have only attempted to see if I can do a couple of them. Move Zeroes One of the first that I attempted to do was Move Zeroes. I thought that I was...

Advanced type annotations

How to add type annotations to Python dataclasses During the COVID19 outbreak, a lof of companies are either giving away free books, tutorials, or access their training material. One such company is Pluralsight. For the whole month of April 2020, they have given everyone free access to their complete library! The content is just awesome, some of the best I've seen. I have been working through their Python - Beyond the Basics when I came across their section on...

Cleaning up Anaconda environment.yml files

Recreating virtual environments with Anaconda I love working with Anaconda. It makes things so much easier. I enjoy using it so much that I even wrote a guest post article on PyBit.es about my workflow. It goes into much more detail on the subject, but I'll cover a few basics here. With that being the case, there is one aspect of it that I really hate and that is creating the environment.yml project file for distribution. Table of Contents What...

Bash script into a Makefile

Using make can literally make your life easier So the other day on the Pybites slack channel, Erik O'Shaughnessy and I were chatting about something and I happened to mention that I had written a bash script to generate documents from Asciidoc files but wanted to create a Makefile to do the same instead. Without hesitation, he asked for my bash script and got to work! I don't think that I could have found a better tutorial...

Testing ABC's with abstract methods with Pytest

So you want to test ABC's with pytest I was working on writing a new code challenge for Codechalleng.es the other day. It's based on inheritance and composition and uses Abstract Base Classes to define the interfaces that should be implemented in classes derived from it. I was just finishing up with the tests and everything was passing. Then when I checked the code coverage on it, I saw that it was complaining about my Site...

Playing around with Jupyter notebooks

Seeing how notebooks compare to just plain Markdown¶ What is a Jupyter Notebook¶Well it's a document that lets you render markdown code, display code blocks, and also allows you to execute those code blocks and display their results interactively! Needless to say, they are definitely game changers. It's like the Python interpreter...

MongoDB CLI Intro

Why another article on MongoDB After publishing my article on How to install MongoDB on Linux I realized that I should have covered how to access it through the command line! Didn't occur to me that anyone reading it might not want to download and install Robo 3T! Sorry about that! Intro into the mongo cli app It's simple enough. Now I'm no expert but this is what I discovered just playing around with it. (base) ➜...

How to install MongoDB on Linux

Learning about MongoDB So the other day I started going through Michael Kennedy's free MongoDB Quickstart course. Although he covered the Python code portions, he left getting everything setup, up to you. If you're on a Linux machine that uses APT, then keep on reading. Getting MongoDB I could have gone over to MongoDB's download page, and selected the correct version for my setup, but I wanted to stick with the package manager on my machine. The latest version...

Playing around with adding plugins to Pelican

Some parts of my blog were looking pretty blah Math syntax I've been tweaking my blog like crazy. Just making minor changes here and there. I wanted to make things look a little better. For instance, for my rescaling article, I had the following mathematical syntax: ScaledQuantity = (ActualQuantity-MinQuantity)/(MaxQuantity-MinQuantity) What the hell is that? That looks horrible! I know that markdown supports Latex, so I looked and found this awesome resource: Writing Mathematic Formulars in Markdown ScaledQuantity = \frac{ActualQuantity-MinQuantity}{MaxQuantity-MinQuantity} Um, not quite there...

Finally getting the hang of working with Pelican!

Stumbling into a nice Pelican workflow If you've seen my source repo for this site, you know that I followed Erik O'Shaughnessy's Run your blog on GitHub Pages with Python tutorial. It's a great tutorial, I specifically love his one weird trick, but it leaves so many unanswered questions. Go read it now if you haven't and we'll pick up where he leaves off. Luckily he does provide the link to the official documentation. It was...

Pytest fixtures with tear down

Setting up pytest fixtures with teardown code Today after listening to Brian Okken's Test & Code podcast with Anthony Shaw, I was reminded that I wanted to install Anthony's Python Security Plugin for JetBrain's PyCharm IDE. That was a breeze to install and it just worked out of the box. I fired it up and it automatically checked my code and called it good. I then started to write some tests and while checking...

Into the cryptography rabbit hole

Venture Into Cryptography with PyCryptodome Learning about how to encrypt files As dumb as it is, I have an unsecured text file that I use to keep track of all my username and passwords for all of the sites that I frequent. In order to not be so "hackable", I've decided to encrypt the file. I had recently written a couple of coding challenges for Pybites Code Challenges site, using the cryptography module. One was a coding...

Rescaling values for DataScience

Scaling values Today while reading Data Science Algorithms in a Week, from packt, I came across the concept of rescaling values so that when measuring their distances they would be more relevant. The dataset consisted of "House Ownership": Age Annual income in USD House ownership status 23 50,000 Non-owner 37 34,000 Non-owner 20 100,000 Owner 35 130,000 Owner etc.. The aim being to predict whether a person that is 50 years old with an income of $80,000, would...

This is my first post here

Getting my feet wet with this blogging stuff It's not much to look at, but my goal is to show what I'm learning as I go. There's no real "topic" but it will mostly be about what I'm working on and what I have to learn to get it done. Hope that it's of interest to someone......

Receive Updates

ATOM