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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
# ログローテーションでできた古いログファイルを整理するためのスクリプト | |
# script/runner で実行する | |
Dir.chdir(RAILS_ROOT + "/log") | |
today = DateTime.now.strftime("%Y%m%d") | |
thismonth = DateTime.now.strftime("%Y%m") | |
Dir.glob("*").each do |filename| |
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
# | |
# log rotatation | |
# | |
# script/runner & cron で実行する | |
SERVER_PID = configatron.server.pid | |
ACCESS_LOG = configatron.server.access_log | |
ACCESS_LOG_STRFTIME = configatron.server.access_log_strftime | |
RAILS_LOG = configatron.server.rails_log | |
RAILS_LOG_STRFTIME = configatron.server.rails_log_strftime |
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
#!/usr/bin/env ruby | |
# ActiveRecordで管理している古いsessionを削除するスクリプト | |
# デフォルトで14日以上前のレコードを削除 | |
ENV["RAILS_ENV"] ||= "production" | |
require File.dirname(__FILE__) + '/../config/boot' | |
require File.dirname(__FILE__) + '/../config/environment' | |
num = ARGV.shift || 14 | |
num = num.to_i | |
# puts RAILS_ENV |
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
# -*- coding: utf-8 -*- | |
# | |
# Usage | |
# | |
# rails new yourapp -m https://raw.github.com/gist/1178242/3c77cfffeb99f32d19333de986ff41283aa9eb26/rails_template_for_3.1.rb -T --skip-bundle | |
# | |
git :init | |
append_file '.gitignore', <<-END |
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
# -*- coding: utf-8 -*- | |
class Array | |
def point(x, y) | |
self[y][x] | |
end | |
def set_point(x, y, char) | |
self[y][x] = char | |
self |
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
click = (id) -> | |
element = document.getElementById('card' + id) | |
myevent = document.createEvent('MouseEvents') | |
myevent.initEvent('click', false, true) | |
element.dispatchEvent(myevent) | |
element | |
size = $('.card').size() - 1 | |
ary = new Array(size) |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
input =<<EOS | |
100 | |
2 | |
10 11 | |
3 | |
0 9 9 | |
4 |
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
==> Downloading http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4 | |
File already downloaded and cached to /Users/maeshima/Library/Caches/Homebrew | |
==> ./configure -prefix /usr/local/Cellar/qt/4.7.3 -system-libpng -system-zlib - | |
==> make | |
cd src/tools/bootstrap/ && make -f Makefile | |
/usr/bin/c++ -c -O3 -w -pipe -fvisibility=hidden -I/usr/X11/include -Xarch_x86_64 -mmacosx-version-min=10.5 -O2 -fPIC -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIANT -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_TEXTSTREAM -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../../mkspecs/macx-g++ -I. -I../../../include -I../../../include/QtCore -I../../../include/QtXml -o .obj/release-static/qisciicodec.o ../../corelib/codecs/qisciicodec.cpp | |
/usr/bin/c++ -c -O3 -w -pipe -fvisibility=hidden - |
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
sudo yum install emacs git zsh gcc make readline readline-devel libyaml libyaml-devel zlib zlib-devel openssl openssl-devel | |
mkdir src | |
cd src | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz | |
tar zxvf ruby-1.9.3-p0.tar.gz | |
cd ruby-1.9.3-p0 | |
./configure | |
make | |
sudo make install | |
cd /home/ec2-user/src/ruby-1.9.3-p0/ext/openssl |
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
sudo yum install mysql mysql-server mysql-devel | |
sudo cp /etc/my.cnf /etc/my.cnf.orig | |
wget https://raw.github.com/willnet/config/master/my.cnf.ec2-micro | |
sudo mv my.cnf.ec2-micro /etc/my.cnf | |
sudo mysql_install_db | |
sudo mysqld_safe --defaults-file=/etc/my.cnf --user=mysql & | |
mysql -u root | |
TRUNCATE TABLE mysql.user; | |
FLUSH PRIVILEGES; | |
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'xxxxxxxx' WITH GRANT OPTION; |
OlderNewer