- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
require "active_record" | |
require "disco" | |
require "elasticsearch" | |
require "searchkick" | |
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:" | |
ActiveRecord::Schema.verbose = false | |
ActiveRecord::Schema.define do | |
create_table :movies do |t| | |
t.string :name |
require "bundler/inline" | |
gemfile do | |
source "https://rubygems.org" | |
gem "activerecord", require: "active_record" | |
gem "neighbor", github: "ankane/neighbor" | |
gem "pg" | |
end |
# CREATE INDEX output omitted | |
psql:repro.sql:8: INFO: vector_l2_squared_distance | |
psql:repro.sql:8: INFO: vector_l2_squared_distance | |
psql:repro.sql:8: INFO: vector_l2_squared_distance | |
psql:repro.sql:8: INFO: vector_l2_squared_distance | |
psql:repro.sql:8: INFO: vector_l2_squared_distance | |
psql:repro.sql:8: INFO: l2_distance | |
psql:repro.sql:8: INFO: l2_distance | |
id | |
---- |
Machine: r7g.large | |
Dataset: gist-960 | |
Lists: 1000 | |
IP today | |
INFO: k-means: 46822.401 ms | |
INFO: assign tuples: 253000.270 ms | |
IP PR |
require "onnxruntime" | |
require "mini_magick" | |
img = MiniMagick::Image.open("bears.jpg") | |
pixels = img.get_pixels | |
model = OnnxRuntime::Model.new("model.onnx") | |
result = model.predict({"inputs" => [pixels]}) | |
p result["num_detections"] |
<?php | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
function getPixels($img) | |
{ | |
$pixels = []; | |
$width = imagesx($img); | |
$height = imagesy($img); | |
for ($y = 0; $y < $height; $y++) { |
require "bundler/inline" | |
gemfile do | |
source "https://rubygems.org" | |
gem "activerecord", require: "active_record" | |
gem "activejob", require: "active_job" | |
gem "sqlite3" | |
gem "searchkick", git: "https://github.com/ankane/searchkick.git" | |
end |
require "bundler/inline" | |
gemfile do | |
source "https://rubygems.org" | |
gem "activerecord", require: "active_record" | |
gem "sqlite3" | |
gem "lockbox", git: "https://github.com/ankane/lockbox.git" | |
end |
createdb pgsync_repro1 | |
createdb pgsync_repro2 | |
psql pgsync_repro1 << SQL | |
CREATE TABLE posts ( | |
id BIGINT PRIMARY KEY, | |
linked_post_id BIGINT, | |
FOREIGN KEY (linked_post_id) REFERENCES posts (id) | |
); | |
INSERT INTO posts VALUES (1, NULL), (2, 1); |