Skip to content

Instantly share code, notes, and snippets.

Andrey Chernih andreychernih

Block or report user

Report or block andreychernih

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
andreychernih / Vagrantfile
Last active Aug 29, 2015
sample Vagrantfile which installs Ubuntu Trusty
View Vagrantfile
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| = "ubuntu/trusty64"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] # faster network
vb.memory = 1024
vb.cpus = 2
andreychernih / unicorn.init.erb
Created Sep 5, 2014
Monitor unicorn workers with monit
View unicorn.init.erb
export RAILS_ENV=<%= node[:application][:environment] %>
export PATH=$PATH:/usr/local/bin
APP_ROOT=<%= node[:application][:path] %>/current
PID=<%= node[:application][:path] %>/current/tmp/pids/
View tags.csv
Source Target Weight Type
video android 2 Undirected
video mediacodec 1 Undirected
video mediamuxer 1 Undirected
andreychernih / delicious_graph.rb
Last active Aug 29, 2015
Delicious tags to graph edges
View delicious_graph.rb
require 'delicious'
require 'json'
require 'csv'
TAGS_FILE = 'tags.json'
EDGES_FILE = 'tags.csv'
def get_tags
cache_tags unless File.exist?(TAGS_FILE)
andreychernih / results.txt
Created Jul 3, 2014
Ruby linear search and binary search performance testing
View results.txt
Searching for 648248 in sorted array
user system total real
linear 34.070000 0.040000 34.110000 ( 34.127835)
native binary 0.000000 0.000000 0.000000 ( 0.000203)
binary recursive 0.000000 0.000000 0.000000 ( 0.000334)
binary iterative 0.000000 0.000000 0.000000 ( 0.000258)
View roman_to_int.rb
class RomanToInt
def initialize(roman)
@roman = roman.downcase
def to_int
result = 0
roman = @roman
exceptions.each do |exception, exception_value|
View dummy_hash_map.rb
class MyHashMap
attr_reader :iterations
def initialize
@values = []
@iterations = 0
View benchmarks.rb
%i(net_http em_http typhoeus).each do |method| do |x|
(5..100).step(5) do |c|"#{method} #{c}") { send("download_#{method}", urls, c) }
View typhoeus.rb
require 'typhoeus'
def download_typhoeus(urls, concurrency)
hydra = concurrency)
urls.each do |url|
request = url
request.on_complete do |response|
write_file url, response.body
View em_http_request.rb
require 'em-http'
def download_em_http(urls, concurrency) do
multi =, concurrency).each do |url, iterator|
req =
req.callback do
write_file url, req.response
You can’t perform that action at this time.