Skip to content

Instantly share code, notes, and snippets.

View rsms's full-sized avatar

Rasmus rsms

View GitHub Profile
@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>
@rsms
rsms / fig-thumbnails.js
Created November 18, 2019 23:33
Script to fetch thumbnails of figma files
// 1. Make sure you have imagemagick installed (`brew install imagemagick` on macos)
// 2. Visit https://www.figma.com/developers/api#authentication and click "Get personal access token"
// 3. Add your file links below, replacing the example links
// 4. Run with `FIGMA_API_TOKEN=YOUR_TOKEN_FROM_STEP_2_HERE node fig-thumbnails.js`
// [ host:string, filekey:string ][]
const fileKeys = `
https://www.figma.com/file/FILEKEY/
https://staging.figma.com/file/FILEKEY/
https://www.figma.com/file/FILEKEY/