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
MyApp::Application.routes.draw do | |
# If you concern about SEO then send permanent redirect (301) on old routes to new routes | |
# It is always better to do this setting in web server that is in nginx or apache. | |
# Here I am showing how to do it in rails routes file | |
get '/users/sign_in', to: redirect("/sign-in") | |
get '/users/sign_up', to: redirect("/sign-up") | |
# Need to skip session and registration so that we can override them in devise_scope block | |
# If we not do so then default route of devise continue to work | |
devise_for :users, :skip => [:sessions, :registrations] |
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
Delivered-To: XXXX@mydomain.com | |
Received: by 10.229.25.199 with SMTP id a7csp15957qcc; | |
Wed, 7 May 2014 05:55:13 -0700 (PDT) | |
X-Received: by 10.182.241.67 with SMTP id wg3mr44908240obc.16.1399467313246; | |
Wed, 07 May 2014 05:55:13 -0700 (PDT) | |
Return-Path: <rahul100885@gmail.com> | |
Received: from mail-pd0-x22d.google.com (mail-pd0-x22d.google.com [2607:f8b0:400e:c02::22d]) | |
by mx.google.com with ESMTPS id yb4si1843965pbb.403.2014.05.07.05.55.12 | |
for <XXXX@mydomain.com> | |
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); |
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
SELECT relname, PG_SIZE_PRETTY(PG_TOTAL_RELATION_SIZE(relid)) FROM pg_stat_all_tables WHERE schemaname != 'pg_toast' AND relname LIKE 'pg_%' ORDER BY PG_TOTAL_RELATION_SIZE(relid) DESC; |
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 | |
while true; do | |
passenger-memory-stats | grep Rails:\ /home | awk ' { if($2 > 500) print "kill -9 " $1}' | bash | |
# above line will kill all the rails instances which are using memory more than 500MB | |
passenger-status | grep Processed: | awk ' { if($7 > 100) print "kill -6 " $3}' | bash | |
# above line will abort all rails instance who have processed 100 request. | |
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 | |
RAILS_CODE_PATH='/home/rahul/workspace/livia_portal_3/livia_portal/' | |
RAKE_PATH='/usr/local/rvm/gems/ree-1.8.7-2010.02@global/bin/rake' | |
USER="rahul" | |
case ARGV[0] | |
when "start" | |
STDOUT.puts "called start" | |
system "su - #{USER} -c \"cd #{RAILS_CODE_PATH} && #{RAKE_PATH} ts:rebuild\"" |
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
# Redis configuration file example | |
# Note on units: when memory size is needed, it is possible to specifiy | |
# it in the usual form of 1k 5GB 4M and so forth: | |
# | |
# 1k => 1000 bytes | |
# 1kb => 1024 bytes | |
# 1m => 1000000 bytes | |
# 1mb => 1024*1024 bytes | |
# 1g => 1000000000 bytes |
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/bash | |
set -e | |
REDMINE_URL="http://rubyforge.org/frs/download.php/75097/redmine-1.2.1.tar.gz" | |
S3_ACCESS_KEY_ID="" | |
S3_SECRET_ACCESS_KEY="" | |
S3_BUCKET_NAME="" | |
HEROKU_APP_NAME="" |
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 | |
def output_config | |
puts <<-END | |
graph_category App | |
graph_title passenger status | |
graph_vlabel count | |
sessions.label sessions | |
max.label max processes |
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 "benchmark" | |
val = (1..9).to_a | |
Benchmark.bm(7) do |x| | |
x.report("if:") { | |
val.each { |v| | |
if v == 9 | |
a = 9 | |
elsif v == 8 |
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 'benchmark' | |
require 'securerandom' | |
Benchmark.bm(7) do |x| | |
x.report("UUID") { SecureRandom.uuid } | |
x.report("hex(16)") { SecureRandom.hex(16) } | |
end | |
#Output |
OlderNewer