Skip to content

Instantly share code, notes, and snippets.

View rsms's full-sized avatar

Rasmus rsms

View GitHub Profile
@rsms
rsms / id.go
Last active October 27, 2020 19:33
Sortable efficient universally unique identifier in Go — PUBLISHED HERE: https://github.com/rsms/go-uuid
/* ISC License
Copyright (c) 2020, Rasmus Andersson <rsms.me>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
@rsms
rsms / foo.service
Created October 3, 2020 00:18
Example go http server with systemd socket activation and zero-downtime restart
[Unit]
Description = Foo HTTP server
Requires = foo.socket
After = multi-user.target
[Service]
User = www-data
Group = www-data
WorkingDirectory = /var/foo
ExecStart = /var/foo/bin/foo-server
@rsms
rsms / 00-readme.md
Created May 12, 2020 22:50
TensorFlow-GPU on a dedicated remote PC, using a Mac for development

My random notes on the adventure of developing with TensorFlow on a Mac, running calculations on a NVIDIA GPU in a separate PC. Your miles may vary.

@rsms
rsms / chardiff.sh
Created March 9, 2020 17:06
Terribly hacky script for generating GIFs of font changes over time
#!/bin/bash -e
#
# Generate GIFs of font changes over time
#
# HERE BE DRAGONS!
# This is a hack of a script. It won't just run for you. Edit it to suit your system and needs.
#
pushd "$(dirname "$0")" >/dev/null
chardiffdir=$PWD
pushd "../.." >/dev/null
@rsms
rsms / pdf-to-svg.md
Last active February 21, 2023 09:04

Converting PDF → SVG

Surprisingly complicated. Figma supports SVG → PDF but not the other way around. Sketch supports PDF → SVG with some bugs (often vector shape overlaps are incorrect.)

dawbarton/pdf2svg looks like an interesting project that could be compiled as WASM but it is itself poinsoned by GNU GPL license. Plus, it depends on a huge amount of (also GPL-licensed) code in the form of Poppler and Cairo.

Kauai Juice Co. (Kapaa) kauaijuiceco.com Awesome ladies, awesome kombucha on tap, awesome juices and mylks (almond usually), and nice design. It's behind Java Kai, so not right on the main street. Went there a ton. Rainbow Living Foods (Kapaa) http://www.yelp.com/biz/rainbow-living-foods-kapaa

If you dig fresh, and yes, raw, foods, this place is the jam. Super good. Art Cafe Hemingway (Kapaa) http://www.yelp.com/biz/art-café-hemingway-kapaa-2

Excellent breakfast in a beautiful chill setting. Gluten-free options. Java Kai (Kapaa)

@rsms
rsms / macos-NSUserDictionaryReplacementItems.plist
Created March 5, 2020 20:31
defaults read -g NSUserDictionaryReplacementItems
(
{
on = 1;
replace = kbmul;
with = "\\U00d7";
},
{
on = 1;
replace = kbrarr;
with = "\\U2192";
{
"name": "rsms dark v2 mono",
"author": "rsms",
"variables": {
"red": "hsl(5, 0%, 50%)",
"orange": "hsl(27, 0%, 50%)",
"yellow": "hsl(60, 0%, 50%)",
"green": "hsl(150, 0%, 43%)",
"cyan": "hsl(180, 0%, 50%)",
"blue": "hsl(210, 0%, 50%)",

Binary Encoding

Note: This document is no longer being updated. Please see the normative documentation.

This document describes the portable binary encoding of the WebAssembly modules.

The binary encoding is a dense representation of module information that enables small files, fast decoding, and reduced memory usage. See the rationale document for more detail.

static unsigned char map[256] = {
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
/* 0x00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // <CTRL> ...
/* 0x10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // <CTRL> ...
/* 0x20 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // ! " # $ % & ' ( ) * + , - . /
/* 0x30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
/* 0x40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // @ A B C D E F G H I J K L M N O
/* 0x50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // P Q R S T U V W X Y Z [ \ ] ^ _
/* 0x60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // ` a b c d e f g h i j k l m n o
/* 0x70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // p q r s t u v w x y z { | } ~ <DEL>