Skip to content

Instantly share code, notes, and snippets.

@leiter-jakab
leiter-jakab / client.rs
Created December 29, 2020 09:57
Client and server talking to each other with godot-rust
use gdnative::prelude::*;
use gdnative::api::NetworkedMultiplayerENet;
#[derive(NativeClass)]
#[inherit(Node)]
pub struct ServerPuppet {
address: String,
port: i64,
in_bandwidth: i64,
out_bandwidth: i64,
@leiter-jakab
leiter-jakab / main.rs
Last active December 26, 2020 12:25
Cacher implementation in Rust
use std::collections::{HashMap, hash_map::DefaultHasher};
use std::hash::{Hash, Hasher};
use std::fmt::Display;
fn main() {
let mut c: Cacher<u32, u32> = Cacher::new(|x| x);
let v = c.value(3);
println!("uncached value is: {}", v);
let v = c.value(3);
println!("cached value is: {}", v);
@leiter-jakab
leiter-jakab / glibc-in-alpine-docker
Created December 1, 2020 19:22 — forked from larzza/glibc-in-alpine-docker
Install glibc in Alpine docker image
RUN apk --no-cache add \
wget \
ca-certificates \
libstdc++
# Get and install glibc for alpine
ARG APK_GLIBC_VERSION=2.29-r0
ARG APK_GLIBC_FILE="glibc-${APK_GLIBC_VERSION}.apk"
ARG APK_GLIBC_BIN_FILE="glibc-bin-${APK_GLIBC_VERSION}.apk"
ARG APK_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${APK_GLIBC_VERSION}"
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \