Plex Server Up and Running with Docker

Plex is a media server which aggregates your media and allows you to access it on your home network. Installing the server is relatively simple… Installing it with Docker is even simpler. Docker also makes it easy to define a single configuration which is reusable across environments.

I’m working off a Ubuntu installation, since that is where I’m setting up my home media centre, but once docker is installed, getting Plex going should be nearly identical in any OS.

Continue reading

Encode or Decode base64 from the Command Line

If you have ever needed to quickly decode or encode base64, Linux has a command line utility called base64 that works great. I’ll show you how it works!

To encode text to base64, use the following syntax:

$ echo -n ' rocks' | base64

To decode, use base64 -d. To decode base64, use a syntax like the following:

$ echo -n Y29kZWRpYXJ5Lm5ldCByb2Nrcw== | base64 -d rocks

Note: if on OS X, use capital D:

echo -nY29kZWRpYXJ5Lm5ldCByb2Nrcw== | base64 -D

Unpack and repack a JAR file with all of its dependencies

Repacking an unpacked JAR is a little frustrating because of the folder structure

When unpacking with:

jar xvf JAR_NAME.jar

you get a JAR_NAME/ folder

To repack the JAR:

remove old jar

rm JAR_NAME.jar

get inside the folder


pack the jar referencing the parent folder

jar cf ../JAR_NAME.jar *

and you will end up with the JAR_NAME.jar in the parent folder, where the original was unpacked from, without the first folder level you would get if you had packed the folder itself.

Access MySQL Without Password

For MySQL you can specify your user and password in local config file (.my.cnf). This file should be in your home directory (i.e. ~/.my.cnf).



How do you gunzip a file and keep the .gz file?

You’re looking for:

gzcat x.txt.gz >x.txt

The gzcat command is equivalent to gunzip -c which simply writes the output stream to stdout. This will leave the compressed file untouched. So you can also use:

gunzip -c x.txt.gz >x.txt

Note that on some systems gzcat is also known as zcat so run like this instead:

zcat x.txt.gz >x.txt

How to gzip and keep original file on Unix or Linux command line

I would like to compress a log file using gzip Unix command line utility, and I would also like to keep the original file. However, when I use the gzip my-app.log command, results in modifying my log file and renaming it my-app.log.gz. How do I force the gzip command to keep original file while maintaining the original file on Linux or Unix-like system?

The gzip program compresses and decompresses files on Unix like system. You need to pass the -c or --stdout, or --to-stdout option to the gzip command. This option specifies that output will go to the standard output stream, leaving original files intact.

Continue reading