如果你用的是Linux,你可以用你的本地包管理系统(native package management system)来安装.
$ yum install git-core #译者注,在redhat等系统下用yum
$ apt-get install git-core #译者注,在debian, ubuntu等系统下用apt-get
# Rake task to launch multiple Resque workers in development/production with simple management included | |
require 'resque/tasks' # Require Resque tasks | |
namespace :workers do | |
# = $ rake workers:start | |
# | |
# Launch multiple Resque workers with the Rails environment loaded, | |
# so they have access to your models, etc. |
# encoding: utf-8 | |
class ScanChinese | |
def self.scan(file) | |
if File.directory?(file) | |
files = (Dir.entries(file) - %w( . .. )) | |
dir = files.map{|name| File.join(file, name)} | |
dir.each do |filename| | |
if File.directory?(filename) | |
scan(filename) | |
else |
# need gem install benchmark-ips | |
require 'benchmark/ips' | |
def slow(&block) | |
block.call | |
end | |
def fast | |
yield |
require 'benchmark' | |
# 遍历N是否能被从2到sqrt(N)之间的素数整除。若不能则为素数 | |
def fast(max) | |
mini = Math.sqrt(max).to_i | |
sub_primes = sub_primes(mini) | |
sub_primes + ((mini+1)..max).select{|n| sub_primes.all?{|obj| n % obj > 0 } } | |
end | |
def sub_primes(sub) |
#1 Generate Public & Private Keypair | |
#2 Create receipt.json - eg below - careful with line-endings, etc if line breaks | |
#3 Create signature & Encode | |
openssl dgst -binary -sha1 -sign private.pem receipt.json | openssl base64 > signature.txt | |
#4 Verify using OpenSSL & public key | |
openssl base64 -d -in signature.txt -out signature.sha1 | openssl dgst -sha1 -verify public.pem -signature signature.sha1 receipt.json | |
function verify_app_store_in_app($receipt, $is_sandbox) | |
{ | |
//$sandbox should be TRUE if you want to test against itunes sandbox servers | |
if ($is_sandbox) | |
$verify_host = "ssl://sandbox.itunes.apple.com"; | |
else | |
$verify_host = "ssl://buy.itunes.apple.com"; | |
$json='{"receipt-data" : "'.$receipt.'" }'; | |
//opening socket to itunes |
#1 Generate Public & Private Keypair | |
#2 Create receipt.json - eg below - careful with line-endings, etc if line breaks | |
#3 Create signature & Encode | |
openssl dgst -binary -sha1 -sign private.pem receipt.json | openssl base64 > signature.txt | |
#4 Verify using OpenSSL & public key | |
openssl base64 -d -in signature.txt -out signature.sha1 | openssl dgst -sha1 -verify public.pem -signature signature.sha1 receipt.json | |
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 选择 jdk-8u25-macosx-x64.dmg 下载
Download and unzip the Elasticsearch official distribution.
目录 评论 | |
/ 根目录,万物起源。 | |
/bin 包含系统启动和运行所必须的二进制程序。 | |
/boot | |
包含 Linux 内核,最初的 RMA 磁盘映像(系统启动时,由驱动程序所需),和 启动加载程序。 | |
有趣的文件: | |
/boot/grub/grub.conf or menu.lst, 被用来配置启动加载程序。 | |
/boot/vmlinuz,Linux 内核。 |