Skip to content

Instantly share code, notes, and snippets.

@HeCorr
HeCorr / docker-compose.yaml
Created January 26, 2025 13:09
a Docker Compose file for YugabyteDB that actually fucking works.
# To open SQL shell:
# docker exec -it yugabyte bash -c '/home/yugabyte/bin/ysqlsh -e -h $(hostname) -P null="(NULL)"'
services:
yugabyte:
image: yugabytedb/yugabyte:latest
container_name: yugabyte
restart: unless-stopped
command: bash -c 'bin/yugabyted start --advertise_address="$$(hostname -i)" --background=false'
# ^^^ required to prevent network binding errors if container's ip changes
@HeCorr
HeCorr / lib.rs
Created May 18, 2024 17:31
Basic Rust TOML Config Handler
# cargo add serde toml
pub mod config {
use serde::{Deserialize, Serialize};
use std::{fs, path::Path};
#[derive(Serialize, Deserialize)]
pub struct Config {
pub version: i8,
pub host: String,
@HeCorr
HeCorr / redigo_pool.go
Last active December 27, 2020 15:14
Redigo connection pool with AUTH and PING
// How to use:
//
// var rpool = newPool() // can be global
// c := rpool.Get()
// defer c.Close()
// c.Do("GET", "my:data")
func newPool() *redis.Pool {
return &redis.Pool{
MaxIdle: 10, // number of idle connections to keep for reusing