Skip to content

Instantly share code, notes, and snippets.

View dreamcat4's full-sized avatar
😋

Dreamcat4 dreamcat4

😋
View GitHub Profile
@dreamcat4
dreamcat4 / gist:222713
Created October 30, 2009 20:50 — forked from defunkt/gist:189623
Github's Unicorn config
# 9 workers and 1 master
worker_processes 9
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
# Restart any workers that haven't responded in 30 seconds
timeout 30
@dreamcat4
dreamcat4 / config.ru
Created November 13, 2009 21:40 — forked from adamhjk/config.ru
Chef server 0.7.14 - Unicorn
require 'rubygems'
require 'merb-core'
require 'chef'
Chef::Config.from_file(File.join("/etc", "chef", "server.rb"))
Merb::Config.setup(:merb_root => File.expand_path(File.dirname(__FILE__)),
:environment => ENV['RACK_ENV'],
:fork_for_class_load => false,
:init_file => File.dirname(__FILE__) / "config/init.rb")
@dreamcat4
dreamcat4 / config.ru
Created November 13, 2009 21:40 — forked from adamhjk/config.ru
Chef server 0.8a - Unicorn
require 'merb-core'
require 'chef'
Chef::Config.from_file('/etc/chef/server.rb')
require 'chef/nanite'
require 'uuidtools'
Chef::Config[:nanite_identity] = "chef-#{UUIDTools::UUID.random_create.to_s}"
Chef::Nanite.in_event { Chef::Log.info "Nanite Booting..." }
time = 17
@dreamcat4
dreamcat4 / build_chef_0.8
Created December 10, 2009 19:27 — forked from btm/build_chef_0.8
chef 0.8 alpha installation
# ec2 ami-1515f67c
sudo sed -i 's/universe/multiverse universe/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert rubygems git-core rake librspec-ruby libxml-ruby thin couchdb
sudo gem sources -a http://gems.opscode.com
sudo gem sources -a http://gemcutter.org # for nanite
sudo gem install cucumber merb-core nanite jeweler uuidtools json --no-ri --no-rdoc
mkdir ~/src
cd ~/src
git clone git://github.com/opscode/chef.git
@dreamcat4
dreamcat4 / _usage.rb
Created December 21, 2009 23:42 — forked from adamhjk/restartmenow.rb
restart chef runs and continue from where it was
before_restart "stage 1" do
puts "hi we are executing stage 1..."
puts "stage 1 done"
end
before_restart "stage 2" do
puts "hi we are executing stage 2..."
puts "stage 2 done"
end
@dreamcat4
dreamcat4 / fireitup.rb
Created December 21, 2009 23:42 — forked from fujin/fireitup.rb
ruby_block "fire that shit up dawg" do
block do
fork do
fork do
exec "chef-solo zzzzzzzzzzz"
exit
end
exit
end
Chef::Application.fatal! "oh snap", 1
@dreamcat4
dreamcat4 / build_chef_0.8
Created February 14, 2010 22:55 — forked from btm/build_chef_0.8
btm's 0.8 bootstrap
# ec2 ami-1515f67c
sudo sed -i 's/universe/multiverse universe/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert rubygems git-core rake librspec-ruby libxml-ruby thin couchdb zlib1g-dev libxml2-dev
sudo gem sources -a http://gems.opscode.com
sudo gem install cucumber merb-core jeweler uuidtools json libxml-ruby --no-ri --no-rdoc
mkdir ~/src
cd ~/src
git clone git://github.com/opscode/chef.git
git clone git://github.com/opscode/ohai.git
~$ ARCHFLAGS='-arch i386 -arch x86_64'
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download
~$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0
~/RubyCocoa-1.0.0$ ruby install.rb config --build-universal=yes
~/RubyCocoa-1.0.0$ ruby install.rb setup
~/RubyCocoa-1.0.0$ sudo ruby install.rb install
# Apple Binary Property List serializer for Ruby 1.8.
require 'iconv'
module AppleBinaryPropertyList
MIME_TYPE = 'application/octet-stream' # Don't know what to use, so use a very generic type for now
CFData = Struct.new(:data) # For marking strings as binary data which will be decoded as a CFData object
I've been fighting the same problem and have to say the hint provided here about resetting the launch services, and letting `launchd` do this at login (via Lingon) is invaluable. Thanks a lot for that, it makes FileVault far more usable!
After using this for a while, I have however discovered a side effect of resetting the launch services that is rather annoying--but I have also found a solution for it.
The _problem_ is that after resetting the launch services, calling a protocol handler registered by a user installed application is considered a **first time call** again, meaning it needs to be confirmed by the user (unless the app has been started directly before the call). Examples I stumbled upon are:
* bookmarking through the Pukka bookmarklet
* opening an Evernote note from a Spotlight search
* calling a `man` page in Safari through Bwana.