macos

A sample .gitignore file for Scala/SBT projects alvin June 5, 2017 - 2:15pm

This is a sample .gitignore file that I use for Scala SBT projects:

How to copy the macOS Terminal path to the clipboard alvin May 15, 2017 - 9:24am

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 alvin May 13, 2017 - 6:53pm

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.

A Linux shell script to rename files with a counter and copy them alvin May 9, 2017 - 9:39am

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

The way this works is that I have a file named myfiles that I created with a find command, and it contains a bunch of entries like this:

foo/bar/baz/filename.jpg
foo/baz/filename.jpg

When the shell script runs, it reads one line at a time from that file, gets the basename (filename) from that line, prepends that name with a counter, then copies the original file to the directory named tmpdir, giving it the new name, so the new filenames will be like this:

1-filename.jpg
2-filename.jpg
3-filename.jpg

I did this to copy all of the images I have under the Messages cache folder on my Mac. A friend accidentally deleted our text message stream, and I was able to recover 350+ images with this script.

You can also use it to copy iTunes music files, where it’s possible that many music files (MP3, M4A, etc.) will have the same filename.

How to copy text from the MacOS Terminal to the clipboard alvin April 10, 2017 - 5:48pm

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
How to get MacOS Message app to sync up with iPhone messages (get it to update) alvin March 8, 2017 - 3:45pm

As a quick note, I often have a problem where the Messages app on MacOS (formerly Mac OS X) won’t update to receive new messages. By this I mean that I receive messages on my iPhone, but then when I go to my Mac and open the Messages app, my new text messages either never get there, or it takes a long time for them to show up in the Messages app.

IntelliJ IDEA: Keystrokes I commonly use on MacOS (OS X) alvin March 6, 2017 - 6:26pm

As a quick note, this is a list of the IntelliJ IDEA keystrokes I use on my MacOS systems:

Cerebro, a Spotlight-like launcher for Linux alvin February 21, 2017 - 11:29am

I recently “made the switch” from MacOS to Linux Mint, and was lamenting the fact that I didn’t have Alfred on Mint. But then this morning I learned about Cerebro, which, if it’s not Alfred yet, at least it’s Spotlight for Linux. omgubuntu.co.uk has this good intro article on Cerebro.

Cerebro is written as an Electron app, and as a result it’s available not only for Linux, but Windows and MacOS as well.

Designers choosing form over function alvin January 23, 2017 - 10:52am

One of my gripes with both MacOS and Ubuntu is that it’s harder than it needs to be to grab a window corner or edge to resize it. IMHO, designers are choosing form over function.

MacOS softwareupdate command (how to ignore updates) alvin January 22, 2017 - 8:59pm

I just learned that MacOS has a softwareupdate command, and further learned that it has a --ignore option, which may or may not let you ignore useless updates. For example, my Mac prompts me daily to update Keynote, Numbers, and Pages, which I rarely (rarely!) use, so I don’t want to bother updating them. I’m hoping the a softwareupdate command will help me with this.