Skip to content

Instantly share code, notes, and snippets.

View bernstein7's full-sized avatar

Dmytro Kuzminov bernstein7

View GitHub Profile
@bernstein7
bernstein7 / spec_helper
Last active August 29, 2015 14:21
RSpec basics
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] = 'test'
require 'simplecov'
SimpleCov.start 'rails'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'fakeredis/rspec'
require 'sidekiq/testing'
@bernstein7
bernstein7 / cancelable.rb
Last active June 7, 2016 10:11
Sidekiq::JidStorage
require 'active_support/concern'
module Sidekiq::Cancelable
extend ActiveSupport::Concern
included do
include Redis::Objects
attr_accessor :id
value :stored_jid
@bernstein7
bernstein7 / workers_balancer.rb
Last active March 1, 2017 09:52
Module that helps to spread collection job to all available workers
# frozen_string_literal: true
module WorkersBalancer
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def balanced_perform_later(collection_ids)
collection_ids.in_groups(workers_count).each do |ids_group|
@bernstein7
bernstein7 / gist:53f6615788b788c5c6f87f7a61ba92c5
Created June 21, 2017 13:55
Attach docker-machine to existing VPS machine
docker-machine create \
--driver=generic \
--generic-ip-address=IP_ADDRESS \
--generic-ssh-user=USERNAME \
--generic-ssh-key=PATH_TO_SSH_KEY \
--generic-ssh-port=PORT \
MACHINE_NAME
#!/usr/bin/env ruby
require 'net/http'
require 'json'
require 'csv'
uri = URI('https://raw.githubusercontent.com/db1000n-coordinators/LoadTestConfig/main/config.v0.7.json')
response = Net::HTTP.get(uri)
data = JSON.parse(response)
# frozen_string_literal: true
module ActiveAdmin
class BatchTableFor < ActiveAdmin::Component
class SelectableIndexTable < ActiveAdmin::Views::TableFor
def selectable_column
column resource_selection_toggle_cell, class: "col-selectable", sortable: false do |resource|
resource_selection_cell resource
end
end
@bernstein7
bernstein7 / engine_deploy.py
Created August 1, 2024 16:23
vLLM engine deployment
import ray
from typing import List, Union, AsyncGenerator
from vllm import EngineArgs, LLMEngine
from vllm.engine.arg_utils import AsyncEngineArgs
from vllm.engine.async_llm_engine import AsyncLLMEngine
from vllm.entrypoints.openai.protocol import (
ChatCompletionRequest,
ChatCompletionResponse,
ChatCompletionToolsParam,
FunctionDefinition,