Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Change the Finder's umask to 077 for new folders


# change the Finder's umask for all user accounts (on Mac OS X)

# cf. http://www.makemacwork.com/secure-finder-permissions.htm
sudo defaults write /Library/Preferences/com.apple.finder umask -int 077     # creates a new preferences file
defaults read /Library/Preferences/com.apple.finder
#defaults delete /Library/Preferences/com.apple.finder umask
ls -l /Library/Preferences/com.apple.finder.plist


# change the Finder's umask for your user account only

defaults write com.apple.finder umask -int 077
defaults read com.apple.finder umask
#defaults delete com.apple.finder umask
ls -lh ~/Library/Preferences/com.apple.finder.plist

# alternative
defaults -currentHost read -g
defaults -currentHost read "Apple Global Domain"
defaults -currentHost write -g umask -int 077
#defaults -currentHost delete -g umask
ls -lh ~/Library/Preferences/ByHost/.GlobalPreferences.*.plist


defaults read -g
defaults read /Library/Preferences/.GlobalPreferences
ls -lh /Library/Preferences/.GlobalPreferences.plist

newfolder contextual menu item with Automator

Right-click on a folder in a Finder window and select Automator -> newfolder to create a "NewFolder".


open -a Automator

#--------------------------------------------------

Drag or add actions here to build your workflow:
Library: Finder -> Action: Get Selected Finder Items
Library: Automator -> Action: Run Shell Script
                                 - Shell: /bin/sh
                                 - Pass input: as arguments

current_dir="$@"
name_of_new_dir="NewFolder"

if [[ -d "${current_dir}" ]] && [[ -w "${current_dir}" ]]; then
   /bin/mkdir -p "${current_dir}${name_of_new_dir}"
fi

exit 0


# now save the newfolder Automator workflow as a contextual menu item
Automator -> File -> Save As Plug-in ... -> Save Plug-in As: newfolder -> Plug-in for: Finder -> Save

#--------------------------------------------------

open ~/Library/Workflows/Applications/Finder/newfolder.workflow

# now open your Home directory, right-click on a folder and select Automator -> newfolder to create a "NewFolder" 
open ~

Mount Strongspace to a folder in Ubuntu

1) Install the software
sudo apt-get install sshfs


2) Add fuse to /etc/modules
sudo nano /etc/modules


3) Add yourself to the 'fuse' group, then log out and log in again.
sudo adduser your-username fuse


4) Create a mountpoint and give yourself ownership
sudo mkdir /media/mount-name
sudo chown your-username /media/mount-name


5) Mount the filesystem
sshfs remote-system-name:/remote-folder /media/mount-name


6) Unmount the filesystem
fusermount -u /media/mount-name


Directions lifted from Ubuntu forums and here also.

For myself, I had better results running the following command in the same directory that the file that I mounted resides in...

sudo sshfs user_name@subdomain.strongspace.com: folder_name


Where folder_name is the name of the folder that you are mounting strongspace to.