- Tatsuhiro Ujihisa
- http://ujihisa.blogspot.com/
- 非同期とは?
- スレッド、プロセス
- プロセス生成
| (let ((default-directory (expand-file-name "~/Dropbox/home/.emacs.d"))) | |
| (add-to-list 'load-path default-directory) | |
| (load (expand-file-name "~/Dropbox/home/.emacs.d/subdirs.el") t t t)) | |
| (if (file-exists-p (locate-library "init")) | |
| (load (locate-library "init") nil t nil)) |
| set :rails_env, :production | |
| set :unicorn_binary, "/usr/bin/unicorn" | |
| set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
| set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
| namespace :deploy do | |
| task :start, :roles => :app, :except => { :no_release => true } do | |
| run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
| end | |
| task :stop, :roles => :app, :except => { :no_release => true } do |
| require 'formula' | |
| class Vim < Formula | |
| homepage 'http://www.vim.org/' | |
| url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2' | |
| head 'https://vim.googlecode.com/hg/' | |
| sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d' | |
| version '7.3.682' | |
| def features; %w(tiny small normal big huge) end |
| "^ " | |
| =~ ( | |
| ("(").("~"^"."^"^"^(""=="")."").("^" | |
| ^"="^(""=="").""^")").("^"^".").("=" | |
| ^"~"^(""=="")."").("("^(""=="^").""^ | |
| "."^"^").("("^(""=="").""^"^"^")").( | |
| (" ^( " | |
| == " | |
| ") . | |
| "" ^ |
| set :aws_private_key_path, "~/.ec2/mrkey.pem" | |
| namespace :setup_server do | |
| desc "adds a user and uploads his id_rsa.pub to the EC2 instance's deploy users authorized_keys2 file" | |
| task :create_deploy_user do | |
| # \\n becomes \n | |
| commands = <<-SH.split("\n").map(&:strip).join(";") | |
| sudo echo hi | |
| sudo groupadd admin |
| =begin | |
| Capistrano deployment email notifier for Rails 3 | |
| Do you need to send email notifications after application deployments? | |
| Christopher Sexton developed a Simple Capistrano email notifier for rails. You can find details at http://www.codeography.com/2010/03/24/simple-capistrano-email-notifier-for-rails.html. | |
| Here is Rails 3 port of the notifier. | |
| The notifier sends an email after application deployment has been completed. |
| upstream app { | |
| server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0; | |
| } | |
| server { | |
| listen 80; | |
| server_name www.app.com; | |
| rewrite ^/(.*) http://app.com/$1 permanent; | |
| } | |
| server { |
| #!/usr/bin/ruby | |
| # | |
| # .git/hooks/pre-commit以下に配置すると、カレントディレクトリ以下にTODOが | |
| # 有る場合にコミットを禁止する。 | |
| # FORCE_COMMITフラグが立っていればTODO有りでもコミットできる | |
| exit 0 if ENV["FORCE_COMMIT"] == "true" | |
| todo_files = Dir["#{Dir.pwd}/**/*"].select do |path| | |
| File.read(path).all?{|line| (line =~ /TODO/) and (line !~ /#.*TODO/)} |
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use POSIX qw/mkfifo/; | |
| use File::Temp qw/tempfile/; | |
| use Scalar::Util qw/looks_like_number/; | |
| use IO::Handle; | |
| my $log_file = '/tmp/dstat.log'; | |
| my (undef, $pipe) = tempfile("dstat_XXXX", DIR => '/tmp', SUFFIX => '.pipe'); |