Skip to content

Instantly share code, notes, and snippets.

View dmitryhd's full-sized avatar

Dmitry Khodakov dmitryhd

View GitHub Profile
@dmitryhd
dmitryhd / README.md
Last active April 11, 2023 14:35
atomic vs mutex M2 benchmark

Surprisingly on Apple M2 (ARM) atomic is inferior to mutex.

g++ -std=c++20 -O3 atomic_vs_mutex_cnt.cpp -pthread
python3 run_counter.py > counter_perf.csv
pip3 install pandas seaborn
python3 plot.py

see result in mutex_vs_atomic_m2_chart.png

@dmitryhd
dmitryhd / .block
Created January 24, 2023 07:17 — forked from d3noob/.block
Simple horizontal tree diagram using v4
license: mit
import time
import tqdm
import numpy as np
import multiprocessing as mp
def mix_observations(observations: np.ndarray):
indices = np.random.randint(0, len(observations), size=len(observations))
new_sample = observations[indices]
@dmitryhd
dmitryhd / colorlog.py
Last active June 27, 2019 20:55
python colored logs
class Color:
"""
https://misc.flogisoft.com/bash/tip_colors_and_formatting
https://gist.github.com/dmitryhd/68f2a71fb2832643217c17e61a78b214
"""
COLOR = '\033['
BOLD = '\033[1m'
RESET = '\033[0m'
DIM = '\e[2m'
BLINK = '\e[5m'

Testing Functions for Go

Below is a small collection of testing functions for Go. You don't need to import this as a dependency. Just copy these to your project as needed.

No, seriously. They're tiny functions. Just copy them.

import (
import sys
import os
import json
import tqdm
import pandas as pd
class LabelEncoder:
class LabelEncoder:
def __init__(self):
self._values2index = {}
self._next_index = 0
self._index2value = {}
def encode(self, value) -> int:
if value in self._values2index:
return self._values2index[value]

download conda

wget https://repo.continuum.io/archive/Anaconda3-2018.12-Linux-x86_64.sh

intall conda

bash Anaconda3-2018.12-Linux-x86_64.sh
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dmitryhd
dmitryhd / vegeta_load_test.md
Last active November 9, 2018 08:31
Vegeta POST JSON load test

To load test simple POST json

setup

brew update && brew install vegeta

Run