Quit Safari
Open the Terminal
Move the folder ~/Library/Safari into your Dropbox

mv ~/Library/Safari ~/Dropbox

Make a link from the old location to the new location (for your Mac’s safari to use).

ln -s ~/Dropbox/Safari/ ~/Library/Safari

You’re done on your mac!

 

before you run this script, you should had ruby env and Xcode.
1. save it with name ‘png’
2. chmod +x png
useage: ./png [ipa file path]


#!/usr/bin/env ruby -wKU
require 'rubygems'
ipa = ARGV.first
puts "useage:png " and return if !ipa or ipa.end_with?("ipa")
name = File.basename(ipa, ".ipa")
# create output folder in you desktop
output = "#{ENV['HOME']}/Desktop/#{name}"
system %Q{mkdir -p "#{output}" && unzip "#{ipa}" -u -d "#{output}"}
Dir.glob(File.join(output, "**", "*.png")).each do |f|
  system %Q{/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations -q "#{f}" "#{File.join(output ,File.basename(f))}"}
end
system %Q{find '#{output}' -type f -not \\( -iname "*.png" -or -iname "*.jpg" -or -iname "*.jpeg" \\) -delete}
system %Q{open "#{output}" -a finder}
 

May be there is another better method to do this. If you have the better way to do it, please tell me.
BTW, below code were successful running in rails3 and ruby 1.8.7

1. first, you should add open4 gem to your Rails project Gemfile

gem 'open4'

and run “bundle install” in terminal to install it in project dir.

2. add below code to config/deploy.rb, please change the namespace name to your own

namespace :your_namespance_name do
  require 'open4'
  rails_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
  stdin, stdout, stderr = Open4::popen4("cd #{rails_root} && rake -T")
  #please replace :your_namespance_name to your own, this code to grap you special of namespance rake tasks
  stderr.read.scan(/your_namespance_name\:(\w+)/).each do |match|
    desc "rake task named '#{match.last}'"
    task match.last.to_sym, :roles => :app do
      run "cd #{current_path}; RAILS_ENV=production rake railscasts:#{match}"
    end
  end
end

after do that, when you run cap -T in you command shell, you will be found the tasks from rake, also, it can invoked from the remote server of you own.

 

put this to you ~/.inputrc

# do not show hidden files in the list
set match-hidden-files off
# auto complete ignoring case
set show-all-if-ambiguous on
set completion-ignore-case on
# lookup in search histories
"\ep": history-search-backward
"\e[A": history-search-backward
"\e[B": history-search-forward

 
wget -m -erobots=off -U Mozilla -p <web site url>

wget \
     --recursive \
     --no-clobber \
     --page-requisites \
     --html-extension \
     --convert-links \
     --restrict-file-names=windows \
     --domains your.website.com \
     --no-parent \

http://your.website.com/
 
!.*/(\.[^/]*|vendor/rails|doc|rails_root|CVS|log|data_dump|build|_darcs|pkg |_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)? |bundle|vendor/.*/test))$
 

假设服务器网址为: server.joycodes.com,客户端就为本地电脑.默认情况下,我们通过客户端ssh到服务器端,是需要输入密码来进行认证的.除了使用用户名和密码,SSH还可以使用公钥/私钥来进行认证,这样就避免在同一客户端SSH多次输入麻烦.
SSH 使用公钥/密钥认证的原理如下:
服务器端持有公钥,客户端持有密钥,当客户端通过SSH到服务器端时将会发送私钥,服务器端根据私钥和自身持有的密钥进行验证.如果匹配,认证通过.具体设置如下:
1.登录到服务器端,生成SSH公钥和密钥

joy:joys-macpro31:~$ssh root@server.joycodes.com #登录用户为root
root@server.joycodes.com's password:   #输入root的密码
[root@joycodes ~]#ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):  #直接按回车
Enter same passphrase again:  #直接按回车
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
11c5:ec:ce:c5:67:eb:fb:a4:05:a0:fd:05:75:92:ec:1c joy@joys-macpro31.local

2.在服务器端将生成的公钥加入authorized_keys中

[root@joycodes ~]# cd ~/.ssh
[root@joycodes ~]# cat id_rsa.pub >> authorized_keys
[root@joycodes ~]# chmod 600 authorized_keys

3.退出服务器端,将私钥保存到客户端

[root@joycodes ~]# exit
joy:joys-macpro31:~$ mkdir -p ~/.ssh
joy:joys-macpro31:~$ cd ~/.ssh
joy:joys-macpro31:~/.ssh$ scp neo@server1.techpulp.com:.ssh/id_rsa ./
root@server.joycodes.com's password: #再次输入服务器密码 将私钥下载到 ~/.ssh目录中
.ssh/id_rsa                                          100% 2587     2.5KB/s   00:00
joy:joys-macpro31:~/.ssh$ chmod 600 id_rsa

经过上面步骤后,在次运行 ssh root@server.joycodes.com后就可以直接登录到服务器而无需输入密码.
附capistrano文件

# this capistrano file is for enable ssh auto login
# run command => cap ssh_auto_login
# by joycodes@gmail.com
set :user, "root" # the user name login for remote server
set :password, "passwd" # login passwd for
role :app, "www.joycodes.com" # remote host
desc "this task is for set ssh auto login"
task :ssh_auto_login,:role => :app do
      cmd =<<-COMMAND         cd ~/.ssh         ssh-keygen -t rsa         cat id_rsa.pub >> authorized_keys
        chmod 600 authorized_keys
      COMMAND
      run cmd.split(/\n\s*/).join(' && ') do |channel, stream ,data|
        logger.info data
        if data =~ /Enter file in/
        channel.send_data "\n"
      elsif data =~ /Overwrite/
        channel.send_data "y\n"
      elsif data =~ /Enter same passphrase/
        channel.send_data "\n"
      elsif data =~ /Enter passphrase/
        channel.send_data "\n"
      end
      end
      get "/#{user}/.ssh/id_rsa", '/Users/joy/.ssh/id_rsa' #/User/joy is current local user home path
    run_locally "chmod 600 ~/.ssh/id_rsa"
end

参考原文: http://techpulp.com/2009/04/how-to-enable-auto-login-for-ssh/

© 2012 { joycodes blog } Suffusion theme by Sayontan Sinha