Skip to content

Instantly share code, notes, and snippets.

View MatteoGauthier's full-sized avatar
🌴
Working on squale.agency 🍹

Mattèo Gauthier MatteoGauthier

🌴
Working on squale.agency 🍹
View GitHub Profile
@MatteoGauthier
MatteoGauthier / update-logto-app-uris.ts
Created September 30, 2024 08:30
TypeScript script to manually update logto configuration using the Management API (https://docs.logto.io/docs/recipes/interact-with-management-api/)
const LOGTO_APP_ID = process.env.LOGTO_MANAGEMENT_API_ID
const LOGTO_APP_SECRET = process.env.LOGTO_MANAGEMENT_API_SECRET
const LOGTO_API_RESOURCE = `https://${process.env.LOGTO_TENANT_ID}.logto.app/api`
const LOGTO_APP_ID_TO_UPDATE = process.env.LOGTO_CLIENT_ID
if (!LOGTO_API_RESOURCE || !LOGTO_APP_ID_TO_UPDATE || !LOGTO_APP_ID || !LOGTO_APP_SECRET) {
console.error("Missing environment variables")
process.exit(1)
}
@MatteoGauthier
MatteoGauthier / quick-installs-useful-tools.md
Last active July 19, 2024 08:30
Quick Installs - Softwares, utils used frequently (macOS and Unix installs)
@MatteoGauthier
MatteoGauthier / README.md
Last active June 6, 2024 21:38
PostgreSQL Restore backup of a .tar.gz file
@MatteoGauthier
MatteoGauthier / ffmpeg-video-snippets.md
Last active February 29, 2024 10:45
FFMPEG command snippets for video related processing

Get video framerates

Detailed video file information

ffprobe -loglevel 0 -print_format json -show_format -show_streams YOURFILE

List video files informations in the current directory

@MatteoGauthier
MatteoGauthier / touch-screen-device-webpage-setup.md
Last active February 2, 2024 14:29
Chromium Based web browser setup for touchable kiosk experience

Setup guide for a touch screen with a webpage

Prevent physical device hijacking

  • Disable access to serial ports
  • Disable physical buttons
  • Disable unnecesary wireless communication

Chromium startup with flags

@MatteoGauthier
MatteoGauthier / auth.ts
Last active January 3, 2024 01:49
Kinde OAuth as a next-auth provider
export const authOptions = {
// ...
providers: [
{
id: "kinde",
name: "Kinde",
type: "oauth",
wellKnown: `https://TENANT_ID.kinde.com/.well-known/openid-configuration`,
idToken: true,
authorization: {
float space = 10.;
vec2 p = (FC.xy * 2.0 - r) / r.y * 3.;
vec2 x, d;
for (float i = 1.0 - fract((t)); i < 25.0; i += 0.5) {
x = p + (cos(i * vec2(0.1, 0.5) + t) + vec2(0, 4.0 - i)) / i * (space / 2.0);
d = vec2(4, sin(i) * 0.4 * x * 2e-1 ) / i * 4.;
o += (cos(max(i, 3.) + vec4(0, 2, 4, 0)) + 1.0) / (length(x - d * clamp(dot(x, d) / dot(d, d), -11.0, 11.0)) + i / 1e8) / max(i * i, 5.0) * .12;
}
import time
import random
from pynput.keyboard import Controller
keyboard = Controller() # Create the controller
def type_string_with_delay(string):
for character in string: # Loop over each character in the string
keyboard.type(character) # Type the character
delay = random.uniform(0, 2) # Generate a random number between 0 and 10
@MatteoGauthier
MatteoGauthier / package.json
Last active January 24, 2023 00:21
Modern package.json & tsconfig.json file [ESNEXT]
{
"version": "1.0.0",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"type": "module",
}
@MatteoGauthier
MatteoGauthier / useElementSize.tsx
Created November 2, 2022 13:18
React hook to listen to element size changes
import { useEffect, useMemo, useRef, useState } from 'react';
type ObserverRect = Omit<DOMRectReadOnly, 'toJSON'>;
const defaultState: ObserverRect = {
x: 0,
y: 0,
width: 0,
height: 0,
top: 0,