Skip to content

Instantly share code, notes, and snippets.

View melekes's full-sized avatar

Anton Kaliaev melekes

View GitHub Profile
@melekes
melekes / do_monad.erl
Last active December 27, 2019 08:47
Erlang snippets
-spec do(any(), [fun((...) -> any())]) -> any().
do(Arg, []) ->
Arg;
do(Arg, [Fun | Funs]) ->
case Fun(Arg) of
{error, Data} ->
Data;
Data ->
do(Data, Funs)
@melekes
melekes / latency.txt
Created December 2, 2015 09:17 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
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
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@melekes
melekes / README.md
Last active August 11, 2016 11:28
How to learn any language in six months | Chris Lonsdale | TEDxLingnanUniversity

https://www.youtube.com/watch?v=d0yGdNEWdn0

Краткое содержание

Принципы:

  1. Фокусируйте внимание на контенте, имеющем для вас какое-то значение
  2. Используйте язык как средство для коммуникации начиная с первого дня
  3. Если вы сначала поймёте то, что вам хотели сказать, то вы начинаете овладевать языком бессознательно (comprehensive input)
  4. Изучение нового языка - это также тренировка тела (правильное произношение зависит от мышц)
@melekes
melekes / property-based-testing-tools.md
Last active May 15, 2021 11:38 — forked from npryce/property-based-testing-tools.md
Property-Based Testing Tools

Keybase proof

I hereby claim:

  • I am melekes on github.
  • I am melekes (https://keybase.io/melekes) on keybase.
  • I have a public key ASA1kz6kxvacyRSjua9gxErX7nt2n46FvBFB-OfWYp572go

To claim this, I am signing this object:

// addOrMax performs safe addition: if result overflows, it returns MaxUint64
func addOrMax(accum, value uint64) uint64 {
if (accum + value) < accum {
return math.MaxUint64
} else {
return accum + value
}
}
// subOrZero performs safe subtraction: if result underflows, it returns 0
[Unit]
Description=Counter
Requires=network-online.target
After=network-online.target
[Service]
Environment=""
Restart=on-failure
User={{ user }}
Group={{ group }}
@melekes
melekes / upgrade_tendermint.yml
Last active April 24, 2017 20:53
Ansible playbook for upgrading Tendermint
---
- hosts: all
tasks:
- name: get version
shell: tendermint version
register: version
- name: copy and unpack binary if newer version is being installed
@melekes
melekes / twopy.py
Last active July 21, 2017 06:04 — forked from hellosteadman/twopy.py
Add your Twitter friends' RSS feeds to a single OPML file
# -*- coding: utf-8 -*-
"""
This script requires the following Packages
1: Twitter: https://pypi.python.org/pypi/twitter
2: PyQuery: https://pypi.python.org/pypi/pyquery
3: Jinja2: https://pypi.python.org/pypi/Jinja2
It's fairly primitive but works. It uses a Jinja2 template to create an OPML
file from the RSS feeds of the websites run by the people you follow on
@melekes
melekes / badger_db.go
Last active January 30, 2019 11:55
Alternative databases, which were used to benchmark Tendermint indexing
package db
import (
"bufio"
"io"
"os"
"sync"
"github.com/dgraph-io/badger"
)