mac

A collection of Gnuplot examples

I needed to use Gnuplot a little bit over the last few days, mostly to create 2D line charts, and these are my brief notes on how to get started with Gnuplot. If you haven’t used it before, it’s a pretty amazing tool.

Jumping right in ...

Back to top

Installing gnuplot

Use MacPorts or Homebrew to install Gnuplot on Mac OS X systems:

port install gnuplot
brew install gnuplot
Back to top

Sample data files

My examples use the following 2-column and 4-column data files:

Back to top

How to fire Mac OS X notifications with AppleScript (and Scala)

Table of Contents1 - A “Hello, world” MacOS AppleScript notification2 - AppleScript: Mac notification with a sound3 - How to add a title and subtitle to your notification4 - Running from Scala or Java5 - See also6 - Summary

Summary: This tutorial demonstrates how to fire MacOS system notifications with AppleScript (and Scala or Java).

In this article I assume that you already know at least a little bit about how to use AppleScript, and just want to know how to trigger a MacOS notification. At the end of the tutorial I show how to invoke the AppleScript code using Scala and Java.

A Linux shell script to rename files with a counter and copy them

As a quick note, I used this shell script to copy many files with the same name into a directory named tmpdir, giving them all new names during the copy process:

count=1
for i in `cat myfiles`
do
    fname=`basename $i`
    cp $i tmpdir/${count}-${fname}
    count=`expr $count + 1`
done

How to build a macOS application from a Java Jar file

Table of Contents1 - Background2 - Requirements3 - Building your application4 - Note 1: Font smoothing5 - Note 2: Setting the “application category”6 - The Mac/Java AppBundler7 - More information8 - Summary

In this article I’ll show how to build a macOS application from a Java Jar file. I tested this with Java 1.8 on macOS 10.12.5 (Sierra) on June 29, 2017.

Three assumptions in this process are:

How to copy the macOS Terminal path to the clipboard

If you want to copy the current macOS Terminal path to the clipboard, you can do it with this simple command:

$ pwd | pbcopy

pwd prints the path to STDOUT, and pbcopy reads that and copies it to the macOS clipboard. Once the path is on the clipboard you can paste it into your other applications.

Of course you can also create an alias, like this:

alias path="pwd | pbcopy"

MacOS, Pandoc, PDFs, and MacTex

Note to self: When trying to use Pandoc to create a PDF on MacOS, you need to install MacTex separately. Install everything, because it will make things much easier later.

Jonathan Ive design interview quotes

This article contains a collection of quotes on design from Apple designer Jonathan Ive (or “Jony Ive,” as Steve Jobs called him). (Note: He prefers to refer to himself as a “builder” or “maker” as opposed to a designer.)

For those who don’t know of him, Jonathan Ive is credited with designing almost every Apple product since 1997. Given that very long string of success, I became interested in what Mr. Ive has to say, and to that end, here’s a collection of Jonathan Ive design interview quotes I’ve gathered over the last few years.

How to copy text from the MacOS Terminal to the clipboard

If you ever need to copy text (or a text file) from the MacOS Terminal to the Mac clipboard, I can confirm that the macOS pbcopy command works. It reads from STDIN and copies the text to the clipboard, so commands like these work:

$ echo "foo bar baz" | pbcopy

$ cat /etc/passwd | pbcopy