- paravirtual の arch linux AMI からインスタンスを作る
- chef solo で準備
- knife solo prepare でリモートサーバーにchef をインストールする
- Arch linux だとうまくいかない
- リモートサーバー上で直接Chefをインストールすることにした
curl -L https://www.opscode.com/chef/install.sh | bash
してもコケる- gem からインストールする
- まずは ruby をインストール
pacman -S extra/ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 実行前にgrepコマンドまで実行して確認しておく!! | |
git branch --merged | grep -v 'master' | xargs git branch -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/ftp' | |
ftp = Net::FTP.new | |
ftp.connect('hostname', 21) # port番号はdefaultで21(省略可能) | |
ftp.login('username', 'password') | |
ftp.passive | |
#=> true or false | |
ftp.passive = true | |
ftp.list | |
#=> ["-rw-r--r-- 1 0 0 1234 Feb 27 13:36 aaa.txt", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/ftp' | |
# connectionはいい感じに設定する | |
ftp = Net::FTP.new | |
ftp.connect | |
# ファイル名のみを取得する | |
ftp.ls.map {|name| name.split("\s").last } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# show exec environment | |
__show_env() { | |
if [ `pwd | grep "^/var/www/prod" | wc -l` -eq 1 ];then | |
echo "(prod)" | |
elif [ `pwd | grep "^/var/www/test" | wc -l` -eq 1 ];then | |
echo "(test)" | |
elif [ `pwd | grep "^/var/www/dev" | wc -l` -eq 1 ];then | |
echo "(dev)" | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 新規ユーザー作成時に管理バーを表示しない設定にする(WP3.1.4で確認) | |
function my_nodisplay_adminbarfront( $user_id ) { | |
update_user_meta( $user_id, 'show_admin_bar_front', 'false' ); | |
} | |
add_action( 'user_register', 'my_nodisplay_adminbarfront' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_blog_description() { | |
$description = ''; | |
if ( is_single() ) { | |
// 投稿の場合 | |
$_post = get_post(); | |
$description = $_post->post_content; | |
$description = preg_replace( "/[\n|\r|\n\r|\t|\s]/", '', $description ); | |
$description = strip_tags( $description ); | |
$more_str = mb_strlen( $description, 'UTF-8' ) > 100 ? '...' : ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="http://b.hatena.ne.jp/entry/<?php the_permalink(); ?>" class="hatena-bookmark-button" data-hatena-bookmark-title="<?php echo the_title_attribute( array( 'echo' => 0 ) ) . ' | ' . get_bloginfo( 'name' ); ?>" data-hatena-bookmark-layout="vertical" title="このエントリーをはてなブックマークに追加"><img src="http://b.st-hatena.com/images/entry-button/button-only.gif" alt="このエントリーをはてなブックマークに>追加" width="20" height="20" style="border: none;" /></a><script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_hatena_star_code() { | |
?> | |
<script type="text/javascript" src="http://s.hatena.ne.jp/js/HatenaStar.js"></script> | |
<script type="text/javascript"> | |
Hatena.Star.SiteConfig = { | |
entryNodes: { | |
'article': { | |
uri: 'h1 a', | |
title: 'h1', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
curl -s https://getcomposer.org/installer | php |
OlderNewer