Skip to content

Instantly share code, notes, and snippets.

Avatar
✍️
I'm writing something just now! You can write me too! 😉

Vasily Kolesnikov v-kolesnikov

✍️
I'm writing something just now! You can write me too! 😉
View GitHub Profile
@v-kolesnikov
v-kolesnikov / hugofastsearch.md
Created June 22, 2022 13:52 — forked from cmod/hugofastsearch.md
Fast, instant client side search for Hugo static site generator
View hugofastsearch.md

Super fast, keyboard-optimized, client side Hugo search

This is a fork of and builds upon the work of Eddie Webb's search and Matthew Daly's search explorations.

It's built for the Hugo static site generator, but could be adopted to function with any json index compatible with Fuse fuzzy search library.

To see it in action, go to craigmod.com and press CMD-/ and start typing.

Fast Search

@v-kolesnikov
v-kolesnikov / http_streaming.md
Created May 30, 2019 17:08 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)
View http_streaming.md

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@v-kolesnikov
v-kolesnikov / ecdsa_example.rb
Created December 29, 2018 11:55 — forked from ostinelli/ecdsa_example.rb
ECDSA usage from Ruby.
View ecdsa_example.rb
require 'openssl'
require 'base64'
# ===== \/ sign =====
# generate keys
key = OpenSSL::PKey::EC.new("secp256k1")
key.generate_key
public_key = key.public_key
public_key_hex = public_key.to_bn.to_s(16).downcase # public key in hex format
@v-kolesnikov
v-kolesnikov / context.yml
Created July 10, 2018 09:44 — forked from adam12/context.yml
ERB vs Erubis vs Erubi
View context.yml
list:
- name: Adobe Systems
name2: Adobe Systems Inc.
url: http://www.adobe.com
symbol: ADBE
price: 39.26
change: 0.13
ratio: 0.33
- name: Advanced Micro Devices
name2: Advanced Micro Devices Inc.
@v-kolesnikov
v-kolesnikov / latency.txt
Created November 10, 2017 14:52 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers
--------------------------
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
View lldb_cheat_sheet.md

LLDB Cheat Sheet

A complete gdb to lldb command map.

Print out

  • Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
  • p - Print primitive type
View relation-example.rb
class Jobs < ROM::Relation[:sql]
schema(:jobs) do
# ...
associations do
belongs_to :team
belongs_to :template
belongs_to :address
belongs_to :client
end
@v-kolesnikov
v-kolesnikov / _post.md
Created April 17, 2017 10:23 — forked from klapaucius/_post.md
spine-strict_lists
View _post.md

Строгость и нищета списков.

Map и структурная рекурсия.

Применить функцию к каждому элементу списка - это просто: ###GHC/Base.lhs

map _ []     = []
map f (x:xs) = f x : map f xs
@v-kolesnikov
v-kolesnikov / env_validation.rb
Created September 18, 2016 10:16 — forked from flash-gordon/env_validation.rb
ENV validation POC
View env_validation.rb
require 'dry-validation'
class EnvValidation
class ENV
def inspect
ivs = instance_variables.each { |v| "#{v}=#{instance_variable_get(v)}" }.join(', ')
"ENV[#{ivs}]"
end
def to_s
View gist:ddc40ce87bec67a186f4057681c6a9fe
#%RAML 0.8
title: World Music API
baseUri: http://example.api.com/{version}
version: v1
schemas:
- halLink: |
{ "$schema": "http://json-schema.org/schema",
"type": "object",
"description": "a Hypertext Application Language link",