vimrc syntasticの連携
"NeoBundle 'scrooloose/syntastic'
"NeoBundle 'scrooloose/syntastic'
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=1
let g:syntastic_mode_map={ 'mode': 'passive',
\ 'active_filetypes': ['php', 'ruby', 'javascript', 'json'],
\ 'passive_filetypes': []
\}
let g:syntastic_ruby_checkers=['rubocop']
let g:syntastic_javascript_checkers=['jshint']
let g:syntastic_php_checkers=['php','phpcs']
let g:syntastic_quite_warnings=0
rubocopのインストール系
http://qiita.com/yuku_t/items/0ac33cea18e10f14e185
phpdcsのインストール
phear install PHP_CodeSniffer
jshintのインストール系
http://d.hatena.ne.jp/sasaplus1/20120517/1337260047
railsの起動方法
1.apache止める
2.rais-serverの起動
amazonのsecurity zoneをあけておくこと
rails server -d
curl -I localhost:3000
3.nginxの起動
/etc/init.d/nginx start
4.unicornの起動
unicorn -c config/unicorn.conf -D
※unicorn.confのあるディレクトリ注意
worker_processes 2&
pid '/tmp/unicorn.pid'&
listen '/tmp/unicorn.sock'&
corn -c config/unicorn.conf -Dstderr_path File.expand_path('unicorn.log', File.dirname(__FILE__) + '/../lo
stdout_path File.expand_path('unicorn.log', File.dirname(__FILE__) + '/../log')&
preload_app true&
これで深い階層にrailsファイル群をつくっても、
URLのroot(ex. http://google.com/)にアクセスすれば見れる。
URLのroot(ex. http://google.com/)にアクセスすれば見れる。
あとは
rails generate controller hoge home
URL/hoge/homeで見られる。
rails/first_appで
rails server -dをやったから
そこがdocument rootになってるっぽい。
すげえ。。
そこがdocument rootになってるっぽい。
すげえ。。
==================
(戻し方)
1.unicornを落とす
kill -QUIT `cat /path/to/unicorn.pid`
(参考)
(再起動) kill -HUP `cat /path/to/unicorn.pid`
unicorn.sockを落とす
rm -rf
2. nginx落とす
/etc/init.d/nginx stop
3.apacheをあげる
/etc/init.d/httpd start
[参考URL]
http://qiita.com/dahugani/items/858b3979c0da8ecafdbb
http://qiita.com/konpyu/items/3ba3774bcde226d7d07d
http://tachesimazzoca.github.io/wiki/rails3/unicorn.html
sed -e '3d' names.txt
⇒3行目を消す
sed '3d' names.txt
⇒ 1つだけならeを省略できる
sed -i '3d' names.txt
ファイルを上書き
sed -i.bk '3d' names.txt
ファイルを上書きしてバックアップ
vim ex1.sed
sed -f ex1.sed names.txt
外部ファイル読み込み
>>>>>>>>>>>>>>>>>>>>>>>
sed '3d' names.txt
address 3
command d ←パターン表示を削除
パターンスペースっていうバッファーを使って処理をやる
1.ファイルから1行読み込んでパターンスペースに格納
2.addressにマッチ? ⇒ commandを実行!
3. パターンスペースを表示
>>>>>>>>>>>>>>>>>>>>>>
1062 sed '3!d' names.txt
3行目以外をd
1063 sed '1d;3d' names.txt
複数指定。1行目と3行目をd
1064 sed '1,3d' names.txt
1~3行目をd
1065 sed '1~2d' names.txt
1,3,5,,,,をd
1066 sed '$d' names.txt
最後の行をd
1067 sed '3,$d' names.txt
3~最後の行をd
1068 sed '/i$/d' names.txt
正規表現。最後がiで終わるやつをd
1069 sed 'd' names.txt
全部の行でd
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1072 sed '3p' names.txt
3行目をprint
1073 sed -n '3p' names.txt
3行目をprintマッチしないところは出力しない
1074 sed '3q' names.txt
3行目を出力してquit
1076 sed '1i\--- start ---' names.txt
1行目の前に--- start ---を代入
1077 sed -e '1i\---- start---' -e '$a\ === end ===' names.txt
複数コマンドはe
1行目の前に--- start ---
最後の行の後に end
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1082 sed 's/apple/Apple/' items.txt
appleをAppleに変換(最初の一つのみ)
1083 sed 's/apple/Apple/g' items.txt
appleをAppleに変換(すべて)
1085 sed 's/apple/Apple/2' items.txt
appleをAppleに変換(2番目)
1086 sed 's/apple/Ringo/ig' items.txt
appleをRingoに変換(すべて、大文字区別なし)
1087 sed 's/[aA]pple/Ringo/g' items.txt
正規表現ver
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# sed 's/[0-5]/[&]/' items.txt
& : [0-5]で抜き出したものを使う
[1] taguchi Apple, apple, apple, grape
[2] fkoji Banana, apple, Apple, lemon
[3] dotinstall Grape, apple, strawberry
[4] tkahashi cherry, pear, kiwi
[5] yasuda cherry, Cherry
# sed 's/\([0-5]\) \(.*\)/\2 [\1]/' items.txt
()でとじると\1とか\2であらわすことができる。
()の前はエスケープ文字が必要
taguchi Apple, apple, apple, grape [1]
fkoji Banana, apple, Apple, lemon [2]
dotinstall Grape, apple, strawberry [3]
tkahashi cherry, pear, kiwi [4]
yasuda cherry, Cherry [5]
teratermでいちいちユーザー名とパスワードを入力するのが面倒なときにこうやる。
プロパティ→リンク先
(鍵認証)
"C:\Program Files (x86)\teraterm\ttermpro.exe" localhost:22 /ssh2 /auth=publickey /user=root /ask4password /keyfile=C:\Users\Desktop\local\id_rsa.ppk
(パスワード)
"C:\Program Files (x86)\teraterm\ttermpro.exe" localhost:22 /ssh2 /auth=password /user=ユーザー名/ask4password /passwd=パスワード
プロパティ→リンク先
(鍵認証)
"C:\Program Files (x86)\teraterm\ttermpro.exe" localhost:22 /ssh2 /auth=publickey /user=root /ask4password /keyfile=C:\Users\Desktop\local\id_rsa.ppk
(パスワード)
"C:\Program Files (x86)\teraterm\ttermpro.exe" localhost:22 /ssh2 /auth=password /user=ユーザー名/ask4password /passwd=パスワード
参考)http://ri.hateblo.jp/entry/2013/09/22/195005
1.gitのインストール
2.$ ssh-keygen -t rsa -b 2048 -C '<ユーザ名>@<PC名>'で秘密鍵と公開鍵を使う
3.gitlabに公開鍵の登録
cat id_rsa.pubを貼り付ける
4.chmod 600で秘密鍵の権限変更
5./ユーザー/.ssh/ホスト名/におく
6./ユーザー/.ssh/config内に下記を例にして書く
Host FQDN
HostName FQDN
Port 22
User ユーザー名
IdentityFile /ユーザー/.ssh/ホスト名/id_rsa
みたいな感じ
7.クローンしたいフォルダでgit init
8.git clone ユーザー名@FQDNって感じでできる