This is a Bash shell script written for Ubuntu (Linux). I just switched from Mac/MacOS to Ubuntu, and I don't like the default blank screensaver in Ubuntu. I just want a screensaver to rotate my collection of images, so I'm considering using this rather than Xscreensaver. The script comes from jamcnaughton.com.
I’m currently generating my new book on “functional programming in Scala” as a PDF using a combination of Pandoc and LaTeX, and as a result it feels like I’m opening the same PDF file about 100 times a day.
If you want to run/execute a
main method from a jar file you created with Scala and the
sbt package command, this little tutorial shows how to do it. To make things a little more complicated, my Scala project depends on three external jar files, and the
main method requires a command-line argument.
As noted in the Summary, you’ll probably want to use a tool like SBT-Assembly for larger projects.
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is a short recipe, Recipe 14.13, “How to make your Scala shell scripts run faster by pre-compiling them.”
You love using Scala as a scripting language, but you’d like to eliminate the lag time in starting up a script.
-savecompiled argument of the Scala interpreter to save a compiled version of your script.
A basic Scala script like this:
This is an excerpt from the Scala Cookbook, partially modified for the internet. This is Recipe 14.12, “How to prompt users for input from Scala shell scripts.”Back to top
You want to prompt a user for input from a Scala shell script and read her responses.Back to top
Console.read* methods to read user input, as demonstrated in the following script. Comments in the script describe each method:
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 14.11, “How to access command-line arguments in a Scala shell script.”
You want to access the command-line arguments from your Scala shell script.
Use the same script syntax as shown in Recipe 14.8, “Generating Documentation with
scaladoc”, and then access the command-line arguments using
args, which is a List[String]` that is implicitly made available:
As a quick note today, this is the source code for a Raspberry Pi (RPI) camera module shell script that I created so a friend can turn her Raspberry Pi camera on and off from the RPI command line (Linux command line):
I recently wrote a little application to convert pages from a PDF to plain text. The GUI portion of the application looks like this:
As you can see, the application just needs the name of a PDF file to convert, along with the page you want to start at and the page you want to end at. There are several ways I could make the application more convenient to use, but since I don't plan to use it that often, I can deal with its limitations.
One way to to get the IP address of a Linux system from the Linux command line is this:
$ hostname -I
hostname command, followed by a capital letter
i as a command line parameter. On my Raspberry Pi system, this command returns its IP address — and only its IP address — like this:
It’s nice that this command returns only the IP address, because that means I don’t have to pipe together several commands to get what I need.
I just had to write a Linux bash shell script that has a for loop that reads a file, and that file contains lines with blank spaces in it. This sounds simple, but blank spaces cause major problems in a Bash for loop.
Fortunately there’s a simple solution: Before the for loop, declare the input field separator to be a newline character, as shown in this for loop code: