Skip to content

Instantly share code, notes, and snippets.

@chudnyi
chudnyi / cli.sh
Created October 30, 2025 12:42
Bashly CLI script demo
#!/usr/bin/env bash
# This script was generated by bashly 1.3.3 (https://bashly.dev)
# Modifying it manually is not recommended
# :wrapper.bash3_bouncer
if ((BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2))); then
printf "bash version 4.2 or higher is required\n" >&2
exit 1
fi
@chudnyi
chudnyi / .direnvrc
Last active October 23, 2025 09:48
use_ruby for direnv using chruby
# use ruby [version]
use_ruby() {
SELF_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
SELF_PATH="~${SELF_PATH#*"$HOME"}"
source $HOMEBREW_PREFIX/opt/chruby/share/chruby/chruby.sh
local ver=$1
if [[ -z "$ver" ]]; then
ruby_version_path=$(find . -type f -name ".ruby-version" -not -path "*node_modules*" | head -n 1)
if [[ -n "$ruby_version_path" ]]; then
ver=$(cat "$ruby_version_path")
@chudnyi
chudnyi / v2ray_ai_rulesets
Created October 18, 2025 19:39
v2ray_ai_rulesets пример
[
{
"type": "remote",
"tag": "geosite-claude",
"format": "binary",
"url": "https://github.com/SagerNet/sing-geosite/raw/refs/heads/rule-set/geosite-anthropic.srs",
"download_detour": "direct-out"
}
]
@chudnyi
chudnyi / _debug_find_esm.ts
Created July 26, 2024 07:25
Тестовый Deno скрипт для запуска через curl -fsSL $URL | sh
#!/usr/bin/env -S pkgx +deno.land@1.45.3 deno run -A --no-lock
import { join } from "https://deno.land/std@0.224.0/path/mod.ts";
async function findModuleDeps() {
const result: string[] = [];
const packageJson = JSON.parse(await Deno.readTextFile("./package.json"));
const dependencies = packageJson.dependencies;
for (const depName of Object.keys(dependencies)) {
@chudnyi
chudnyi / README.md
Created April 27, 2024 16:02
Deno Script Template with fixed Deno version via pkgx

The first time you run the script

  • defines the latest version of Deno
  • updates itself to replace dino@latest with deno@ with the latest version
  • deletes the content, leaving only the shebang with fixed Deno version

For example, after running, the contents of the script may become like this

#!/usr/bin/env -S pkgx deno@1.42.4 run -A
@chudnyi
chudnyi / README.md
Last active April 27, 2024 14:56
Transform docker-compose traefik labels from array to object form

Transform docker-compose traefik labels from array to object form

Usage

Download traefik-labels-yaml-array-to-object.ts.

chmod +x ./traefik-labels-yaml-array-to-object.ts
cat docker-compose-debug.yml | ./traefik-labels-yaml-array-to-object.ts

CLISpec

Установка

В macOS для установки используем скрипт

curl -fsSL https://clispec.org/install.sh | sh
@chudnyi
chudnyi / cli_manifest.yml
Last active July 23, 2023 11:53
Тестовые скрипты на разных языках
version: 1.0
description: Описание CLI интерфейса ...
options:
- name: file
type: string
description: Имя файла
env: MY_FILE
- name: force
type: boolean
optional: true
@chudnyi
chudnyi / main.ts
Last active March 10, 2023 17:32
tsyringe constructor autoInjectable playground
import "reflect-metadata";
import {autoInjectable, injectable} from "tsyringe";
@injectable()
class Database {
query(query: string) {
console.log(`Database query: ${query}`)
}
}
@chudnyi
chudnyi / .editorconfig
Created March 5, 2023 17:01
my code style test gist
# https://editorconfig.org/
root = true
[*.{ts,tsx,js,jsx,ejs.t}]
indent_size = 2
tab_width = 2
ij_continuation_indent_size = 2
ij_typescript_use_double_quotes = false
ij_html_space_inside_empty_tag = true
ij_typescript_space_before_function_left_parenth = false