Skip to content

Instantly share code, notes, and snippets.

View LizzyFleckenstein03's full-sized avatar
♥️

Lizzy Fleckenstein LizzyFleckenstein03

♥️
View GitHub Profile
@corarona
corarona / init.lua
Created February 12, 2022 17:20
mobtest - spawns all mobs in mcl2
math.randomseed(os.time())
minetest.register_chatcommand("mobtest",{
description="Spawns all available mobs",
privs={server=true},
func=function(n,param)
local p=minetest.get_player_by_name(n)
local pos=p:get_pos()
for k,v in pairs(minetest.registered_entities) do
if v.horny ~= nil then
local spos=vector.add(pos,vector.new(math.random(100)+10,0,math.random(100)+10))
@Kestrer
Kestrer / how-to-write-hygienic-macros.md
Created October 17, 2020 05:35
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

@guyzmo
guyzmo / nm-wifi-fzf.sh
Created May 28, 2017 09:09
Connect to Wifi networks using network manager listed by fzf
wl(){
local ssid
local conn
nmcli device wifi rescan > /dev/null
ssid=$(nmcli device wifi list | tail -n +2 | grep -v '^ *\B--\B' | fzf -m | sed 's/^ *\*//' | awk '{print $1}')
if [ "x$ssid" != "x" ]; then
# check if the SSID has already a connection setup
conn=$(nmcli con | grep "$ssid" | awk '{print $1}' | uniq)
@KodrAus
KodrAus / Profile Rust on Linux.md
Last active November 14, 2023 17:19
Profiling Rust Applications

Profiling performance

Using perf:

$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg

NOTE: See @GabrielMajeri's comments below about the -g option.