Skip to content

Instantly share code, notes, and snippets.

@VitoVan
VitoVan / compile.md
Last active January 24, 2025 11:39
Build Pango, Cairo, GLib and the Whole Universe Into Webassembly

Note

The latest version is here:

https://vitovan.com/pango-cairo-wasm/

Build Pango, Cairo, GLib

and the Whole Universe Into Webassembly

Before executing the following commands, you need to follow how-to-build.sh and create two c files, they are provided.

@sindresorhus
sindresorhus / esm-package.md
Last active May 5, 2025 10:05
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@mourner
mourner / str-concat.js
Last active October 18, 2022 21:15
A benchmark that demonstrates something is wrong with v8's concatenation performance
const N = 1000000;
function simpleConcat() {
let str = '';
for (let i = 0; i < N; i++) {
str += 'a';
}
return str;
}
@qx133
qx133 / tryEthereum.js
Created April 30, 2017 14:18
Try out Ethereum using only nodejs and npm!
var Web3 = require('web3');
var util = require('ethereumjs-util');
var tx = require('ethereumjs-tx');
var lightwallet = require('eth-lightwallet');
var txutils = lightwallet.txutils;
var web3 = new Web3(
new Web3.providers.HttpProvider('https://rinkeby.infura.io/')
);
var address = '0x8D68583e625CAaE969fA9249502E105a21435EbF';
var key = '1ce642301e680f60227b9d8ffecad474f15155b6d8f8a2cb6bde8e85c8a4809a';
@carlfriess
carlfriess / subtitles.js
Created April 10, 2016 17:41
Node.js script to add a subtitles track to a mp4 from an srt file.
#!/usr/local/bin/node
const readline = require('readline');
var exec = require('child_process').exec;
var path = require('path');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 4, 2025 08:04
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@jarvys
jarvys / run-multiple-redis-instances.md
Last active September 27, 2022 13:02
run multiple redis instances on the same server for centos
  • create a new redis .conf file
$ cp /etc/redis.conf /etc/redis-xxx.conf
  • edit /etc/redis-xxx.conf, illustrated as below
...