Posts Tagged ‘ osx

How do I disable “Command-q” in OS X?

You can reassign menu commands in Mac’s System Preferences menu to different shortcuts, either for individual applications or for all applications. This will let you effectively reassign Cmd-Q to anything (or nothing), if you’d like.

1. Go to System Preferences, and select Keyboard.

2. Click on Keyboard Shortcuts, then select the Application Shortcuts menu bar in the lower left.

3. Click the “+” button to add a shortcut for an application. For this example, we’ll disable Cmd-Q for Google Chrome.

4. Figure out the command name for Google Chrome’s “Quit” by going to the menu bar in Google Chrome and finding the menu item. In Chrome, under the “Chrome” menu bar element, you can find the action “Quit Google Chrome” attached to Cmd-Q.

5. Put the exact name of the menu action item as a new keyboard shortcut in the Keyboard Shortcut options.

6. Select a shortcut that isn’t Cmd-Q (for example, Cmd-Option-Q). Click “Add” to finish the setting.

via How do I disable “Command-q” in OS X? – Quora.

SVN pre-commit hook

Stop

How to avoid system files in your repository

Today Operating systems are often creating system files to accelerate directory operations:

MacOSX: ‘.DS_Store’
Windows: ‘Thumbs.db’
KDE: ‘.directory’
….

To avoid that these files mess up your repository, create inside the 'hook' directory a file named: 'pre-commit' (beside a the example file ‘pre-commit.tmpl’).
It is very important to make sure that the script has execution rights ( chmod a+x pre-commit )

#!/bin/bash
 
REPOS="$1"
TXN="$2"
 
SVNLOOK=/usr/bin/svnlook
 
# Make sure that the log message contains some text.
$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" > /dev/null
if [ $? -ne 0 ]; then
        echo "Log message not specified!" 1>&2
        exit 1
fi
 
# Do not commit crap like ...
CRAP_FILES=( '.DS_Store' 'Thumbs.db' '.directory' )
for FILE in $($SVNLOOK changed -t "$TXN" "$REPOS" | cut -b 5- | xargs basename); do
        for CRAP in "${CRAP_FILES[@]}"; do
                if [ "$FILE" = "$CRAP" ]; then
                        echo "Temporary files cannot be commited (ex: '.DS_Store', 'Thumbs.db')!" 1>&2
                        exit 1
                fi
        done
done
 
# All test passed
exit 0

Enjoy!