Troubleshooting

Enable debug:

VAGRANT_LOG=info vagrant up
set VAGRANT_LOG=info
vagrant up
VAGRANT_LOG=debug vagrant provision

Insecure world writable dir /Applications in PATH, mode 040777

Vagrant::Errors::VMBootBadState: The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run <code>vagrant up</code> while the
VirtualBox GUI is open.

Run this to fix it:

sudo chmod 755 /Applications/

Mount error on v-root: /vagrant

When you start up your guest, you may get the following message unexpectedly:

This is usually a result of the guest’s package manager upgrading the kernel
without rebuilding the VirtualBox Guest Additions.
To double-check that this is the issue,
connect to the guest and issue the following command:

lsmod | grep vboxsf

If that command does not return any output, it means that the VirtualBox
Guest Additions are not loaded. If the VirtualBox Guest Additions were
previously installed on the machine, you will more than likely be able to
rebuild them for the new kernel through the vboxadd initscript, like so:

[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
cause things such as shared folders to not work properly. If you see
shared folder errors, please update the guest additions within the
virtual machine and reload your VM.
Guest Additions Version: 4.2.8
VirtualBox Version: 4.3

Solution:
Attach VBoxGuestAdditions.iso(can be found /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso) in VirtualBox manually.

Related links:

Daemon Skeleton introduction

Past couple of days, i’ve builded some daemon tools, tired to do the same thing again and again, i think i need a template, to create python project with daemon easy and fast. So created this template Daemon Skeleton.

In this template i used python-daemon as the daemonizer, and did some tweak, add SIGQUIT signal catching in this module, and reformat the source code according to PEP8.

Related links

Ship access log to ElasticSearch

This article introduce how to use a custom python script to parse Apache access log and shipping it to ElasticSearch.
If you wan’t store the huge log to ElasticSearch, you should read Using Elasticsearch for logs, Using some popular OpenSource software, like Graylog2, Logstash, Apache Flume.

$ ssh 0bd9d81bfe0a4def9de47b89fe1d3543@racer-ecs.rhcloud.com
Warning: Permanently added 'racer-ecs.rhcloud.com,174.129.154.20' (RSA) to the list of known hosts.
Welcome to OpenShift shell
This shell will assist you in managing openshift applications.
type "help" for more info.
[racer-ecs.rhcloud.com ~]\>

Find & Scan Wireless Networks from the Command Line in Mac OS X

Reindexing Spotlight from the Command Line

Reindexing Spotlight from the command line is done with the mdutil tool, first launch Terminal and then type:

sudo mdutil -E /

This will reindex every mounted volume on the Mac, including hard drives, disk images, external drives, etc. Specific drives can be chosen by pointing to them in /Volumes/, to only rebuild the primary Macintosh HD:

sudo mdutil -E /Volumes/Macintosh\ HD/

To reindex an external drive named “External” the command would be:

sudo mdutil -E /Volumes/External/

Use of the mdutil command will spin up mds and mdworker processes as Spotlight goes to work.

Individually Reindexing Selected Files
In rare cases, Spotlight can miss a file during index, so rather than reindex an entire drive you can also manually add an individual file to the search index with the mdimport command:

Convert a DMG file to ISO

Convert an ISO file to DMG format

Set a Zip Password in Mac OS X

zip -e archivename.zip filetoprotect.txt
unzip filename.zip

How to Remove Apps from Launchpad in Mac OS X

Using Launchpad — Mac App Store apps only
Hold down the Option key, and once the icons start jiggling click the “X” shown in the corner of icons that you want to delete. This removes the app from Launchpad, and does not uninstall them, but this is limited to apps installed from the Mac App Store. If you want to remove an app not installed through the Mac App Store, you have to use the method below:

Using the Terminal — removes any application
Launch the Terminal and enter the following command, replacing “APPNAME” with the name of the application you want to remove from Launchpad:

删除菜单栏的图标

How to Remove Icons from the Menu Bar in Mac OS X

holding down the Command key and dragging items out of the menu

快速使用Google搜索

只要是Cocoa程序, 你都可以选择一些文字然后按Shift+Command+L快速以Google搜索。（在Safari中试试看）

quickly access System Preferences

If you want to quickly access the Mac OS X System Preferences,
you can do so by holding down the Option key and then hitting various function keys.
Option+Brightness pulls up the Display preference pane, Option+Expose brings up the Expose preferences,
Option+Volume controls bring up the Sound preferences, and so on.

iSTAT NANO
An advanced system monitor in a tiny package. iStat nano is a stunning system monitor widget with beautifly animated menus and transitions.Download Page

To Do
A lightweight and fast widget to manage tasks. Thanks to Mac OS X Leopard it integrates with iCal and Mail. The big advantage: to manage your tasks you don’t have to leave these applications open.Download Page

sudoers$ sudo visudo# Uncomment to allow people in group wheel to run all commands%wheel ALL=(ALL) ALL

Install Software

App Store

Manually

From App Store

Sign in

Using Apple ID sign in, or create new Apple ID.

Install Software

Xcode

Caffeine

Skitch

Evernote

TextWrangler

Opus Domini

Window Tidy

Twitter

The Unarchiver

MindNode

SketchBook Express

1Password

Manually

Adium
Adium is a free instant messaging application for Mac OS X that can connect to AIM, MSN, Jabber, Yahoo, and more.WebSite

AppCleaner
AppCleaner is a small application which allows you to thoroughly uninstall unwanted apps.WebSite

GitHub
GitHub is the best way to collaborate with others. Fork, send pull requests and manage all your public and private git repositories.Download page

iTerm2
iTerm2 is a replacement for Terminal and the successor to iTerm. It works on Macs with Leopard, Snow Leopard, or Lion. Its focus is on performance, internationalization, and supporting innovative features that make your life better.Download page

MPlayer OSX Extended
MPlayer OSX Extended is the future of MPlayer OSX. Leveraging the power of the MPlayer and FFmpeg open source projects, MPlayer OSX Extended aims to deliver a powerful, functional and no frills video player for OSX.Download page

TextMate2
TextMate brings Apple’s approach to operating systems into the world of text editors. By bridging UNIX underpinnings and GUI, TextMate cherry-picks the best of both worlds to the benefit of expert scripters and novice users alike.WebSite

Chicken of the VNC
Chicken of the VNC is a VNC client for Mac OS X. A VNC client allows one to display and interact with a remote computer screen. In other words, you can use Chicken of the VNC to interact with a remote computer as though it’s right next to you.Download page

MacPorts
The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system.Download page

# Display a list of all "known" rubies. NOTE: RVM can install many more Rubies not listed.
rvm list known
# Install a version of Ruby (eg 1.9.3):
rvm install 1.9.3
# Use the newly installed Ruby:
rvm use 1.9.3
# Check this worked correctly:
ruby -v
which ruby
# Optionally, you can set a version of Ruby to use as the default for new shells. Note that this overrides the 'system' ruby:
rvm use 1.9.3 --default