Skip to content

Instantly share code, notes, and snippets.

View tmtvl's full-sized avatar
💭
Relaxed

Tim Van den Langenbergh tmtvl

💭
Relaxed
View GitHub Profile
@tmtvl
tmtvl / keybase.md
Created August 29, 2016 14:50
Keybase proof

Keybase proof

I hereby claim:

  • I am TimothyXL on github.
  • I am tmtvl (https://keybase.io/tmtvl) on keybase.
  • I have a public key whose fingerprint is A1A1 D150 F96A 4C54 DE67 87FD F50A F328 D9D1 E635

To claim this, I am signing this object:

@tmtvl
tmtvl / keybase.md
Created January 11, 2018 21:38
keybase github proof

Keybase proof

I hereby claim:

  • I am tmtvl on github.
  • I am tmtvl (https://keybase.io/tmtvl) on keybase.
  • I have a public key whose fingerprint is A1A1 D150 F96A 4C54 DE67 87FD F50A F328 D9D1 E635

To claim this, I am signing this object:

@tmtvl
tmtvl / nwnonlinux.md
Created March 12, 2018 15:47 — forked from ubervison/nwnonlinux.md
Install Neverwinter Nights on any linux distribution

Neverwinter Nights Diamond GOG on linux

Prerequisites

First make sure that you have the following tools and libraries installed on your system:

innoextract, unzip, 7z, tar, unrar (to extract the game files)

For the nwmovies, nwlogger, nwuser and nwmouse tools, you will need the 32-bit version of these libraries, including their development headers (-dev or -devel packages):

@tmtvl
tmtvl / perl6-advent-2018.md
Last active December 1, 2018 14:39
Article for the Perl 6 Advent calendar 2018.

Porting Vigilance, integrating Perl 6 with standard tools

Greetings everyone, today we'll be taking an infrastructural script and port it from Perl 5 to Perl 6. This article is based on a pair of posts by James Clark, which you can find here:

This script is used to create and verify MD5 sums. These are 128-bit values that can be used to verify data integrity. While MD5 has been proven to be insecure in protecting against malicious actors, it is still useful for detecting on-disk corruption.

The Perl 6 ecosystem is growing and contains a variety of tools that are either ported from the Perl 5 CPAN, or are replacements. I'll walk through a few aspects of the original script and my port and show why I make some specific changes. Hopefully this will encourage you to go out and port your own little scripts.

@tmtvl
tmtvl / perl6-notes.md
Last active July 28, 2019 19:59
Perl 6 notes

Perl 6 notes

Typing

do-a-thing(Array[Rat].new(0.5, 1.5));

Grepping out Rats

@tmtvl
tmtvl / replit_all_languages.json
Created October 3, 2019 12:42
repl.it all languages
{
"riddlejs": {
"ext": "js",
"template": "",
"hasInterpreter": true,
"entrypoint": "index.js",
"hasLanguageServer": true,
"icon": "https://repl.it/public/images/languages/nodejs.svg",
"category": "Hidden",
"hasProjectMode": true,
@tmtvl
tmtvl / basic.png
Last active November 27, 2019 20:41
Stackframe Reduction
basic.png
@tmtvl
tmtvl / rnr.md
Created December 10, 2019 16:48
Raku advent 2019 day 13 RNR

A little R&R

Introduction

Raku is a really nice language. Versatile, expressive, fast, dwimmy. The only problem I sometimes have with it is that it can be a little slow. Fortunately that can easily be solved by the NativeCall interface, which makes it easy to call C code in your Raku program. Now, as nice as C is, it is a rather old language with some limitations. A newer language that can fill its niche is known as Rust. I'll show some examples of having Raku talk to Rust.

FFI

Rust code can be called from other languages using the FFI standard. FFI stands for "Foreign Function Interface" and allows you to export a Rust library as a standard shared library (a .so file on Linux or .dll on Windows). This is done by adding the following section in your Cargo.toml:

@tmtvl
tmtvl / fib.raku
Created May 18, 2020 12:52
Memoized fibonacci in Raku
#!/usr/bin/env raku
use v6;
sub memoize-walk (Code $calc --> Code) {
my Int @cache;
return sub (Int $n --> Int) {
return @cache[$n] if @cache[$n];
my Int $result = $calc($n);
@tmtvl
tmtvl / y-combinator.raku
Created June 24, 2020 14:14
Y Combinator
say sub ($f, $x, $y) {
return $f($x, $y, $f);
}(sub ($x, $y, $f) {
if $x < 2 {
return $y;
}
else {
return $f($x - 1, $x * $y, $f);
}
},