Skip to content

Instantly share code, notes, and snippets.

View virtualritz's full-sized avatar
🦀
Rustacean – backend/desktop apps/2D & 3D graphics

Moritz Mœller virtualritz

🦀
Rustacean – backend/desktop apps/2D & 3D graphics
View GitHub Profile

theritz

Keybase proof

I hereby claim:

  • I am virtualritz on github.
  • I am theritz (https://keybase.io/theritz) on keybase.
  • I have a public key ASDOHUrdRjyKEwcX0YtXMaTFqdxlRHLCCJbSGmtN9er_-Ao

To claim this, I am signing this object:

@virtualritz
virtualritz / building_rust_wrappers_on_docs_rs.md
Last active April 22, 2022 17:38
Making Rust FFI Wrapper Crates Build on Docs.rs

TLDR;

Check for env::var("DOCS_RS") in your build.rs and omit linking if it is set.

Where to find this: read the complete About section on docs.rs.

Long Version

If you’ve written wrapper crates, e.g. using bindgen, you may have ran into this. You have:

@virtualritz
virtualritz / next_friday.rs
Last active April 19, 2022 12:12
Find the next Friday from today in Rust
use chrono::{offset::Utc, Datelike, Duration}; // 0.4.19
fn main() {
let today_naive = Utc::today()
.naive_utc()
.checked_add_signed(Duration::days(0))
.unwrap();
let num_days_from_monday = today_naive.weekday().num_days_from_monday();
@virtualritz
virtualritz / fix-broken-cpp-tooling-ubuntu.md
Last active September 13, 2024 13:51
Fixing a broken C/C++ tooling on Ubuntu

Fixing Broken C/C++ Tooling on Ubuntu

Here we're assuming you want to have gcc versions 13 & 14 and clang versions 16 & 17 installed side by-side. Adjust to the versions you're installing.

You may also wish to adjust the priority (the last number in the update-alternatives commands below). A higher number means a higher priority.