- Tatsuhiro Ujihisa
- http://ujihisa.blogspot.com/
- 非同期とは?
- スレッド、プロセス
- プロセス生成
| #!/bin/sh | |
| set -u | |
| set -e | |
| # Example init script, this can be used with nginx, too, | |
| # since nginx and unicorn accept the same signals | |
| # Feel free to change any of the following variables for your app: | |
| APP_ROOT=/home/deploy/public_html/rm/current | |
| PID=$APP_ROOT/tmp/pids/unicorn.pid | |
| ENV=production |
| # Use this for your URL shortening needs | |
| # Base 62 is as good as you can easily get for URL shortening | |
| # And it's effective: 1_000_000 => '4c92' | |
| # Challenge: fork and speed up the implementation! | |
| class Fixnum | |
| TOKENS = ('0'..'9').to_a + ('a'..'z').to_a + ('A'..'Z').to_a | |
| # NOTE returns nil for 0 | |
| def to_62_s |
| # Since Git is well structured, Grit uses a method missing (Grit::Git#method_missing) to 'systematically' execute Git commands: | |
| require 'grit' | |
| include Grit | |
| gritty = Grit::Git.new('/tmp/filling-in') | |
| gritty.clone({:quiet => false, :verbose => true, :progress => true, :branch => '37s'}, "git://github.com/cookbooks/cc-aws.git", "/tmp/cc-aws2") | |
| # => "Initialized empty Git repository in /tmp/cc-aws2/.git/\n" | |
| Dir.entries('/tmp/cc-aws2').size | |
| # => 10 |
| ' Copyright (c) 2007, Tony Ivanov | |
| All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | |
| modification, are permitted provided that the following conditions are met: | |
| * Redistributions of source code must retain the above copyright | |
| notice, this list of conditions and the following disclaimer. | |
| * Redistributions in binary form must reproduce the above copyright | |
| notice, this list of conditions and the following disclaimer in the | |
| documentation and/or other materials provided with the distribution. |
| require 'net/http' | |
| require 'uri' | |
| require 'json' | |
| def get_gist(fileName,content) | |
| res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/json/new'), | |
| { 'files[#{fileName}]' => content, | |
| 'login' => 'USER NAME HERE', | |
| 'token' => 'API TOKEN HERE', | |
| 'description' => 'This is a test description' |
| config_eth0="aaa.bbb.ccc.ddd/23" | |
| routes_eth0="default via aaa.bbb.ccc.1" | |
| dns_servers_eth0="210.224.163.4 210.224.163.3" | |
| iptunnel_6rd="mode sit local aaa.bbb.ccc.ddd ttl 64" | |
| config_6rd="2001:e41:xxxx:xxxx::1/32" # printf "2001:e41:%02x%02x:%02x%02x::1\n" aaa bbb ccc ddd | |
| routes_6rd="::/0 via ::61.211.224.125 dev 6rd" | |
| mtu_6rd="1280" | |
| postup() { |
| require 'zlib' | |
| module ConsistentHashr | |
| @circle = {} | |
| @number_of_replicas = 20 | |
| ## | |
| # Computes a key | |
| def self.hash_key(key) | |
| Zlib.crc32("#{key}") |
| #!/bin/bash | |
| logger "Trying to start delayed_job" | |
| date >> /home/deployer/scripts/log/start_delayed_job.txt | |
| rvm_path=/home/deployer/.rvm | |
| source "/home/deployer/.rvm/scripts/rvm" | |
| cd /home/deployer/inoty | |
| /usr/bin/env RAILS_ENV=production /home/deployer/.rvm/rubies/ruby-1.9.2-p0/bin/ruby /home/deployer/inoty/script/delayed_job restart &>> /home/deployer/scripts/log/start_delayed_job.txt |
| # Update, upgrade and install development tools: | |
| apt-get update | |
| apt-get -y upgrade | |
| apt-get -y install build-essential git-core curl libssl-dev \ | |
| libreadline5 libreadline5-dev \ | |
| zlib1g zlib1g-dev \ | |
| libmysqlclient-dev \ | |
| libcurl4-openssl-dev \ | |
| libxslt-dev libxml2-dev |