Skip to content

Instantly share code, notes, and snippets.

View holyketzer's full-sized avatar

Alex Emelyanov holyketzer

View GitHub Profile

Commands examples

If the namespace is not used then the commands will perform on top of the default database. bundle exec rake db:create bundle exec rake db:migrate

By using the namespace we are going to use all the configuration for our alternate DB. bundle exec rake store:db:create bundle exec rake store:db:migrate

@holyketzer
holyketzer / latency.txt
Created December 1, 2019 10:02 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@holyketzer
holyketzer / Gemfile
Last active June 11, 2019 19:03
ActionCable logger.debug call optimisation
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", path: "../" #github: "rails/rails"
gem "benchmark-ips"
gem "kalibera"
sepal_length sepal_width petal_length petal_width species
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa
4.6 3.4 1.4 0.3 setosa
5.0 3.4 1.5 0.2 setosa
4.4 2.9 1.4 0.2 setosa
@holyketzer
holyketzer / nucleolus-three-widows-estate-problem.rb
Last active February 2, 2019 21:41
Solution of estate division problem using hydraulic idea of Marek Kaminski
# https://www.researchgate.net/publication/265440203_How_the_Talmud
# http://gaidarfund.ru/articles/1983/
require 'rspec'
# @param amount - Integer, Float: amount of estate
# @param claims - Hash: { 'name of the creditor' => amount_of_claim }
# @return - Hash: { 'name of the creditor' => payment_amount }
def solve(amount, claims)
amount_left = amount
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa
4.6 3.4 1.4 0.3 setosa
5.0 3.4 1.5 0.2 setosa
4.4 2.9 1.4 0.2 setosa
703 sex_eq
489 country_eq sex_eq
476 country_null sex_eq
416
289 interests_contains sex_eq
279 interests_any sex_eq
271 sex_eq status_neq
254 sex_eq status_eq
233 country_eq
201 city_eq sex_eq
13678 sex_eq
3787 country_eq
3654 country_null
3397 status_eq
3376 status_neq
3070 interests_contains
3039 interests_any
2190 likes_contains
1585 city_eq
1510 city_any
class CreateResourceThrottles < ActiveRecord::Migration[5.1]
def change
create_table :resource_throttles do |t|
t.string :throttle_key, null: false
t.string :resource_uid, null: false
t.boolean :active, null: false, default: false
t.index [:throttle_key, :resource_uid], unique: true
t.timestamps
MacPro Mid 2014
Intel Core i5-4278U @ 2.6 GHz
RAM 8 GB
SSD 256 GB
vs
Dell Insipion 5423 (2013)
Intel Core i5-3317U @ 1.70GHz
RAM 8 GB