Skip to content

Instantly share code, notes, and snippets.

View vovayartsev's full-sized avatar

Vladimir Yartsev vovayartsev

View GitHub Profile

Keybase proof

I hereby claim:

  • I am vovayartsev on github.
  • I am vovayartsev (https://keybase.io/vovayartsev) on keybase.
  • I have a public key whose fingerprint is 0545 FA5B 7619 920A FDA3 DC8D 4517 0EDB 7F86 3E6E

To claim this, I am signing this object:

@vovayartsev
vovayartsev / tasks.json
Created August 4, 2021 13:15
VSCODE test runner
{
"version": "2.0.0",
"tasks": [
{
"label": "mix test",
"type": "shell",
"command": "mix",
"args": [
"test",
"--color",
gistup
defmodule Core.Ecto.QueryStream do
@batch_size 200
import Ecto.Query
def from_query(query, where_fn, repo) do
Stream.resource(
fn -> nil end,
fn
nil -> query |> fetch_items_and_acc(repo)
last_item -> query |> where_fn.(last_item) |> fetch_items_and_acc(repo)
# BENCHMARK for kNN via PG CUBES
# DB SETUP:
# CREATE extension cube;
# CREATE TABLE test_cubes AS
# SELECT i AS id,
# cube(array[
# random() * 10000 - 5000,
# random() * 10000 - 5000,
- General
[ ] The code works
[ ] The code is easy to understand
[ ] Follows coding conventions
[ ] Names are simple and if possible short
[ ] Names are spelt correctly
[ ] Names contain units where applicable
[ ] There are no usages of 'magic numbers'
[ ] Design patterns if used are correctly applied
[ ] Law of Demeter is not violated
@vovayartsev
vovayartsev / array_extensions.rb
Created January 5, 2018 20:56
DIY Array#flatten
module ArrayExtensions
refine Array do
def my_flatten
flat_enumerator.to_a
end
private
def flat_enumerator
Enumerator.new do |out|
@vovayartsev
vovayartsev / main.tf
Last active August 19, 2017 18:44
Terraform stack example
#cloud-config
coreos:
units:
- name: metabase.service
command: start
enable: true
content: |
[Unit]
Description=Metabase analytics dashboard
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
aproba@^1.0.3:
version "1.1.2"
heroku dh:docker run jordi/ab ab -n 10000 -c 100 https://performance-test-app.herokuapp.com/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking performance-test-app.herokuapp.com (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests