Skip to content

Instantly share code, notes, and snippets.

-- Read the docs: https://www.lunarvim.org/docs/configuration
-- Example configs: https://github.com/LunarVim/starter.lvim
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny
-- Enable powershell as your default shell
vim.opt.shell = "pwsh.exe"
vim.opt.shellcmdflag =
"-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;"
// xdg_direnv.go
// Package xdg is a minimal implementation of the XDG specification.
//
// https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
package xdg
import (
"path/filepath"
)
#[derive(Debug, Clone)]
pub struct BufferRequestBody(pub Bytes);
// we must implement `FromRequest` (and not `FromRequestParts`) to consume the body
#[async_trait]
impl<S> FromRequest<S> for BufferRequestBody
where
S: Send + Sync,
{
type Rejection = Response<Body>;
@nwisemanII
nwisemanII / client.rs
Created December 8, 2023 16:59
No memory?
use once_cell::sync::Lazy;
use crate::{ instrument, debug, Error, events::WebhookEvent };
use surrealdb::engine::remote::ws::{Ws, Client};
use surrealdb::opt::auth::Root;
use surrealdb::sql::Thing;
use surrealdb::Surreal;
const DB_ADDRESS: &'static str = "ws://127.0.0.1:8000";
@nwisemanII
nwisemanII / telemetry.rs
Created December 5, 2023 07:43
Otel Logs to Loki Setup
// https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-otlp/examples/basic-otlp/src/main.rs
const LOGS_ENDPOINT: &str = "http://localhost:55680";
const COLLECTOR_ENDPOINT: &str = "http://localhost:4317";
const METRICS_ENDPOINT: &str = "http://localhost:4317";
// use env_logger::Logger;
// use log::logger;
// use color_eyre::eyre::Error;
use opentelemetry::global::{GlobalLoggerProvider, GlobalTracerProvider, GlobalMeterProvider};
@nwisemanII
nwisemanII / main.rs
Created December 1, 2023 22:42
Tracing + Opentelemetry_OTLP
mod telemetry;
use tracing::{ info, instrument, Level };
use telemetry::initialize;
// use tracing_subscriber::prelude::*;
#[instrument]
fn one() {
println!("one")
}
#[tokio::main]
@nwisemanII
nwisemanII / cargo.toml
Last active November 29, 2023 16:04
Help With Tower + GRPC
[package]
name = "simple_ti"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "simple_ti"
path = "src/client.rs"
@nwisemanII
nwisemanII / main.rs
Last active November 15, 2023 14:31
Rust Message bus
#![allow(unused)]
use std::collections::HashMap;
use std::collections::VecDeque;
use std::thread::JoinHandle;
use tokio::sync::Mutex; use std::sync::Arc;
type MessageQueue = VecDeque<Message>;
type MailboxMap = HashMap<String, MessageQueue>;