Skip to content

Instantly share code, notes, and snippets.

View li6in9muyou's full-sized avatar

Li BingMuyou li6in9muyou

View GitHub Profile
@li6in9muyou
li6in9muyou / uv_read_file.c
Last active March 30, 2023 01:42 — forked from inlife/uv_read_file.c
Sample for reading a file asynchronously using libuv
// Sample for reading a file asynchronously using libuv
// taken from https://www.snip2code.com/Snippet/247423/Sample-for-reading-a-file-asynchronously
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <uv.h>
static uv_fs_t openReq;
static uv_fs_t readReq;
@li6in9muyou
li6in9muyou / mtx-trans.js
Last active September 25, 2022 10:09 — forked from lbn/matprint.js
use THREE.js to calculate matrix transformation
"use strict"
function matprint(mat) {
const shape = [mat.length, mat[0].length];
function col(mat, i) {
return mat.map(row => row[i]);
}
const colMaxes = [];
for (let i = 0; i < shape[1]; i++) {
colMaxes.push(Math.max.apply(null, col(mat, i).map(n => n.toString().length)));