Skip to content

Instantly share code, notes, and snippets.

View est31's full-sized avatar

est31

View GitHub Profile

Postfix macros in Rust

The problem

Rust has many postfix combinators, for example the .unwrap_or(x) and .unwrap_or_else(|| x) functions. They are useful if you want to extract some value from an optionally present value, or if not, provide an alternative value. It's really nice and tidy to read:

Announcing cargo-udeps

One of the biggest issues that most people have with Rust are the long compile times. One of the reasons why compile times are so long is because many projects use quite a few dependencies from crates.io. Your dependencies have dependencies of their own, and they in turn have dependencies as well, and so on. This results in really big graphs of crates that all have to be compiled by cargo. Sometimes however, a crate actually doesn't use anything of some of its dependencies. Then those dependencies can be removed, resulting in faster builds for that crate. But how do you detect them? Often they sit in Cargo.toml for a long time until someone discovers they are actually unused and removes them (example). This is where cargo-udeps comes in. cargo-udeps is an automated tool to find dependencies that were specified in Cargo.toml but never used in the cra

Beyond librispeech: About the amount of spoken content stored in Librivox

Overview

Given that LibriVox contains enough of english content for a speech processing corpus, LibriSpeech, to be built from it, I've wondered how much content LibriVox has in languages other than English.

I've downloaded the JSON API contents of Librivox, separated the audiobooks according to their language, and summed up their lengths, obtaining a language breakdown expressed in spoken time.

This gave results of over 60 thousand hours for english, thousands of hours each for German, Dutch, French, Spanish, and hundreds of hours for other languages.

Trying to deploy WPA3 on my home network

Introduction

Recently, news broke about a new possible offline attack on WPA2 using PMKID. To summarize the attack, WPA2 protected APs can end up broadcasting PMKID values which can then be used to offline-brute-force the password.

These PMKID values are computed this way:

PMKID = HMAC-SHA1-128(PMK, "PMK Name" | MAC_AP | MAC_STA)

Looking back and looking forward -- Rust in 2017 and 2018

Recently, there had been a call for blog posts reflecting 2017 and about which path Rust should choose in 2018.

First a few words about me. I was and still am a student, and most of my coding is for learning and because it is fun. Also, coding is a great excuse for procrastinating something more important :). Having contributed to open source codebases has helped me determine that I want to do this in a day job once I'm done with my studies.

I've heard about Rust somewhere around the 1.0 release in 2015. I don't know the details any more, but most likely it was a German tech news website. I've then read on about what Rust is and its promises like zero cost abstractions, fearless concurrency or the concept of safety really stood out. My background was C++ so I also quite liked the syntax. A bit later I decided to read the the book (first edition, back then

@est31
est31 / openproject_wiki_extractor.md
Last active January 28, 2016 04:08
How to extract wiki pages from openproject and to bring them into more suitable format.

Exporting openproject wiki files

The following guide explains how to export an openproject wiki to somewhat readable openproject syntax-ed files.

The guide assumes you are running in bash shell, and can use GNU sed, and that you have the sqlite3 command utility installed.

Following UN*X philosophy, all commands should be silent and have no stdout. If you get something printed to stdout there is an error.

Part 0: Preparation

@est31
est31 / Releasing_godot_for_fdroid.md
Last active September 27, 2018 11:41
A collection of things to do in order to be nice to f-droid packagers

How to release a godot application for f-droid

In the best case, you should:

  1. tag your releases. This way, one always knows which commit to package for a specific release
  2. create and maintain an export.cfg, with an icon, and version numbers raised at each release

Explanations why these things are useful for packagers, and how they are done, and done best, can be found below.

@est31
est31 / stats.lua
Last active August 29, 2015 14:18
craft stats script
-- put this into some builtin/game/*.lua file
-- it will print craft stats for the mod config to stdout when you start a world.
local register_craft_old = core.register_craft
core.type_stats = {}
core.grouped_number = 0
core.non_grouped_number = 0
local function is_group_str(val)
return string.sub(val, 1, 6) == "group:"
end
core.register_craft = function(params)
@est31
est31 / init.lua
Last active August 29, 2015 14:15
crafting speed test
-- file maintained at https://gist.github.com/est31/e477d9a624dced5cb274
-- tests basic crafting speed
local function crafting_loop()
local x = minetest.get_us_time()
local cnt = 20000
local locnt = 50
while cnt ~= 20000-locnt do
minetest.get_craft_result({
input = "normal",
@est31
est31 / password_list.txt
Last active August 29, 2015 14:14
pwm config example
return {["password_list"] = {
{user="est31", address="digitalaudioconcepts.com", port=30001, password="secretpassword", comment="The first Server I logged on"},
{user="est31", password="anothersecretpassword", name="Xanadu", comment="Some other nice server"},
{user="est31", address="0.0.0.0", port=30000, password="", comment="Empty password for local sessions"},
{user="est", address="0.0.0.0", port=30000, password="", comment="Empty password for local sessions"}
}}