Skip to content

Instantly share code, notes, and snippets.

View lyosha85's full-sized avatar
:octocat:
I may be slow to respond.

Alex lyosha85

:octocat:
I may be slow to respond.
  • Canada
  • 00:48 (UTC -07:00)
View GitHub Profile
rails c
require 'sidekiq/api'
Sidekiq::Queue.all
mailers = Sidekiq::Queue.new("mailers")
mailers.size
mails.each {|job| job.inspect }
mailers.each { |job| job.delete if job.jid == 'asdf' }
mailers.latency
mailers.find("asdf2")
mailers.clear
@lyosha85
lyosha85 / Gemfile
Created March 29, 2020 01:01
Sidekiq with web interface and no retry
source 'https://rubygems.org'
gem 'sidekiq'
gem 'rack'
gem 'sinatra'
@lyosha85
lyosha85 / worker.rb
Created March 28, 2020 17:48
[Sidekiq 001.2] Installation and First Job - DailyDrip
# worker.rb
require 'sidekiq'
Sidekiq.configure_client do |config|
config.redis = {db: 1 }
end
Sidekiq.configure_server do |config|
config.redis = {db: 1 }
end
### Keybase proof
I hereby claim:
* I am lyosha85 on github.
* I am aktg (https://keybase.io/aktg) on keybase.
* I have a public key ASA-6j5OeDQMGKQT7bMxrfd5KnsUVyut9QY1sObLThkG0go
To claim this, I am signing this object:
@lyosha85
lyosha85 / gist:482f9dfada20468111041cb19b3488de
Created March 13, 2018 06:32 — forked from alex-zige/gist:5795358
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@lyosha85
lyosha85 / install.sh
Created August 28, 2016 03:28 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@lyosha85
lyosha85 / gist:d9416c0ead07c4f683365311af2e3e7d
Last active August 27, 2016 05:30
prep ubuntu docker vps
sudo apt-get update
sudo apt-get upgrade
sudo apt-get update
# If running older version of ubuntu
## remove unused kernels
sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
sudo apt-get dist-upgrade
sudo apt-get install update-manager-core
@lyosha85
lyosha85 / gist:7be38911d731ea2532f346a12a9e7f78
Created August 21, 2016 20:58
Deploy Rails VPS Ubuntu 14.04 with Nginx, Puma, Capistrano3, PostgreSQL, RVM.
VPS
===
root# apt-get update
root# apt-get upgrade
root# adduser deployer
root# gpasswd -a deployer sudo
root# nano /etc/ssh/sshd_config
root# PermitRootLogin no
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end