Skip to content

Instantly share code, notes, and snippets.

@okisanjp
okisanjp / file0.txt
Last active August 29, 2015 14:22
macのechoをシェルスクリプト内で使う時に -nオプションを使う方法 ref: http://qiita.com/okisanjp/items/7985ddb9b1b00f1617a9
# シェルスクリプト内で以下のように書くと
echo -n "Are you sure you want to exit the server? [y/n] > "
# 実行時
-n Are you sure you want to exit the server? [y/n] >
(´;ω;`)ウッ…
$ aws ec2 describe-instances
{
"Reservations": [
{
"OwnerId": "xxxxxxxxxxx",
"ReservationId": "r-xxxxxxx",
"Groups": [],
"Instances": [
{
@okisanjp
okisanjp / file0.txt
Last active December 22, 2016 09:24
bash:標準出力も標準エラーもログに出力 ref: http://qiita.com/okisanjp/items/4bdf009176ecae312f84
#!/bin/sh
echo "foo"
cat ./sonna_file_naiyo.txt
echo "bar"
@okisanjp
okisanjp / file0.txt
Created May 22, 2015 11:57
GNU lsをファイル出力するときは標準出力と見た目が違うから気をつける ref: http://qiita.com/okisanjp/items/46086d5af38babd4e2a5
$ ls
Plugin Vendor app composer.json composer.lock composer.phar fabfile.py fabfile.pyc
@okisanjp
okisanjp / gist:3e7a950c7f0c0af5fbf3
Created April 26, 2015 09:07
ブラウザ表示中ページからA8.netの商品リンクを生成
javascript:(function() {var m = "対象プログラムのA8MAT";var a = "http://px.a8.net/svt/ejp?a8mat=" + m + "&a8ejpredirect=";var u = location.href;prompt( 'Affiliate URL' , '<a href="' + a + encodeURIComponent(u) + '" target="_blank">' + document.title + '</a>' );})();
@okisanjp
okisanjp / gist:f2a3d97a62d0abb2052d
Created April 26, 2015 09:06
Amazon商品ページからアソシエイトタグ付きHTMLを生成
javascript:(function() {var m = "&tag=YOUR_ASSOCIATE_TAG";var u = location.href;prompt('Associate URL' ,'<a href="' + u + m + '" target="_blank">' + document.title + '</a>');})();
@okisanjp
okisanjp / file0.rb
Last active August 29, 2015 14:08
Chef-solo:レシピの中でChef実行中のユーザー名を使う ref: http://qiita.com/okisanjp/items/b039e2da328b21836bdc
git "/home/#{node['current_user']}/dotfiles" do
repository "https://github.com/okisanjp/dotfiles.git"
revision "master"
user node['current_user']
group node['current_user']
action :sync
end
@okisanjp
okisanjp / file0.txt
Last active August 29, 2015 14:08
fluent-plugin-mackerelでhttpdのステータスコードを送信 ref: http://qiita.com/okisanjp/items/9da6220e2230b06eb76a
# /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-datacounter
@okisanjp
okisanjp / file0.txt
Created October 31, 2014 17:15
td-agentをroot権限で起動する ref: http://qiita.com/okisanjp/items/af7f6a6b50acc2760313
DAEMON_ARGS="--user root"
TD_AGENT_ARGS="/usr/sbin/td-agent --group root --log /var/log/td-agent/td-agent.log"
@okisanjp
okisanjp / gist:32b3778f04548629afed
Created August 6, 2014 06:00
Google Analytics Custom Event ( Any label )
// track Outbound
var gatrOutbound = function(label) {
ga('send', 'event', 'outbound', 'click', label, {'hitCallback':
function () {
}
});
}