Skip to content

Instantly share code, notes, and snippets.

View corwin-of-amber's full-sized avatar
💭
GAAAA!!!

Shachar Itzhaky corwin-of-amber

💭
GAAAA!!!
View GitHub Profile
[
"Dorothy1710943",
"Laura5893352585",
"Donna8478837092",
"Sandra442872647",
"Ruth5711017436",
"Michell37622190",
"Margare95082111",
"Margare06611503",
"Michell66048359",

Building NW.js on macOS (for Mere Mortals) {: .doctitle}


This is an annotated version of Building NW.js from the official NW.js developer documentation. It includes my experience from building NW.js binaries for macOS, both Intel (x86-64) and M1 (arm64). The latter can be easily discerned since they are block-quoted and appear in red1.

Footnotes

  1. Not on GitHub though; they aggressively sanitize HTML in Markdown. Block quotes still work 😬

@corwin-of-amber
corwin-of-amber / xz-lzma2.ts
Created September 15, 2021 18:01
Reading lzma2 information from an xz container
/**
* Based on:
* + https://tukaani.org/xz/xz-file-format-1.0.4.txt
* + https://github.com/Rogdham/python-xz/tree/master/src/xz
*/
import assert from 'assert';
import fs from 'fs';
import struct from 'python-struct';
// From https://github.com/SortaCore/lzma2-js
import lzma from './lzma2-js/lzma2_worker';
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<script src="./node_modules/jscoq/ui-js/jscoq-loader.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
class Observer {
Workspace root: /Users/corwin/var/tut/dune
Running[0]: /usr/bin/getconf _NPROCESSORS_ONLN > /var/folders/tz/ywq0c4d920n6lkpsgyggj25m0000gn/T/dune72a639.output 2> /dev/null
Auto-detected concurrency: 4
disable binary cache
Running[1]: /opt/local/bin/opam --version --color=never > /var/folders/tz/ywq0c4d920n6lkpsgyggj25m0000gn/T/dunee9b97a.output
Running[2]: /opt/local/bin/opam config env --switch default --sexp --set-switch > /var/folders/tz/ywq0c4d920n6lkpsgyggj25m0000gn/T/dune1af7ea.output
Running[3]: /opt/local/bin/ocamlc.opt -config > /var/folders/tz/ywq0c4d920n6lkpsgyggj25m0000gn/T/dunea3aa3c.output
Dune context:
{ name = "default"
; kind = { root = None; switch = "default" }
@corwin-of-amber
corwin-of-amber / firepad-nulladapter.js
Created August 9, 2019 19:12
A minimal "null-modem" Firepad adapter
const {EntityManager, RichTextCodeMirror, EditorClient, FirebaseAdapter, utils,
RichTextCodeMirrorAdapter} = Firepad.firepad;
var upstream = [];
class NullAdapter {
constructor(userId, userColor) {
this.userId_ = userId;
this.color_ = userColor;
}
@corwin-of-amber
corwin-of-amber / 01-sll_init.sy
Created November 11, 2019 16:10
SuSLik pure synthesis mini-benchmarks
; EXPECT: unsat
; COMMAND-LINE: --cegqi-si=all --sygus-out=status
(set-logic UF)
(declare-var x Int)
(declare-var v Int)
(synth-fun target ((x Int) (v Int)) Int
((Start Int (0 1 x v))))
@corwin-of-amber
corwin-of-amber / Coroutines
Last active October 21, 2019 21:18
A utility library for coroutines in Emscripten (using Asyncify)
emcc example.c -s ASYNCIFY \
-s ASYNCIFY_IMPORTS='["emscripten_sleep","emscripten_yield","emscripten_coroutine_create","emscripten_coroutine_next"]' \
--js-library library_coroutine.js
@corwin-of-amber
corwin-of-amber / log.txt
Last active July 14, 2019 17:13
simple-peer (trickle=false)
[Log] peer1->peer2 signal {"type":"offer","sdp":"v=0\r\no=- 3624713161162515430 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=msid-semantic: WMS\r\nm=application 55189 DTLS/SCTP 5000\r\nc=IN IP4 79.176.64.37\r\na=candidate:842163049 1 udp 1677729535 79.176.64.37 55189 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999\r\na=ice-ufrag:miMp\r\na=ice-pwd:cNw7qh/6H8O7UmZugyAKIshU\r\na=fingerprint:sha-256 53:F3:53:F6:AB:60:C1:6A:CC:0A:A9:98:48:4F:8A:62:0E:46:83:B0:39:C5:09:8F:6E:94:C6:A7:8F:32:04:90\r\na=setup:actpass\r\na=mid:0\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n"} (peer-sanity.bundle.js, line 4773)
[Log] peer2->peer1 signal {"type":"answer","sdp":"v=0\r\no=- 7710368483432959926 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=msid-semantic: WMS\r\nm=application 57305 DTLS/SCTP 5000\r\nc=IN IP4 79.176.64.37\r\nb=AS:30\r\na=candidate:842163049 1 udp 1677729535 79.176.64.37 57305 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999\r\na=ice-ufrag:PF1b\r\na=ice-p
@corwin-of-amber
corwin-of-amber / log.txt
Last active July 14, 2019 17:07
simple-peer (trickle=true)
[Log] peer1->peer2 signal {"type":"offer","sdp":"v=0\r\no=- 5938417958810222947 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=msid-semantic: WMS\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:DZ9A\r\na=ice-pwd:mrnI5/tUWvqwS7garG8OYRZJ\r\na=ice-options:trickle\r\na=fingerprint:sha-256 F6:50:91:7B:C2:94:A3:35:7C:CC:1D:F3:A3:A7:B8:1D:E5:57:6E:C2:4E:B6:E4:B1:4F:F1:A9:C3:F1:F0:0B:2D\r\na=setup:actpass\r\na=mid:0\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n"} (peer-sanity.bundle.js, line 4773)
[Log] peer2->peer1 signal {"type":"answer","sdp":"v=0\r\no=- 1864940161042314649 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=msid-semantic: WMS\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\nb=AS:30\r\na=ice-ufrag:BWgd\r\na=ice-pwd:QC44hjljq5cOku5ulbWRs5sF\r\na=ice-options:trickle\r\na=fingerprint:sha-256 20:BC:2A:36:E7:1C:17:A7:C3:62:21:96:37:5E:C5:34:D4:F9:9D:66:7A:74:EB:23:CE:9C:DA:3A:8D:0B:FB:39\r\na=setup:active\r\na=mid:0\r\na=sctpmap:5000 webrtc-datachannel