Skip to content

Instantly share code, notes, and snippets.

View oleksiilevzhynskyi's full-sized avatar

Oleksii Levzhynskyi oleksiilevzhynskyi

View GitHub Profile
sudo apt-get install unzip;
wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:896b2a2921e38d233c73
Last active August 29, 2015 14:16
MARS ROVERS PROBLEM
MARS ROVERS PROBLEM
A squad of robotic rovers are to be landed by NASA on a plateau on Mars. This plateau, which is curiously rectangular, must be navigated by the rovers so that their on-board cameras can get a complete view of the surrounding terrain to send back to Earth.
A rover's position and location is represented by a combination of x and y co-ordinates and a letter representing one of the four cardinal compass points. The plateau is divided up into a grid to simplify navigation. An example position might be 0, 0, N, which means the rover is in the bottom left corner and facing North.
In order to control a rover, NASA sends a simple string of letters. The possible letters are 'L', 'R' and 'M'. 'L' and 'R' makes the rover spin 90 degrees left or right respectively, without moving from its current spot. 'M' means move forward one grid point, and maintain the same heading.
Assume that the square directly North from (x, y) is (x, y+1).
rails 3.1 java runtime error
gem 'execjs'
gem 'therubyracer'
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1146869
Created August 15, 2011 14:32
Failed to build gem 'nokogiri' native extension.
sudo apt-get install libxslt1-dev
libxml, libxml-dev, libxslt, libzslt-dev
SHOW DATABASES; - список баз данных
SHOW TABLES [FROM db_name]; - список таблиц в базе
SHOW COLUMNS FROM таблица [FROM db_name]; - список столбцов в таблице
SHOW CREATE TABLE table_name; - показать структуру таблицы в формате "CREATE TABLE"
SHOW INDEX FROM tbl_name; - список индексов
SHOW GRANTS FOR user [FROM db_name]; - привилегии для пользователя.
SHOW VARIABLES; - значения системных переменных
SHOW [FULL] PROCESSLIST; - статистика по mysqld процессам
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1186087
Created September 1, 2011 12:41
Removing rvm
rvm implode
rm ~/.rvmrc
curl -s https://rvm.beginrescueend.com/install/rvm -o rvm-installer ; chmod +x rvm-installer ; ./rvm-installer --version 1.8.0
;
rvm implode
gem uninstall rvm
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1205996
Created September 9, 2011 11:39
has_many through polymorfic
class Widget < ActiveRecord::Base
has_many :widget_groupings
has_many :people, :through => :widget_groupings, :source => :grouper, :source_type => 'Person'
has_many :aliens, :through => :widget_groupings, :source => :grouper, :source_type => 'Alien'
end
class Person < ActiveRecord::Base
has_many :widget_groupings, :as => grouper
has_many :widgets, :through => :widget_groupings
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1207023
Created September 9, 2011 18:52
ppa for sublime-text-2
sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text-2
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1230077
Created September 20, 2011 19:28
Hot keys in terminal
ctrl+a or Home - Moves the cursor to the start of a line.
ctrl+e or End - Moves the cursor to the end of a line.
ctrl+b - Moves to the beginning of the previous or current word.
ctrl+k - Deletes from the current cursor position to the end of the line.
ctrl+u - Deletes the whole of the current line.
ctrl+w - Deletes the word before the cursor.
@oleksiilevzhynskyi
oleksiilevzhynskyi / gist:1259158
Created October 3, 2011 13:59
Problem with blame in TextMate
mkdir -p /Library/Application\ Support/TextMate/Bundles
cd !$
git clone git://github.com/timcharper/git-tmbundle.git Git.tmbundle
osascript -e 'tell app "TextMate" to reload bundles'
Ctr+Shift+G => blame
enjoy!