Skip to content

Instantly share code, notes, and snippets.

@tghpereira
tghpereira / addons.ts
Last active October 21, 2023 16:58
Example Bun FFI C++
import { dlopen } from 'bun:ffi';
// build C++ in Linux -> g++ -shared -o test.so ./test.cpp -std=c++23 -lstdc++ -fPIC
export const addons = dlopen('test.so', {
create: {
args: ['callback'],
returns: 'pointer',
},
summon: {
args: ['pointer', 'pointer'],
returns: 'void',
@tghpereira
tghpereira / Readme.md
Last active March 8, 2025 17:43
Create native api websocket in nodejs (Experimental)

Create native websocket api in node js (Experimental)

Goal

Allow greater control of websockets in the api without relying on libs with socket.io and ws. Looking for the basic implementation of reading and writing data and connection handshake for projects where socket.io and ws do not support the required functionalities in the project.

Issues encountered

It is not possible to receive or send text messages longer than 65522 characters.

@tghpereira
tghpereira / index.html
Created March 2, 2023 18:41
[Bug]: DesktopCapturer doesn't work in Ubuntu 22.04.2 LTS #37463
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
<link href="./styles.css" rel="stylesheet">
<title>Hello World!</title>
</head>
<body>