Skip to content

Instantly share code, notes, and snippets.

View simonsan's full-sized avatar
🦀
Let's listen to this cassette on my rusty tapedeck. Drops ICE.

simonsan

🦀
Let's listen to this cassette on my rusty tapedeck. Drops ICE.
View GitHub Profile
@simonsan
simonsan / how-to-write-hygienic-macros.md
Created November 28, 2020 16:21 — forked from Kestrer/how-to-write-hygienic-macros.md
A guide on how to write hygienic Rust macros

How to Write Hygienic Rust Macros

Macro hygiene is the concept of macros that work in all contexts; they don't affect and aren't affected by anything around them. Ideally all macros would be fully hygienic, but there are lots of pitfalls and traps that make it all too easy to accidentally write unhygienic macros. This guide attempts to provide a comprehensive resource for writing the most hygienic macros.

Understanding the Module System

First, a little aside on the details of Rust's module system, and specifically paths; it is

@simonsan
simonsan / secrecy.rs
Created October 17, 2020 01:47 — forked from benma/secrecy.rs
use secrecy::{ExposeSecret, Secret};
#[derive(Debug)]
struct EncryptionKey(Secret<[u8; 32]>);
fn get_encryption_key() -> EncryptionKey {
let key = EncryptionKey(Secret::new(*b"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
println!("Pointer at creation: {:p}", key.0.expose_secret().as_ptr());
key
}
@simonsan
simonsan / python_boilerplate.py
Created September 4, 2020 05:09 — forked from ssokolow/python_boilerplate.py
The raw/initial output from "boiler" in my ~/.vim/snippets/python.snippets
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""[application description here]"""
# Prevent Python 2.x PyLint from complaining if run on this
from __future__ import (absolute_import, division, print_function,
with_statement, unicode_literals)
__author__ = "Stephan Sokolow (deitarion/SSokolow)"
__appname__ = "[application name here]"
@simonsan
simonsan / settings_menu_entries.md
Last active April 13, 2019 20:01 — forked from heinezen/settings_menu_entries.md
Documentation about the possible menu entries in the OpenAge Settings.

Settings Menu Entries for OpenAge

Bold: Options from HD, UserPatch and Voobly

Italic: Options that will likely be in OpenAge

Normal: Nice-to-have features

General Game Settings