NanoDano's blog



Working with JSON in Python

Python has a built-in package for converting Python objects to and from JSON strings. We will look at how to load JSON from a string or a file, and dump a Python object to a JSON string or file. We will also look at how to minify the output and save space, or make it more human readable with ordering and indentation.

Use jpackage to Create Native Java App Installers

jpackage is a new tool with JDK 14 that generates native system installers for distributing your appliction. It will create .msi for Windows, .dmg for Mac, and .deb or .rpm for Linux distrubtions. This is ideal for GUI applications. This guide will demonstrate how to use this tool to create system native installers for your applications.

Symmetric encryption with Python using Fernet (AES)

The third-party cryptography package in Python provides tools to encrypt byte using a key. The same key that encrypts is used to decrypt, which is why they call it symmetric encryption. Fernet is an encryption spec that utilizes AES-128 under the hood with HMAC and some other additions. If you need to encrypt and decrypt some data using Python, this is a very easy way to do it.

How to Create Java Runtime Images with jlink

Before Java 9 and Project Jigsaw, you would have to package the entire monolithic Java Runtime Environment (JRE) to distribute your application with an embedded JRE runtime. This took up a lot of space. Now, you can generate your own custom runtime with only the modules you want to keep the size of the final package smaller.

You can think of a runtime image as another name for a Java runtime environment (JRE). When you create a custom runtime, you are generating a new JRE that only includes the modules you want. You can exclude core java modules that you don't need and you can include custom modules that you wrote. They will all be "baked in" to the runtime.

If you are familiar with Python Virtual Environments, it is similar to that. It is a directory that contains an isolated Java environment with only the specific dependencies needed that will not conflict with other isolated runtimes.

After following this guide, you will understand how to use jlink to create runtime images with only the modules you want. You should also know how to add custom modules including third-party modules like JavaFX.

Create custom launcher in Windows for custom file extensions

In Windows, you can associate any custom command with a file extension. For example, if you want Windows to automatically run Java .jar files using the command java -jar. These examples will walk through the steps necessary to do this:

  • Update the PATHEXT environment variable
  • Associate the file extension to a file type
  • Specify a command to run when that file type is executed

This example will focus on using java to run a .jar file, but this example works just as good for any custom application, or creating script runners for Python and Ruby.

Schedule a shutdown in Windows (sleep timer)

I enjoy listening to audio books and sometimes I want to listen a little bit before going to sleep. Audible has a sleep timer built-in to the app, but I wanted my entire computer to shut down.

You can use the built-in shutdown command in Windows to schedule a shutdown. These examples will show how to schedule a shutdown and how to cancel a scheduled shutdown from the command-line.

curl Tutorial

curl ( is an incredibly useful and powerful command-line tool and library. The latest version at the time of this writing is 7.68.0 released January 8, 2020. You can download it from and the source code is available at

It's primary purpose is transferring data over network protocols like HTTP and HTTPS. It supports a large number of other protocols including: FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet and TFTP. It also supports SSL/TLS encryption, cookies, authentication, and proxies.

You can use it as a command-line tool by calling curl or you can use it as a library inside C, C++, or other applications. We will look at several things in this tutorial including:

  • Basic curl usage for making HTTP requests
  • Downloading files
  • Compiling from source
  • Using curl in a C++ application