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 'test/unit' | |
class TM | |
def self.calc(ary) | |
ary.sort!.map!(&:to_i) | |
touch_info = ary.permutation(2).map { |a,b| check_touch(a, b) } | |
touch_numbers = touch_info.each_slice(3).map {|i| i.compact.length } | |
return 'T' if touch_numbers.max == 3 | |
return 'O' if touch_numbers.all? { |i| i == 2 } |
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
class ValidAttributeMatcher | |
def initialize(attr_name) | |
@attr_name = attr_name | |
end | |
def matches?(subject) | |
@subject = subject | |
@subject.valid? | |
@subject.errors[@attr_name].empty? | |
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
#!/bin/sh | |
# | |
# nginx - this script starts and stops the nginx daemin | |
# | |
# chkconfig: - 85 15 | |
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ | |
# proxy and IMAP/POP3 proxy server | |
# processname: nginx | |
# config: /usr/local/nginx/conf/nginx.conf | |
# pidfile: /usr/local/nginx/logs/nginx.pid |
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
(define-key global-map "\C-h" 'delete-backward-char) | |
(define-key isearch-mode-map "\C-h" 'isearch-delete-char) |
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 pcre-devel | |
wget http://nginx.org/download/nginx-1.2.6.tar.gz | |
tar zxvf nginx-1.2.6.tar.gz | |
cd nginx-1.2.6 | |
./configure --with-openssl=/usr/lib64/openssl/engines | |
make | |
sudo make install | |
git clone git://gist.github.com/4406334.git | |
sudo mv 4406334/nginx /etc/init.d/ | |
sudo chmod 755 /etc/init.d/nginx |
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
./configure --without-toolkit-scroll-bars --without-xaw3d --without-compress-info --without-sound --without-pop --without-xpm --without-tiff --without-rsvg --without-gconf --without-gsettings --without-selinux --without-gpm --without-makeinfo --with-x | |
make | |
sudo make install |
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 | |
require 'pathname' | |
require 'date' | |
require 'fileutils' | |
path = ARGV.first | |
path_name = Pathname.new(path) | |
last_month = Date.today.prev_month | |
last_month_beginning_of_day = last_month.prev_day(last_month.day - 1) |
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
RAILS_ROOT = "/path/to/root" | |
God.watch do |w| | |
w.name = "solr" | |
w.interval = 30.seconds # default | |
w.dir = RAILS_ROOT | |
w.log = "#{RAILS_ROOT}/log/god.log" | |
w.env = { 'RAILS_ROOT' => RAILS_ROOT, | |
'RAILS_ENV' => "production", | |
'HOME' => '/root'} |
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 | |
exec ag --silent --color --color-match '01;31' --nogroup "$@" |