Screen Capture x1 Image Size Under Retina Macs

1. Open “Automator”
2. Select “Service” for “Choose a type for your document”
3. Change “Service receives no input in any application” on top right section of the Automator
4. Drag action “Run Shell Script” from the left pane into the workflow on the right pane
5. Make sure Shell setting is to “/bin/bash”
6. Add the following script to the script section (change the 2nd line setting for SS_PATH to your desktop absolute path) and save:

# the path where screenshots to save

# a variable of unix timestamp for screenshot file name
NOW=$(date +%s)

# image format to create, default is png (other options include pdf, jpg, tiff and other formats)

# name of screenshot

# full path of screenshot file

# execute screen capture command and save to $SS_2X
screencapture -i -r -t $SS_TYPE $SS_2X

# check if screenshot is existing
if [ -f $SS_2X ]; then

    # get the 50% width of screenshot by sips
    WIDTH=$(($(sips -g pixelWidth $SS_2X | cut -s -d ':' -f 2 | cut -c 2-)/2))

    # scale down by sips
    sips --resampleWidth $WIDTH $SS_2X --out $SS_1X
    # copy small one to clipboard by applescript
    # if you hold control key when do capture, causes screen shot 2X to go to clipboard
    osascript -e 'set the clipboard to POSIX file "'$SS_1X'"'

7. Open “System Preferences” > “Keyboard” > “Shortcuts”, find the service you just created and assign hotkey (e.g. Cmd+Shift+5).

OSX Slow Samba Client Fix

This may or may not fully fix the very screwed up implementation of SMB on OSX.

Fix 1 – nsmb.conf

echo "[default]" >> ~/Library/Preferences/nsmb.conf; echo "smb_neg=smb1_only" >> ~/Library/Preferences/nsmb.conf; echo "notify_off=yes" >> ~/Library/Preferences/nsmb.conf;

Fix 2 – net.inet.tcp.delayed_ack
Use Lingon to create a “User Daemon” that runs when loaded by the system to run this (Name doesn’t matter):

sudo sysctl -w net.inet.tcp.delayed_ack=0

After Fix 1 and Fix 2 reboot.

OSX Tools

Prepare the environment

xcode-select --install
ruby -e "$(curl -fsSL"

Some Brew files

brew update
brew upgrade

brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install php56 --with-fpm --with-homebrew-openssl --without-snmp
brew install php56-xdebug php56-imagick php56-mcrypt
ln -sfv /usr/local/opt/php56/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

brew install mysql
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

brew install nginx
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons/
sudo chown root:wheel /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
mkdir -p /usr/local/etc/nginx/sites-enabled

brew install dnsmasq
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
cat << 'EOF' > $(brew --prefix)/etc/dnsmasq.conf
sudo mkdir /etc/resolver
sudo tee /etc/resolver/dev >/dev/null <<EOF
sudo tee /etc/resolver/lan >/dev/null <<EOF

brew install lame git youtube-dl node wget yuicompressor ffmpeg rename

Install Apps from commandline:

brew install caskroom/cask/brew-cask
brew cask install --appdir=/Applications iterm2
brew cask install --appdir=/Applications dropbox
brew cask install --appdir=/Applications onepassword
brew cask install --appdir=/Applications google-chrome firefox skype simple-comic phpstorm mplayer-osx-extended mplayerx imageoptim blueharvest totalfinder utorrent vlc vmware-fusion xld qlstephen rcdefaultapp

Install zprezto

git clone --recursive "${ZDOTDIR:-$HOME}/.zprezto"

for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^; do
    ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"

chsh -s /bin/zsh

Config backup:


Jump Terminal Command


mkdir ~/.marks

Then add this to your ~/.zshrc or ~/.bashrc:

export MARKPATH=$HOME/.marks

function jump {
    cd -P $MARKPATH/$1 2>/dev/null || echo "No such mark: $1"

function mark {
    mkdir -p $MARKPATH; ln -s $(pwd) $MARKPATH/$1

function unmark {
    rm -if "$MARKPATH/$1"

function marks {
    ls -l $MARKPATH | sed 's/  / /g' | cut -d' ' -f9- | sed 's/ -/ -/g' && echo

function _marks {
    reply=($(ls $MARKPATH))

compctl -K _marks jump
compctl -K _marks unmark

To use:

Now to remember a directory you type

mark <any_string>

and to jump to that directory you type

jump <any_string>

To list all your shortcuts


Patch ESXi to run OSX guest

1. Download
2. Unzip and save it to datastore
3. SSH into ESXi host
4. Run unlock-all-vXXX/esxi/ in ESXi host’s SSH as root
5. Shut down all appliances
6. Reboot ESXi

More info: