Skip to content

Instantly share code, notes, and snippets.

View allomov's full-sized avatar

Aliaksandr Lomau allomov

View GitHub Profile
@allomov
allomov / mixin_ruby_question.rb
Created February 20, 2012 09:18
mixin in ruby
class Parent
def hello
puts "hello from parent"
end
end
module M1
def hello
puts "hello from module 1"
end
@allomov
allomov / rvm_install_sample.sh
Created June 11, 2012 10:11
Create RVM environment (Ubuntu)
sudo apt-get install zlib1g-dev libssl-dev libsqlite3-dev libmysqlclient-dev imagemagick librmagick-ruby libxml2-dev libxslt1-dev build-essential openssl libreadline6 libreadline6-dev zlib1g libyaml-dev libsqlite3-0 sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison libpq-dev libpq5 libmysql-ruby libmysqlclient-dev
# Install RVM with ruby: https://rvm.io//rvm/install/
curl -L get.rvm.io | bash -s stable --ruby
# Install packages: https://rvm.io/packages
rvm pkg install autoconf
rvm pkg install zlib
# See this post for solving problems with readline: https://rvm.io/packages/readline/
# and use this command: rvm --skip-autoreconf pkg install readline
@allomov
allomov / install_git_from_scratch.sh
Created June 14, 2012 20:49
Install git from scratch
# Install git from (OS X version)
# use this complite script to detect OS:
# https://github.com/coto/server-easy-install/blob/master/lib/core.sh
# for OS X download and install package from here:
# http://code.google.com/p/git-osx-installer/downloads/
git config --global merge.tool opendiff
# Ignore Carp
git config --global core.excludesfile ~/.gitignore
@allomov
allomov / Gemfile
Created July 8, 2012 11:31
Installing ruby-debug19 with rvm and bundle to use it with with rails 3.2
# ...
group :development do
gem 'linecache19'
gem 'ruby-debug-base19'
gem 'ruby-debug19', :require => 'ruby-debug'
end
@allomov
allomov / netzke_apps_test_tasks.rake
Created December 17, 2012 21:10
Attempt to write rake task to test Netzke on Rails 3 and Rails 4 applications. Two in one, as they say.
# Netzke development tasks:
# Task for tests performing :
#
# test:app - run tests on all test rails applications, it will run consequentially
# `rspec spec` and `cucumber features` for each application
#
# test:app:prepare - prepare test applications for testing, EXTJS_HOME should be specified
# to be pointing on folder with necessary extjs library, in other case it will
# try to fetch it from sencha.com. It makes symbolic links to extjs folder in
# each application.

Введение

Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой OS, эти термины практически везде одинаковые и здесь они изложены в понятной для начинающих форме.

http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html

Прочесть нужно треть главы до подраздела "Starting a process", если С не пугает, читайте полностью. После прочтения вы будете понимать, что такое process, thread, mutex, priorites, semaphores, scheduler, contex-switch, kernel states.

Ruby

@allomov
allomov / c.rb
Created April 15, 2013 21:04
You can make this code work by removing the ```self``` keyword from ```public_method``` invocation.
class C
def public_method
self.private_method
end
private
def private_method; end
end
# do we need clean database before ?
cf push --command 'bundle exec rake db:drop db:create db:migrate db:seed'
cf push --command 'bundle exec rails s -p $PORT'
# also you can use
cf push --command 'bundle exec rake db:recreate; bundle exec rails s -p $PORT'

client.organizations(depth: 2) is evil.

@allomov
allomov / resize_virtual_box_disk.sh
Created October 3, 2013 11:49
How to resize a VirtualBox vmdk disk file
VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi
VBoxManage modifyhd "cloned.vdi" --resize 51200
VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk