Skip to content

Instantly share code, notes, and snippets.

View erossignon's full-sized avatar

Etienne erossignon

View GitHub Profile
@somefunAgba
somefunAgba / 1.Instructions.md
Created May 17, 2021 18:50 — forked from WesThorburn/1.Instructions.md
Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Download and Install Emscripten

  • My preferred installation location is /home/user
  • Get the latest sdk: git clone https://github.com/emscripten-core/emsdk.git
  • Enter the cloned directory: cd emsdk
  • Install the lastest sdk tools: ./emsdk install latest
  • Activate the latest sdk tools: ./emsdk activate latest
  • Activate path variables: source ./emsdk_env.sh
  • Configure emsdk in your bash profile by running: echo 'source "/home/user/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
@aleclarson
aleclarson / rollup-typescript.md
Last active November 4, 2024 15:40
The best Rollup config for TypeScript libraries

It's 2024. You should use tsup instead of this.


Features

🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs bundle
.d.ts bundle + type-checking

@kripod
kripod / package.json
Created May 6, 2020 10:30
Creating minified ESM+CJS bundles from TypeScript with Rollup and Babel in a monorepo, utilizing conditional exports
{
"name": "to-be-added",
"version": "0.0.0",
"sideEffects": false,
"exports": {
".": {
"import": "./dist-esm/bundle.min.mjs",
"require": "./dist-cjs/bundle.min.cjs"
},
"./server": "./server/index.js"
@rikka0w0
rikka0w0 / ipxe_build.md
Last active November 17, 2024 22:42
Build IPXE

1. Install tools and config IPXE

# Install compiler and dependencies
sudo apt-get install -y git gcc make liblzma-dev

# Grab the source code
git clone https://github.com/ipxe/ipxe.git
cd ipxe/src

# Enable NFS support
@erossignon
erossignon / test_server.ts
Last active November 12, 2019 14:59
server with hardcoded ip address in certifcate
// node --inspect-brk -r ts-node/register -r source-map-support test_server.ts
import * as path from "path";
import * as fs from "fs";
import { promisify } from "util";
import * as child_process from "child_process";
import {
makeApplicationUrn,
OPCUAServer,
OPCUAClient,
@dceejay
dceejay / Dockerfile
Last active November 24, 2020 15:39
Dockerfile for Node-RED
# Dockerfile for Node-RED - pulls latest master code from git
# Use the node.js v4 LTS engine
FROM node:4-slim
MAINTAINER ceejay
RUN mkdir -p /root/.node-red
WORKDIR /root/.node-red
# download latest stable node-red
RUN npm install -g --unsafe-perm node-red
@branneman
branneman / better-nodejs-require-paths.md
Last active October 18, 2024 20:29
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@bruth
bruth / jsondiff.js
Last active December 12, 2015 04:38
JavaScript implementation for constructing objects diffs compatible with JSON PATCH syntax.
var jsondiff = (function() {
// Patch helper functions
function getParent(paths, path) {
return paths[path.substr(0, path.match(/\//g).length)];
}
// Checks if `obj` is an array or object
function isContainer(obj) {
return _.isArray(obj) || _.isObject(obj);
@serby
serby / sync.js
Created May 23, 2012 14:19
JavaScript implementation of set synchronisation. Bound by memory but minimizes database read writes.
var _ = require('underscore')
, a = {
1: { id: '1', name: 'a' },
2: { id: '2', name: 'b' },
3: { id: '3', name: 'c' }
}
, b = {
2: { id: '2', name: 'b1' },
3: { id: '3', name: 'c2' },
4: { id: '4', name: 'd' }
@jpoehls
jpoehls / node-cluster-messaging.js
Created March 29, 2012 01:48
Simple message passing between cluster master and workers in Node.js
var cluster = require('cluster');
if (cluster.isWorker) {
console.log('Worker ' + process.pid + ' has started.');
// Send message to master process.
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'})
// Receive messages from the master process.