Category: python
-
How long should it take to solve the FizzBuzz coding question?
So, it was past midnight, and I was pretty much done for the day when one of those random thoughts ran past me like a fleeting glimpse (thanks, Roger) and I just couldn’t let go: if I were asking a candidate to solve the FizzBuzz problem, how long would be fair to expect them to…
-
Uncompromising Python Formatting
I wanted to give a shout out to Black, “the uncompromising Python code formatter.” It really is liberating not to have to worry about code formatting, not having to have unproductive, sterile discussions over PRs about code minutiae and yet being reassured that all your code is nicely formatted; most importantly, the quality of the…
-
File Encryption Utility now offers file sharing
With the 0.5.0 version just released, crytto now allows file sharing (e.g., via email) by sharing public keys: encrypt_send -o /tmp/my-secret.enc \ -p /home/marco/.ssh/my-key.pub \ ./my-secret.doc This generates an encrypted file (in the location specified with the -o option) and an equally encrypted “passphrase” which can then be sent (ideally via a separate sharing mechanism; although, as…
-
File Encryption (and Decryption) Made Easy
A new release of the Crytto library (0.4.0) has just been published, which greatly simplifies encrypting (and decrypting) files The new release adds the decrypt script which, when combined with the existing automatic retrieval of the encryption key from the keystore, makes it a breeze to decrypt files. For example, if you had encrypted your…
-
Using `notify-send` and `yagmail` to send an alert if /boot partition is about to run out of space
Sometimes, you need to send both a visual and email alert for something that is checked using a background process (for example, running a `crontab` job): `notify-send` and `yagmail` provide a more user-friendly alternative on Ubuntu Linux desktop than scraping logs.
-
HOW-TO Publish a Pyton Package on PyPi
Create a setup.py file The arguments for setup() are documented here and are non-trivial: a good example is my filecrypt‘s setup.py file. NOTE Do not confuse setuptools with distutils – this is the correct import for setup.py: from setuptools import setup The trickiest part is figuring out the packages, modules and the script files: probably…
-
A python notebook to experiment with the Apache Mesos HTTP API – Part 3 of 3
This is the third and final part of a three-part series: Part 1 describes the required setup and how to get Apache Mesos Master and Agent running in two Vagrant VMs; Part 2 shows how to connect to the HTTP API and accept resource offers. This series is an extended (and updated) version of the…
-
A python notebook to experiment with the Apache Mesos HTTP API – Part 2 of 3
This is the second part of a three-part series: Part 1 describes the required setup and how to get Apache Mesos Master and Agent running in two Vagrant VMs This series is an extended (and updated) version of the talk I gave at MesosCon Europe 2015 updated for Apache Mesos 1.0.0, which has just been…
-
A python notebook to experiment with the Apache Mesos HTTP API – Part 1 of 3
This is the first of a series of three articles that shows how to setup a Vagrant-based Apache Mesos test/development environment on your laptop; then how to run a Python notebook against the HTTP API; and finally, how to launch Docker containers on the running Agent VM. It is pretty jam-packed and requires a certain…
-
Python Magic Methods
Make your code more pythonic by using magic methods in your classes.