Skip to content

Instantly share code, notes, and snippets.

View kirillzh's full-sized avatar
☀️

Kirill Zhukov kirillzh

☀️
View GitHub Profile
# This file is located in "robot" folder
*** Settings ***
Documentation CommonResource file with KWs
Library OperatingSystem
*** Variables ***
${SRC_PATH} ../../src/
*** Keywords ***
@kirillzh
kirillzh / quicksort.rb
Last active August 29, 2015 14:25
Quicksort on Ruby
def quicksort(array)
return [] if array.empty?
less, more, pivot = [], [], array[0]
array[1..-1].each { |x| (x <= pivot ? less : more) << x }
quicksort(less) + [pivot] + quicksort(more)
end
def recursion
raise Exception
rescue Exception
recursion
end
@kirillzh
kirillzh / files.rb
Last active August 29, 2015 14:25
Array of absolute file paths
# Recursively get absolute paths of the files with specified extension in specified directory
#
# @param ext [String] extension of the files to look for (default - any extension)
# @param pwd [String] absolute or relative path where to look for the files (default - current directory)
# @param list [Array<String>] used to recursively store absolute paths (default - [])
# @return [Array<String>] Array array of absolute paths of files in the directory with specified extension
def files(ext = '.*', pwd = Dir.pwd, list = [])
Dir[File.expand_path(File.join(pwd, '*'))].each do |path|
if File.directory?(path)
files(ext, path, list)
def deep_reject!(hash, keys)
if hash.is_a?(Hash)
Array(keys).each { |k| hash.delete(k) }
hash.values.each { |v| deep_reject!(v, keys) }
elsif hash.is_a?(Array)
hash.each { |x| deep_reject!(x, keys) }
end
hash
end
@kirillzh
kirillzh / google_trends.rb
Last active August 29, 2015 14:27
Hot trends
require 'active_support/core_ext/object/deep_dup.rb'
class Object
def deep_reject!(*keys)
if is_a?(Hash)
keys.each { |k| delete(k) }
values.each { |v| v.deep_reject!(*keys) }
elsif is_a?(Array)
each { |x| x.deep_reject!(*keys) }
end
@kirillzh
kirillzh / android_instructions.md
Created April 28, 2016 00:50 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@kirillzh
kirillzh / build-erlang-18.3.sh
Last active May 26, 2016 02:40 — forked from bryanhunter/build-erlang-17.0.sh
Build Erlang 18.3 on a fresh Ubuntu box
#!/bin/bash
# Pull this file down, make it executable and run it with sudo
# wget https://gist.githubusercontent.com/kirillzh/8f7cf870d3e67c8840f445a9fa2203b4/raw/c95e5bbdf3bed52dd4fcd4716de0e149be99f6b7/build-erlang-18.3.sh
# chmod u+x build-erlang-18.3.sh
# sudo ./build-erlang-18.3.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi
-Xms1G
-Xmx4G
-XX:MaxPermSize=2G
-XX:ReservedCodeCacheSize=240m
-XX:+UseCompressedOops
-XX:MetaspaceSize=512m