979Batch Rename Files with rename

Batch renaming files on the command line, in this case screenshot to more descriptive names:

brew install rename

Dry run:

rename -n -e 's/Screen Shot/w2_OpenSCAD/' -z  *.jpg

Replace, remove the -n flag:

rename -e 's/Screen Shot/w2_OpenSCAD/' -z  *.jpg

-z does sanitize the file name, replacing empty spaces with _.

978Changing default Screenshot Form in OSX

Default format is PNG, change it to any of the following:

defaults write com.apple.screencapture type JPG
defaults write com.apple.screencapture type TIFF
defaults write com.apple.screencapture type GIF
defaults write com.apple.screencapture type PDF
defaults write com.apple.screencapture type PNG

First encountered here.

976Git, Mac, SSH Keys and the OSX Keychain

When using git with a key that has a passphrase, you are asked the passphrase every time you pull/push. To make this a bit more convenient, add the key to the OSX Keychain.

Store key in OSX Keychain:

ssh-add -K ~/.ssh/my_key

Open .ssh/config

Host *
  UseKeychain yes
  AddKeysToAgent yes
  IdentityFile ~/.ssh/my_key

959Making a Bootable Installer for OSX

Straight from the Apple Support page: How to create a bootable installer for macOS https://support.apple.com/en-us/HT201372 High Sierra Page https://support.apple.com/en-us/HT208969 High Sierra App Store Link (hidden from standard Search) https://itunes.apple.com/us/app/macos-high-sierra/id1246284741?ls=1&mt=12

951Making a Bootable USB Stick – for Linux – in OSX

The Manjaro Wiki suggests to make a bootable USB Stick like that:

sudo dd bs=4M if=/path/to/manjaro.iso of=/dev/sd[drive letter] status=progress oflag=sync

While this might work on Linux, it does not work with dd on OSX/Darwin. Here are the error messages:

dd: bs: illegal numeric value
bs does not understand M
multiply manually, 4M -> 4 1024 1024 -> 4194304

sudo dd bs=4194304 if=/path/to.iso of=/dev/diskNr status=progress oflag=sync

dd: unknown operand status
dd on OSX does not understand the status flag
remove status flag

sudo dd bs=4194304 if=/path/to.iso of=/dev/diskNr oflag=sync

dd: unknown operand oflag
dd on OSX does not understand the oflag oflag
remove oflag flag

sudo dd bs=4194304 if=/path/to.iso of=/dev/diskNr

dd: /dev/disk4: Resource busy
Unmount disk before use, either via umount or in Disk Utility

And here we have it:

sudo dd bs=4194304 if=/path/to.iso of=/dev/diskNr

915SSH form OSX to Ubuntu – Locale Error

Problem: ‘std::runtime_error’ what(): locale::facet::_S_create_c_locale name not valid Aborted Solution: export LC_ALL="en_US.UTF-8" via http://martinhjelm.github.io/2015/06/14/Runtime-error-when-sshing-from-OSX-to-Ubuntu/

910Unresponsive Atom Editor on OSX

Atom is great, current, hackable and my current go-to editor, but from time-to-time it does like to open a certain directory. It keeps timing out, restarts of the Editor or the Computer don’t help. Clearing the window state helps. atom --clear-window-state

886Making a text file executable in OSX with .command

Appending .command to a text file in OSX executes it on double click.

my-file.txt content wget https://wordpress.org/latest.tar.gz
rename my-file.txt → my-file.command

811Fuji Xerox ApeosPort (DocuCentre) IV C3370 & OSX Lion

Setting up the ApeosPort C3370 in OSX Lion should not be difficult at all. Download the latest drivers, install, select and there you go. Right? Not quite. Selecting “FX ApeosPort-IV C3370 v3017.104 PS” or similar driver did not produce a workable connection to the printer. Rather it produced some annoying ‘beep’ sounds at the printer every time I was trying to print. But it did not produce any print-outs. Thanks to this I found that the solution is to select the following driver: “FX Print Drive for Mac OX v1.2.2” (or whatever the latest version might be). It’s working!

810Installing Circos on OS 10.6

Circos, the Perl-package for visualizing data and information in a circular layout is an immensely popular application in the bio-informatics/bio-visualization community. And rightly so, as it able to produce visually stunning and appealing graphics. Because its the native environment is bio-informaticians, the software is written in Perl. For those without Perl experience, it can be slightly frustrating to set it up on OSX (as it was for me). Here are the steps I needed to do to get it running, hope that this might reduce the trouble and let others get to work on their visualization more quickly. The whole installation process is also detailed on the Installation page. 1 Getting Circos Download the software, tutorials, tools and courses 2 Testing the modules Go the the circosX-XX/bin folder and run: ./test.modules This gives you a list of the installed Perl modules, and – more importantly – the ones still missing. 3 Install the missing modules Switch to the super user with ‘su’. For each missing modules say: cpan -i Modulename::Subname
cpan -i Config::General
cpan -i Graphics::ColorObject
cpan -i Math::VecStat
etc, etc
All worked swimmingly, except GD was making a bit of trouble. 4 Installing GD The graphics library GD has to be present on your system. If it’s not, install it. (I am with homebrew, therefore installing GD is done like that: brew install gd) Still after installing GD, installing the Perl module would not work. But after applying a little force, it went fine:
cpan -i -f GD
5 Adding circos to your path Adding the circos ‘bin’ directory to your path lets you call the circos program directly without specifying the whole path. That’s a good thing.
export PATH
After that, everything should work and your Circos adventure can begin…