Skip to content

Instantly share code, notes, and snippets.

services:
excalidraw:
image: vbogretsov/excalidraw:0.18
restart: on-failure
ports:
- 8000:80
environment:
- VITE_APP_BACKEND_V2_GET_URL=https://storage/api/v2/scenes/
- VITE_APP_BACKEND_V2_POST_URL=https://storage/api/v2/scenes/
- VITE_APP_WS_SERVER_URL=http://room/
@vbogretsov
vbogretsov / docker-compose.override.yml
Last active January 11, 2024 09:37
Local volume mount for virtualenv
services:
app:
volumes:
- venv:/opt
volumes:
venv:
driver: local
driver_opts:
type: none
@vbogretsov
vbogretsov / Dockerfile
Created April 29, 2023 08:42
python docker
ARG PYTHON_VERSION=3.11
ARG ALPINE_VERSION=3.17
ARG POETRY_VERSION=1.3.2
ARG DEVBUILD
FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} as build
ARG ALPINE_VERSION
ARG POETRY_VERSION
ARG DEVBUILD
RUN echo https://mirror.yandex.ru/mirrors/alpine/v${ALPINE_VERSION}/main > /etc/apk/repositories
@vbogretsov
vbogretsov / ca.md
Created February 28, 2023 19:35 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@vbogretsov
vbogretsov / docker-compose.yml
Created December 21, 2022 21:56
PostgreSQL in docker compose
version: '3.8'
services:
postgres:
# image: postgres:10.18-alpine
image: postgres:13.4
restart: "no"
# Performance tuning by http://pgtune.leopard.in.ua
# DB Version: 10
# OS Type: linux
@vbogretsov
vbogretsov / pkgsrc.sh
Last active April 21, 2023 08:16
pkgsrc
cd $pkgsrc/bootstrap
OSX_SDK_PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk ./bootstrap --unprivileged --full --prefix=/opt/pkg --varbase /opt/pkg/var --make-jobs=10 --prefer-native=yes
# set in /opt/pkg/etc/mk.conf
# OSX_SDK_PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
# MAKE_JOBS=10
# cyrus-sasl
cd $pkgsrc/net/libfetch
@vbogretsov
vbogretsov / heap.go
Created March 24, 2022 07:28
Indexed priority queue
package heap
import (
"math"
)
type Interface interface {
Len() int
Less(i, j int) bool
Swap(i, j int)
@vbogretsov
vbogretsov / tx.go
Created August 17, 2021 19:04
Gorm transaction wrapper
type GormTx struct {
stack []*gorm.DB
open int
clos int
}
func NewTransaction(db *gorm.DB) *GormTx {
return &GormTx{
stack: []*gorm.DB{db},
open: 0,
@vbogretsov
vbogretsov / totalmem
Created August 9, 2021 09:31
Get total memory on a linux host
free -m | grep Mem | awk '{print $2}'
@vbogretsov
vbogretsov / redis-maxmem
Last active August 9, 2021 13:03
Get maxmemory configured on redis host
redis-cli -p $1 -a $(grep -Po '(?<=^masterauth\s).*' ${2:-/etc/redis.conf} | sed 's/^\"//g' | sed 's/\"$//g') info | grep maxmemory_human