Skip to content

Instantly share code, notes, and snippets.

View avsej's full-sized avatar
🛋️
On the couch

Sergey Avseyev avsej

🛋️
On the couch
View GitHub Profile
@avsej
avsej / .vimrc
Created November 16, 2009 09:50
source ~/.vim/rc.vim
@avsej
avsej / fetch_rubymine_license.rb
Created December 11, 2009 13:32
Automate rubymine license fetching
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'digest/md5'
require 'pp'
begin
require 'faker'
rescue LoadError
puts "You should install faker gem. (gem install faker)"
exit
@avsej
avsej / ruby_alternatives.sh
Created December 23, 2009 15:22
Configure ubuntu/debian alternatives for ruby
#!/bin/sh
# at first you should remove gem alternative if it exists
# update-alternatives --remove-all gem
update-alternatives --remove-all ruby
update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.8 500 \
--slave /usr/bin/ri ri /usr/bin/ri1.8 \
--slave /usr/bin/erb erb /usr/bin/erb1.8 \
--slave /usr/bin/rdoc rdoc /usr/bin/rdoc1.8 \
# This is a monkey patch for MessageVerifier — I need to change Marshal.load to JSON
if defined?(ActionController::Flash::FlashHash)
class ActionController::Flash::FlashHash
def to_json(*args)
{}.merge(self).merge({:used => @used}).to_json
end
end
end
@avsej
avsej / Output
Created January 9, 2010 14:02 — forked from pager/Output
user system total real
pure functional 1.820000 0.000000 1.820000 ( 1.817629)
mutable discriminator 1.530000 0.000000 1.530000 ( 1.534346)
imperative 1.110000 0.020000 1.130000 ( 1.118294)
cursor/iterator 2.370000 0.000000 2.370000 ( 2.373262)
true enumerator 2.090000 0.000000 2.090000 ( 2.089513)
Loaded suite sequences_by
Started
.
Finished in 0.000497 seconds.
#!/usr/bin/env ruby
# encoding: utf8
$KCODE="u"
en_ru = { 'q'=>'й', 'w'=>'ц', 'e'=>'у', 'r'=>'к', 't'=>'е', 'y'=>'н',
'u'=>'г', 'i'=>'ш', 'o'=>'щ', 'p'=>'з', '['=>'х', ']'=>'ъ',
'a'=>'ф', 's'=>'ы', 'd'=>'в', 'f'=>'а', 'g'=>'п', 'h'=>'р',
'j'=>'о', 'k'=>'л', 'l'=>'д', ';'=>'ж', "'"=>'э', 'z'=>'я',
'x'=>'ч', 'c'=>'с', 'v'=>'м', 'b'=>'и', 'n'=>'т', 'm'=>'ь',
','=>'б', '.'=>'ю', '`'=>'ё',
>> puts ThinkingSphinx.search('sergey').results[:matches]
{:doc=>49753, :weight=>3, :index=>0, :attributes=>{"sphinx_internal_id"=>2073, "class_crc"=>230816244, "subclass_crcs"=>[230816244], "sphinx_deleted"=>0}}
{:doc=>67561, :weight=>3, :index=>1, :attributes=>{"sphinx_internal_id"=>2815, "class_crc"=>230816244, "subclass_crcs"=>[230816244], "sphinx_deleted"=>0}}
{:doc=>67585, :weight=>3, :index=>2, :attributes=>{"sphinx_internal_id"=>2816, "class_crc"=>230816244, "subclass_crcs"=>[230816244], "sphinx_deleted"=>0}}
{:doc=>76609, :weight=>3, :index=>3, :attributes=>{"sphinx_internal_id"=>3192, "class_crc"=>230816244, "subclass_crcs"=>[230816244], "sphinx_deleted"=>0}}
{:doc=>86737, :weight=>3, :index=>4, :attributes=>{"sphinx_internal_id"=>3614, "class_crc"=>230816244, "subclass_crcs"=>[230816244], "sphinx_deleted"=>0}}
{:doc=>101569, :weight=>3, :index=>5, :attributes=>{"sphinx_internal_id"=>4232, "class_crc"=>230816244, "subclass_crcs"=>[230816244], "sphinx_deleted"=>0}}
{:doc=>1129, :weight=>2, :index=>6,
#!/bin/sh
# standard ubuntu gem pakage adds alternative for gem
# it should be removed first time
#
# update-alternatives --remove-all gem
update-alternatives --remove-all ruby
update-alternatives --install /usr/bin/ruby ruby /opt/ruby-enterprise/bin/ruby 600 \
require 'rubygems'
require 'id3lib'
$KCODE = 'u'
require 'jcode'
require 'kconv'
FOLDER = '/Users/pa/Tmp/book'
AUTHOR = 'Лем С.'
BOOK_TITLE = 'Возвращение со звезд'
@avsej
avsej / jira
Created March 16, 2010 18:19
Init script for jira
#!/bin/sh -e
# chkconfig: 345 20 80
# description: Atlassian JIRA
# init script for jira
# /etc/init.d/jira
# Define some variables
# Name of app ( JIRA, Confluence, etc )
APP=JIRA
# Name of the user to run as