Skip to content

Instantly share code, notes, and snippets.

@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