Skip to content

Instantly share code, notes, and snippets.

@max-lt
max-lt / poll_with_sleep.log
Created January 10, 2026 21:43
rusty_v8 locker
=== Async V8 Isolate Pool Demo ===
Pool has 2 isolates, but we'll run 4 workers.
Workers will suspend (unlock isolate) on I/O,
allowing other workers to use the isolates.
--- Starting execution ---
[Worker 0] Acquired isolate, starting execution
[Worker 0] Step 0: computed 0
@max-lt
max-lt / oauth-claude.md
Last active January 8, 2026 15:43
Claude OAuth Token Generator

Claude OAuth Token Generator

Get OAuth tokens from your Claude Pro/Max subscription to use with third-party apps.

⚠️ Disclaimer

This script exploits Claude Code's OAuth flow. It's unofficial and unsupported by Anthropic. Use at your own risk — it may break at any time.

For production use, prefer official API keys.

@max-lt
max-lt / infra.md
Last active May 22, 2024 08:20
Reflexions infra

Serveurs

Dimentionnement serveur: Actuel: Intel Xeon-D 1521 - 4c/8t - 2.4 GHz/2.7 GHz | 16 Go ECC 2133 MHz | 4×4 To HDD SATA + 1×500 Go SSD NVMe | 500Mbps in / 100Mbps out ~56e/mo

Necessaire:

  • ~50Go pour le moment (sync < 500Mo * 2 (cdn) = 1Go), de toute facon il faudra rediregier le resultat de la synchro
@max-lt
max-lt / random.md
Created February 12, 2024 12:03 — forked from joepie91/random.md
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

@max-lt
max-lt / analytics.service.ts
Last active December 15, 2023 08:45
Angular + Piano Analytics
import { Injectable } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
import { filter, map } from 'rxjs/operators';
import { logger } from '~/logger';
import { Config } from '~/config';
const log = logger.getLogger('AnalyticsService');
// Global variables used by piano analytics
@max-lt
max-lt / pagination.html
Created December 1, 2023 10:32
Angular pagination
<!-- Pagination -->
<ul class="pagination">
<li class="page-item">
<button class="page-link" (click)="goPrevious()" [disabled]="0 === current">Previous</button>
</li>
<li class="page-item" *ngFor="let n of nums;">
<button class="page-link" (click)="goPage(n)" [disabled]="n - 1 === current || n === '...'">{{ n }}</button>
</li>
<li class="page-item">
@max-lt
max-lt / tooltip.directive.ts
Last active December 30, 2023 12:39
Angular tooltip
import { Directive, ElementRef, HostListener, Input, OnInit, Renderer2 as Renderer } from '@angular/core';
@Directive({ selector: '[tooltip]' })
export class TooltipDirective implements OnInit {
private tooltip!: HTMLElement;
@Input('tooltip')
content!: string;
@Input()
@max-lt
max-lt / app.html
Last active September 13, 2025 07:38
Angular + Tailwind quickstart
<ng-template #logo>
<a href="#" class="flex items-center">
<img src="/favicon.ico" class="mr-3 h-8" alt="AppName Logo" />
<span class="self-center text-xl font-semibold whitespace-nowrap dark:text-white">AppName</span>
</a>
</ng-template>
<ng-template #lorem_ipsum>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
@max-lt
max-lt / github-signature.ts
Last active June 2, 2023 17:22
Signatures with browser crypto APIs
/// <reference lib="webworker" />
/// <reference lib="es2017" />
declare const env: {
GITHUB_SECRET: string;
};
if (!env.GITHUB_SECRET) {
throw new Error("Invalid or missing GITHUB_SECRET");
}