Skip to content

Instantly share code, notes, and snippets.

Vadym Motsukh begin29

Block or report user

Report or block begin29

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
@begin29
begin29 / mutex_sync_reading.rb
Created Jul 18, 2019
in line 7 sometimes will be [...true, false...] values because that is not within synchronize block (line 8)
View mutex_sync_reading.rb
mutex = Mutex.new
flags = [false, false, false, false, false, false, false, false, false, false]
threads = 50.times.map do
Thread.new do
100000.times do
puts flags.to_s
mutex.synchronize do
flags.map! { |f| !f }
end
View match_urls_in_cities.rb
def match_urls_in_cities(file_names)
cities_count = {}
file_names.each do |file_name|
File.open(file_name, "r") do |f|
f.each_line do |line|
city_name = line.match(/(.*)\t/)[0].gsub("\t", "")
cities_count[city_name] ||= 0
cities_count[city_name] += 1 if is_url_present?(line)
end
end
@begin29
begin29 / vim config
Created Mar 2, 2019
everyday using vim config
View vim config
func Backspace()
if col('.') == 1
if line('.') != 1
return "\<ESC>kA\<Del>"
else
return ""
endif
else
return "\<Left>\<Del>"
endif
@begin29
begin29 / spec_chars.rb
Last active Jul 12, 2017
list of usual special characters
View spec_chars.rb
["*", "%", "`", "-" ,"\\", "/", "[", "]", "{", "}", "&", "#", "$", "@", "!", "^", "(", ")", "'", '"', ',' ]
@begin29
begin29 / custom_pryrc.rb
Created Jun 26, 2017
custom pryrc with scratch file
View custom_pryrc.rb
load 'scratch.rb'
include Scratch
default_command_set = Pry::CommandSet.new do
command "scratch!", "reload scratch" do |str|
load 'scratch.rb'
end
end
Pry.config.commands.import default_command_set
@begin29
begin29 / js_equal.txt
Created Jun 22, 2017
how js compare statements works
View js_equal.txt
# if(statement)
https://i.stack.imgur.com/MKgie.png
#if statement1 == statement2
https://i.stack.imgur.com/5bdbd.png
#if st1 === st2
https://i.stack.imgur.com/mmvud.png
@begin29
begin29 / ubuntu_applets
Created Jun 5, 2017
list of ubuntu default programs and applets
View ubuntu_applets
# network manager applet
nm-applet
View apache_settings.sh
# add new user to apache authorization
# /etc/apache2/.htpasswd - authorization file, can be rewtitted by website
# apache configuration
sudo htpasswd /etc/apache2/.htpasswd another_user
View ruby_mini_test.sh
# run specific test
ruby my_test -n test_my_test
@begin29
begin29 / i3_settings.sh
Last active May 17, 2017
i3 related settings
View i3_settings.sh
# linux symbols
http://panmental.de/symbols/info.htm
#shows special keys matching(alt, ctrl, win)
xmodmap
# for windows, setup diff windows on start
https://faq.i3wm.org/question/243/how-do-i-use-an-exclude-regex-in-i3-config/%3C/p%3E.html
# back workspace to external monitor
You can’t perform that action at this time.