Skip to content

Instantly share code, notes, and snippets.

View olegykz's full-sized avatar
💭
🇺🇦

Oleg Yakovenko olegykz

💭
🇺🇦
View GitHub Profile
@olegykz
olegykz / vk_comments_scraper.rb
Created February 19, 2024 16:32
Super dirty script which does its job: grabs all the comments & posts from specified user in particular group
require 'pry'
require 'vkontakte_client'
require 'cgi'
require 'watir'
CLIENT_ID = 1234567
l = Logger.new("#{Time.now.to_i}.log")
redirect_uri = CGI.escape('https://oauth.vk.com/blank.html')
#!/usr/bin/env ruby
require 'watir'
require 'logger'
require 'pry'
require 'telegram/bot'
TOKEN = '<TG_TOKEN>'
CHAT_ID = -12345678
@olegykz
olegykz / cleanup_script.rb
Created July 1, 2019 10:38
Cleaning up resque enqueued jobs with a specific arguments
# taken from https://stackoverflow.com/a/46003664/1300195
queue_name = 'my_queue'
jobs = Resque.data_store.peek_in_queue(queue_name, 0, 500_000);
deleted_count = 0
jobs.each do |job|
decoded_job = Resque.decode(job)
if decoded_job['class'] == 'ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper' &&
decoded_job['args'].first.fetch('job_class') == 'MyClass'

Keybase proof

I hereby claim:

  • I am olegykz on github.
  • I am olegykz (https://keybase.io/olegykz) on keybase.
  • I have a public key ASAvG5YrqKDgV2Cg6CmhCdUT_EUKVw5dg6D_3Amd1Difbgo

To claim this, I am signing this object:

@olegykz
olegykz / arabic.out
Last active June 13, 2017 07:01
one-line roman to arabic number converter, just for fun
R1: 1, R2: 1
R1: 2, R2: 2
R1: 3, R2: 3
R1: 4, R2: 4
R1: 5, R2: 5
R1: 6, R2: 6
R1: 7, R2: 7
R1: 8, R2: 8
R1: 9, R2: 9
R1: 10, R2: 10
# dump
# Betaflight / SPRACINGF3 3.1.7 Apr 3 2017 / 22:27:23 (e1c4b5c)
name -
resource BEEPER 1 C15
resource MOTOR 1 A06
resource MOTOR 2 A07
resource MOTOR 3 A11
resource MOTOR 4 A12
resource MOTOR 5 B08
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@olegykz
olegykz / memory_consumption.rb
Created August 26, 2015 13:05
Check gems memory consumption and load time
require 'benchmark'
def require_and_profile(gemname = nil)
unless gemname
puts "%-20s: %10s | %10s | %10s" % ['gem','increment','total','time']
return
end
# checked on procps-ng (ps) version 3.3.3 and 3.3.9
memory_usage = `ps -o rss= -p #{Process.pid}`.to_i / 1024.0
@olegykz
olegykz / rails.rake
Created March 27, 2015 10:51
Capistrano 3 useful tasks to open ssh session and rails console
namespace :rails do
desc 'Open a rails console `cap [staging] rails:console [server_index default: 0]`'
task :console do
on roles(:app) do |server|
return if server != roles(:app)[ARGV[2].to_i]
puts "Opening a console on: #{host}...."
cmd = "ssh #{fetch(:ssh_options)[:user]}@#{host} -t 'source \"$HOME/.rvm/scripts/rvm\""\
" && cd #{fetch(:deploy_to)}/current && RAILS_ENV=#{fetch(:rails_env)} bundle exec rails console'"
[user]
name = ****
email = ****
[github]
user = ****
token = ****
[color]
branch = auto
diff = auto
status = auto