Skip to content

Instantly share code, notes, and snippets.

@yurakawa
yurakawa / 0_reuse_code.js
Created March 21, 2014 00:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@yurakawa
yurakawa / rails_resources.md
Created March 21, 2014 00:41 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@yurakawa
yurakawa / Gemfile
Last active August 29, 2015 14:01
テスト用Gemfile
group:development,:test do
# RSpecを含んでいるgem。このgemはRails専用の機能を追加するRSpecのラッパーライブラリになっている。
gem "rspec-rails", "~> 2.14.0"
# Railsがデフォルトで提供するフィクスチャを便利なファクトリで置き換える。フィクスチャやファクトリはテストスイート用のテストデータを作成するために使われる。
gem "factory_girl_rails", "~> 4.2.1"
end
group:test do
# 名前やメールアドレス、その他のプレースホルダをファクトリに提供する。
gem "faker", "~> 1.1.2"
@yurakawa
yurakawa / .rspec
Created May 31, 2014 15:37
rspec設定ファイル。
--color
# 出力形式を文書形式に設定
--format documentation
@yurakawa
yurakawa / httpheader.pl
Created August 5, 2014 09:07
HTTPヘッダ確認用CGI
#!/usr/bin/perl
require "./jcode.pl";
print "Content-type: text/html; charset=Shift_JIS", "\n\n";
print "<html><body>", "\n";
print "<a href=\"test/index.html\">LINK</a>";
#print "環境変数<hr>", "\n";
print "環境変数<br>", "\n";
print "※環境変数に含まれるHTTPヘッダのキーの注意点<br>", "\n";
@yurakawa
yurakawa / logresolvemerge.pl
Created August 7, 2014 02:45
access.logマージ用スクリプト
#!/usr/bin/perl
# With some other Unix Os, first line may be
#!/usr/local/bin/perl
# With Apache for Windows and ActiverPerl, first line may be
#!C:/Program Files/ActiveState/bin/perl
#-Description-------------------------------------------
# Merge several log files into one and replace all IP addresses
# with resolved DNS host name.
# This tool is part of AWStats log analyzer but can be use
# alone for any other log analyzer.
@yurakawa
yurakawa / command_list.md
Created May 17, 2015 11:53
状況確認コマンド

「w」

  • システムの稼働時間、ログインユーザ数、ロードアベレージを確認 [root@ip-10-0-0-61 ~]# w

-入力結果 20:33:50 up 18 days, 8:08, 1 user, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/0 119.244.165.240 14:51 0.00s 0.05s 0.01s w

「ss -lnp」

@yurakawa
yurakawa / kanshi.md
Last active August 29, 2015 14:21
監視について

監視について

運用管理の現場においては、管理コストを抑えつつ、以下にして効率よくサーバを管理できるかが重要。

システム監視

  • システム内で動作しているサーバ、アプリケーション、ネットワークなどが正常に稼働しているかを 定期的に確認することで、システムで発生した障害やリソース不足を検知してシステム管理者に通知を 行うための作業や仕組みのこと。
  • システム監視は大きく分けて以下の3つ。

稼働監視

@yurakawa
yurakawa / tips.bash
Last active December 23, 2015 16:49
シェルスクリプトのTipsをメモ
#!/bin/bash
# シェルスクリプトで一時的なファイル(中間ファイル)を作成
tmp=/tmp/$$
echo hoge > $tmp-hoge
rm $tmp-*
# あるファイルがなければシェルスクリプトを終了する
[ -f "/etc/passwd" ] || exit 1
@yurakawa
yurakawa / .cvimrc
Last active January 19, 2016 10:59
.cVimrc
" Settings
set noautofocus
set cncpcompletion
set nosmoothscroll
set nohud
set autohidecursor
set typelinkhints
let locale = "jp"
let scrollduration = 10