How to exclude a folder in find command on a Mac

In order to exclude a folder with find command on a mac, you need to use to command:

-path ./path-to-exclude -prune -o

E.g. to find .txt files in the current folder without descending into a folder called foo, use the following command:

find . -path ./foo -prune -o -name '*.txt'

References

linux – Exclude directory from find . command – Stack Overflow. http://stackoverflow.com/questions/4210042/exclude-directory-from-find-command [17/01/2017].

How to add a SMB Shared Printer on Ubuntu server to Mac

Today I’ll discuss how to add a printer hosted on an Ubuntu server via Samba to a Mac.

First, make sure the printer is on.

Next, download and install the printer driver on your Mac.

Next, open Spotlight Search and type in printers. Printers & Scanners should be highlighter. Press Enter. This will open your printer settings.

Click the + icon to add a new printer. The Add window will appear.

Click IP tab to switch to IP settings.

In the Address field, enter the ip address of the server on which the printer is connected

Under protocol, choose Internet Printing Protocol – IPP. Enter the name of the queue. To find this information, you can open the CUPS admin of the Ubuntu print server, usually at http://{{print server ip}}:631. Go to Printers page, find the printer and copy the link on the printer name. Let’s assume the printer url is http://{{print server ip}}:631/printers/{{printer name}}. In this case, you will enter printers/{{printer name}} for Queue.

Enter a suitable Name and Location.

For Use, click Select Software. The Printer Software window will appear.

Find and click the name of your printer and click OK.

Click Add.

If all goes well, the printer gets added automatically. If doing this for the first time on your Mac, a window will appear showing features you can add to your printer. Click the button to complete the process and you’re done! You can now print from your Mac.

How to enable vi mode for several terminal applications on Unix (os X)

In order to enable vi mode for several readline-compatible (terminal) applications ilke ipython, MySQL, etc. on Unix (os X)

Set the following in your ~/.inputrc file:

set editing-mode vi
set keymap vi
set convert-meta on

Update:

In case someone’s wandering in here recently, IPython 5.0 switched from readline to prompt_toolkit, so an updated answer to this question is to pass an option:

$ ipython --TerminalInteractiveShell.editing_mode=vi

… or to set it globally in the profile configuration (~/.ipython/profile_default/ipython_config.py; create it with ipython profile create if you don’t have it) with:

c.TerminalInteractiveShell.editing_mode = ‘vi’

Source:

python – How do I use vi keys in ipython under *nix? – Stack Overflow. http://stackoverflow.com/questions/10394302/how-do-i-use-vi-keys-in-ipython-under-nix