Skip to content

Instantly share code, notes, and snippets.

View simonoff's full-sized avatar
💭
KUBER!!!!

Oleksandr Simonov simonoff

💭
KUBER!!!!
View GitHub Profile
def meth1
puts "method start"
pr = lambda { return }
pr.call
puts "method end"
end
def meth2
ls -al /usr/share/locale/ru_RU.UTF-8/
total 12
drwxr-xr-x 8 root 272 2010-02-26 12:51 ./
drwxr-xr-x 239 root 8126 2010-03-30 08:52 ../
lrwxr-xr-x 1 root 28 2010-02-26 12:51 LC_COLLATE -> ../la_LN.US-ASCII/LC_COLLATE
lrwxr-xr-x 1 root 17 2010-02-26 12:51 LC_CTYPE -> ../UTF-8/LC_CTYPE
drwxr-xr-x 4 root 136 2009-05-18 21:19 LC_MESSAGES/
-r--r--r-- 1 root 40 2009-05-18 21:19 LC_MONETARY
lrwxr-xr-x 1 root 25 2010-02-26 12:51 LC_NUMERIC -> ../ru_RU.CP866/LC_NUMERIC
-r--r--r-- 1 root 605 2009-05-18 21:19 LC_TIME
preload_app true
GC.respond_to?(:copy_on_write_friendly=) and
GC.copy_on_write_friendly = true
before_fork do |server, worker|
# the following is highly recomended for Rails + "preload_app true"
# as there's no need for the master process to hold a connection
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
@simonoff
simonoff / gist:750379
Created December 21, 2010 19:01
unicorn init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
router:/etc # grep -r "ppp1" .
./sysconfig/SuSEfirewall2:# Examples: "ippp0 ippp1", "any dsl0"
./sysconfig/SuSEfirewall2:FW_DEV_INT="eth0 ppp0 ppp1 ppp2 ppp3 ppp4 ppp5 ppp6 ppp7 ppp8 ppp9"
## Type: string
#
# 3.)
# Which are the interfaces that point to the internal network?
#
desc "Make new jammit assets path based on commit hash"
task :jammit do
run "cd #{current_path}; bundle exec jammit"
run "cd #{current_path}; bundle exec jammit-s3"
end
before "deploy:restart", "deploy:jammit"
#!/bin/bash
#
# Sample .xinitrc for SuSE Linux
# This script is called from 'startx' when you start an X session
#
#
# In case everything goes wrong, we at least fall back to a plain xterm
#
failsafe="xterm -ls -T Failsafe -geometry 80x24-0-0"
@simonoff
simonoff / rspec-syntax-cheat-sheet.rb
Created October 24, 2011 11:08 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@simonoff
simonoff / workers.rake
Created November 30, 2011 15:39 — forked from karmi/workers.rake
Rake taks to launch multiple Resque workers in development/production with simple management included
# Rake task to launch multiple Resque workers in development/production with simple management included
require 'resque/tasks' # Require Resque tasks
namespace :workers do
# = $ rake workers:start
#
# Launch multiple Resque workers with the Rails environment loaded,
# so they have access to your models, etc.
--- central_logger/lib/central_logger/replica_set_helper.rb 2011-12-09 23:39:36.000000000 +0200
+++ mongodb_logger/lib/mongodb_logger/replica_set_helper.rb 2011-12-09 23:39:55.000000000 +0200
@@ -1,4 +1,4 @@
-module CentralLogger
+module MongodbLogger
module ReplicaSetHelper
# Use retry alg from mongodb to gobble up connection failures during replica set master vote
# Defaults to a 10 second wait
@@ -16,4 +16,4 @@
end