Skip to content

Instantly share code, notes, and snippets.

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

Mikhail Katychev mkatychev

💭
Убейся в праздники! Раб, твои галеры в огне
View GitHub Profile
@mkatychev
mkatychev / telemetry.md
Last active April 24, 2025 21:51
telemetry.md

Telemetry

What is OpenTelemetry?

OpenTracing   == traces            ( jaeger/tokio-tracing )
OpenCensus    == metrics           ( grafana/prometheus   )
OpenTelemetry == traces && metrics ( et al.               )
@mkatychev
mkatychev / nvim-fmt-buf.lua
Last active December 11, 2024 21:46
Tiny Neovim buffer formatter in lua
local read_buf = function(bufnr)
local bufin = table.concat(vim.api.nvim_buf_get_lines(bufnr, 0, -1, true), "\n")
if vim.api.nvim_get_option_value("eol", { buf = bufnr }) then bufin = bufin .. "\n" end
return bufin
end
local format_buf = function(fmt_cmd)
-- exit early if buffer is not writeable
if vim.bo.modifiable == false or vim.bo.readonly == true then return end
-- save cursor position
@mkatychev
mkatychev / shoe_tray_leg.scad
Created October 17, 2024 14:23
shoe_tray_leg
$fn = 48;
function line(point1, point2, width = 1) =
let(angle = 90 - atan((point2[1] - point1[1]) / (point2[0] - point1[0])))
let(offset_x = 0.5 * width * cos(angle), offset_y = 0.5 * width * sin(angle))
let(offset1 = [-offset_x, offset_y], offset2 = [offset_x, -offset_y])
@mkatychev
mkatychev / record.rs
Created September 7, 2024 23:04
`record!` macro
#[macro_export]
macro_rules! record {
($($fields:tt)+) => {
let fieldset = tracing::fieldset!($($fields)+);
$crate::valueset!(fieldset, $($fields)+);
};
}
#[macro_export]
macro_rules! valueset {
include <relativity.scad/relativity.scad>
$fn = 20;
module base() {
minkowski() {
box([30, 80, 4]);
cylinder(0.5, r = 4);
}
}
@mkatychev
mkatychev / stream_cancel.rs
Last active April 12, 2024 02:04
Cancellable stream draft
use std::{future::Future, time::Duration};
use bigerror::{LogError, NetworkError, OptionReport, Report, ReportAs, ResultExt};
use futures::{future, pin_mut};
use stream_cancel::TakeUntilIf;
use tokio::{
sync::mpsc::{UnboundedSender, WeakUnboundedSender},
task::JoinHandle,
};
use tokio_stream::wrappers::UnboundedReceiverStream;
@mkatychev
mkatychev / ffmpeg_concat_and_scale.sh
Last active March 22, 2024 18:57
Concatenate and convert differently sized videos into one
#!/usr/bin/env bash
join_files() {
local input_n=()
local scale_to_n=("$SEP")
local concat_n=()
for i in $(seq $#); do
input_n+=("-i ${!i}")
((n = i - 1))
@mkatychev
mkatychev / github_default.md
Created February 8, 2024 16:53
Default GITHUB actions variables quickref

Quickref

Variable Description Example
CI Always set to true
GITHUB_ACTION The name of the action currently running
GITHUB_ACTION_PATH The path where an action is located, only supported in composite actions. /home/runner/work/_actions/repo-owner/name-of-action-repo/v1
GITHUB_ACTION_REPOSITORY The owner and repository name of the action. actions/checkout
GITHUB_ACTIONS Always set to true when GitHub Actions is running the workflow.
GITHUB_ACTOR The name of the person or app that initiated the workflow. octocat
{
"$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",
@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: