Skip to content

Instantly share code, notes, and snippets.

@shvargon
shvargon / fix.sh
Created December 15, 2024 16:56
skype linux fix
sudo snap disconnect skype:opengl
@shvargon
shvargon / diskinfo.cmd
Last active November 1, 2024 08:39
Windows Drive Serial number
@echo off
:: Проверяем, запущен ли скрипт от имени администратора
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Elevation to administrator...
powershell -Command "Start-Process '%~f0' -Verb RunAs"
exit /b
)
:: Выполнение команды
@shvargon
shvargon / .bashrc
Created August 20, 2024 15:17
Tmux ssh auto
if [[ $- =~ i ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_TTY" ]]; then
tmux new -A -s ssh_tmux
fi
@shvargon
shvargon / daemon.json
Last active May 30, 2024 03:40
docker mirror # /etc/docker/daemon.json
{
"registry-mirrors": ["https://mirror.gcr.io", "https://daocloud.io"]
}
@shvargon
shvargon / dev.ps1
Last active March 30, 2024 07:27
winget install python env
# notice create snapshot VM before continue
# git official winget install command https://git-scm.com/download/win
winget install --id Git.Git -e --source winget
winget install Python.Python.3.12
@shvargon
shvargon / Readme.md
Created January 23, 2024 06:11
Create base astra linux docker base image

Example usage

build-docker-image.sh -r http://dl.astralinux.ru/astra/frozen/1.7_x86-64/1.7.4/repository-main \
  -c 1.7_x86-64 -i alse:174-base --cache-dir $HOME/debcache
build-docker-image.sh -r http://dl.astralinux.ru/astra/frozen/1.7_x86-64/1.7.4/repository-main \
  -c 1.7_x86-64 -i alse:174-slim --cache-dir $HOME/debcache -s
build-docker-image.sh -r http://dl.astralinux.ru/astra/frozen/1.7_x86-64/1.7.4/repository-main \
  -u http://dl.astralinux.ru/astra/frozen/1.7_x86-64/1.7.4/repository-update \
  -c 1.7_x86-64 -i alse:174-update --cache-dir $HOME/debcache
build-docker-image.sh -r http://dl.astralinux.ru/astra/frozen/1.7_x86-64/1.7.4/repository-main \
@shvargon
shvargon / Dockerfile
Created October 3, 2023 06:14
opentofu creating docker image and compiling linux binary
ARG GO_VERSION=1.20
FROM golang:${GO_VERSION}-bookworm as builder
WORKDIR /app
RUN git clone --depth 1 https://github.com/opentofu/opentofu.git .
RUN go mod download && go mod verify
RUN CGO_ENABLED=0 GOOS=linux go build -v -o bin/ ./cmd/tofu
FROM scratch AS export-stage
COPY --from=builder /app/bin/tofu /
@shvargon
shvargon / join_perf_example.md
Last active September 13, 2023 03:50 — forked from yashap/join_perf_example.md
Example of how sometimes a normalized schema + joins kills performance vs. denormalizing

Normalized/join vs. denormalized/no-join performance example

An example of how sometimes you have to denormalize your schema, so that you can build compound indexes, to get acceptable performance. In some cases a normalized schema with join(s) just won't be fast enough.

Note: I think in almost all cases you should start with a normalized schema and use joins. But when you hit cases like the above, it's fine to denormalize just for these specific cases - often you'll just have one or a few such cases in your entire app, where the combination of data size/shape/queries means you cannot have efficient queries without denormalizing.

@shvargon
shvargon / Dockerfile
Created June 9, 2022 09:30
docker объяснения
# Первая стадия создание образа который копирует исходник wsdd
FROM python:3.10.5-alpine3.15 as builder
# указываем папку в которой работаем тоже самое что cd
WORKDIR /app
# ставим git
RUN apk add --no-cache git
# клонируем образ
RUN git clone --depth=1 https://github.com/christgau/wsdd.git
# вторая стадия запуск wsdd
@shvargon
shvargon / pre-commit
Last active April 21, 2020 12:37 — forked from zeenix/pre-commit
git hook to ensure commit doesn't break rustfmt
#!/usr/bin/env bash
# Put in your Rust repository's .git/hooks/pre-commit to ensure you never breaks rustfmt.
for FILE in `git diff --cached --name-only`; do
if [[ $FILE == *.rs ]] && ! rustfmt --edition=2018 --check $FILE; then
echo -e "\n Commit rejected due to invalid formatting of \"$FILE\" file."
exit 1
fi
done