Skip to content

Instantly share code, notes, and snippets.

View mkatychev's full-sized avatar
💭
Убейся в праздники! Раб, твои галеры в огне

Mikhail Katychev mkatychev

💭
Убейся в праздники! Раб, твои галеры в огне
View GitHub Profile
@mkatychev
mkatychev / yq.go
Created March 3, 2021 22:49
make yq user friendly
package yq
import (
"os"
"github.com/mikefarah/yq/v4/pkg/yqlib"
"github.com/pkg/errors"
"gopkg.in/op/go-logging.v1"
"gopkg.in/yaml.v3"
)
@mkatychev
mkatychev / geojson.proto
Created July 2, 2021 17:23
proto3 geojson protofile
syntax = "proto3";
message Data {
repeated string keys = 1; // global arrays of unique keys
// max coordinate dimensions
oneof optional_dimensions {
uint32 dimensions = 2;
}
// number of digits after decimal point for coordinates
// default: 7 for RFC 7946
@mkatychev
mkatychev / notifier.rs
Last active May 1, 2022 21:35
Notifier + OneCell
// [package]
// name = "play"
// version = "0.1.0"
// authors = ["Mikhail Katychev <[email protected]>"]
// edition = "2018"
//
// [dependencies]
// tokio = { version = "1.18.0", features = ["rt-multi-thread", "macros", "sync", "time"] }
// tracing = "0.1.34"
// tracing-subscriber = "0.3.11"
@mkatychev
mkatychev / notes.sh
Created June 19, 2022 21:22
Golang notes
# golang manual
tldr go
# vscode
tldr code
# open vscode in current terminal directory
code .
# winget
tldr winget
# winget website:
echo "https://winget.run/"
@mkatychev
mkatychev / as.rs
Created July 26, 2022 16:23
As conversion example
use std::mem::transmute;
fn main() {
let num: u32 = u32::MAX;
println!("u32: {num}");
println!("u16: {}", num as u16);
println!("i32: {}", num as i32);
println!("f32: {}", num as f32);
let bytes_u32: [u8; 4] = unsafe { transmute(num.to_be()) };
let bytes_u16: [u8; 2] = unsafe { transmute((num as u16).to_be()) };
let bytes_i32: [u8; 4] = unsafe { transmute((num as i32).to_be()) };
@mkatychev
mkatychev / mermaid.md
Last active October 28, 2022 22:35
mermaid.md

Figure 1

%%{init: {
    "fontFamily": "Times New Roman",
    'logLevel': 'debug',
    'sequence': { 
        'noteFont': 100,
        'noteMargin': 100,
 'messageFont': 100,
#[macro_export]
macro_rules! from_report {
(impl From<$from:path as $context:path> for $for:ident::$variant:ident) => {
impl From<$from> for $for {
fn from(e: $from) -> Self {
Self::$variant(error_stack::Report::new(e).change_context($context))
}
}
};
(impl From<$from:path> for $for:ident::$variant:ident) => {
@mkatychev
mkatychev / zipper_rust.md
Last active April 7, 2023 18:00
Zipper Rust

State Storage using Zipper

The Data structure used to store various states uses a cursor to traverse the nodes known as the Zipper technique.

Example of a Zipper cursor traversing a Vector, the focus provides a view "Up" and "Down" the data:

[1, 2, 3, 4, 5] // array with 5 entries
 1}[2, 3, 4, 5] // zipper starts with focues at first index
@mkatychev
mkatychev / README.md
Created June 29, 2023 13:59 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

{
"$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions",
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"definitions": {
"architecture": {
"type": "string",
"enum": [
"ARM32",
"x64",