Skip to content

Instantly share code, notes, and snippets.

View adrienjoly's full-sized avatar
☺️
In the flow

Adrien Joly adrienjoly

☺️
In the flow
View GitHub Profile
@adrienjoly
adrienjoly / react-and-jsx-without-build-chain.html
Created March 29, 2024 14:22
Pure/static HTML page that renders a React app (with JSX) and imports components without build chain nor transpilation.
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<script src="https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@babel/standalone@7.23.5/babel.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@mui/material@5.15.6/umd/material-ui.production.min.js"></script>
</head>

Jouer à des jeux PCVR sur Meta Quest avec Shadow et Virtual Desktop

Mon équipement et configuration:

  • Meta Quest de première génération
  • Connexion à Internet: abonnement Sosh Fibre, via Livebox 4 avec version de firmware G06.R01.C06_02, UPnP et IPV6 actifs
  • En guise de PC, un abonnement Shadow Boost à 30€/mois
  • Et une license Virtual Desktop, achetée via Steam

1. Prérequis sur le PC (Shadow)

@adrienjoly
adrienjoly / globals.d.ts
Created January 15, 2024 14:49
Typing a `globalThis` variable on Node.js, using TypeScript.
declare global {
// Note: It is crucial to note that [...] variables must only be declared using var
// cf https://copyprogramming.com/howto/using-globalthis-in-typescript
var myGlobalVariable: string;
}
// => `globalThis.myGlobalVariable` is properly typed as `string`
@adrienjoly
adrienjoly / rename-photos-by-date.sh
Created December 23, 2023 10:43
Rename photos by date
for f in photos/*.*; do
mv "$f" "photos/$(stat -f '%Sm' -t '%Y-%m-%d_%H%M%S' "$f").${f##*.}"
done
@adrienjoly
adrienjoly / typescript-type-guard-function-using-jsdoc.js
Created November 23, 2023 13:46
Type guard, so that void/undefined can be excluded from an array's type, after filtering them out, using JSDoc type annotations.
/**
* Type guard, so that void/undefined can be excluded from an array's type, after filtering them out.
* @template T
* @param {T | void} val
* @returns {val is T}
*/
const isDefined = (val) => val && typeof val === 'object'
/** @type {number[]} */
const numbers = [-1, 1, 2]
@adrienjoly
adrienjoly / download-using-puppeteer-and-interceptors.js
Created June 19, 2023 08:30
Login and download a HTTPS response using Puppeteer and request interceptors.
// Note: this script does not work anymore on hackmd.io, because of recaptcha protection.
// But the same logic can be reused on other websites, e.g. for backup automation.
const puppeteer = require("puppeteer");
const { DEBUG } = process.env; // for verbose request logs, pass DEBUG='*'
/** @returns a `untilRequest()` method that resolves when `targetURL` is requested by `page`. */
const interceptRequests = async (page) => {
await page.setRequestInterception(true);
@adrienjoly
adrienjoly / run-npx-with-specific-nodejs-version-thru-nvm.sh
Last active June 19, 2023 08:02
Run a node.js CLI from a github repository, using a specific version of Node.js installed locally with NVM. Addresses `nvm: command not found` error, when `nvm` is invoked from a bash script.
#!/usr/bin/env bash
# Run index.js (or the script specified in package.json's "bin" entry)
# from https://github.com/adrienjoly/notion-backup,
# with the version of 18 of Node.js, installed locally with NVM.
NODE_VERSION=18 ~/.nvm/nvm-exec npx --yes github:adrienjoly/notion-backup
# Why you may need this?
# - If, like me, you have not setup a default version of node.js, on NVM.
# - If you don't want to (or can't) include a `.nvmrc` file.
@adrienjoly
adrienjoly / template-audit-capacités-devops-dora.md
Last active May 29, 2023 15:12
Template que j'utilise pour auditer mes client sur les "capacités DevOps" proposées par le DORA, et leur donner des recommandations pour progresser. C'est en markdown => importable facilement dans Notion.

Audit Capacités DevOps/DORA

Le livre "Accelerate: The Science of Lean Software and DevOps: Building and Scaling High Performing Technology Organizations" (Gene Kim, Jez Humble, and Nicole Forsgren, 2018) s'appuie sur 5 ans d'études scientifiques pour faire ressortir les pratiques effectivement mises en oeuvre par les sociétés "tech" les plus performantes. (selon la classification de Westrum)

L'équipe de DORA (DevOps Research and Assessment) a identifié et validé un ensemble de capacités permettant d'optimiser les performances organisationnelles et celles de la livraison de logiciels. Ces articles décrivent comment mettre en œuvre, améliorer et mesurer ces capacités.

Source: https://cloud.google.com/architecture/devops/capabilities

Les capacités recommandées sont au nombre de 27, classés en 3 catégories.

@adrienjoly
adrienjoly / jest-test-each.spec.js
Created March 23, 2023 08:56
ways to use Jest's test.each
describe("ways to use Jest's test.each", () => {
test.each([
[1, 1, 2],
[1, 2, 3],
[2, 1, 3],
])('.add(%i, %i)', (a, b, expected) => {
expect(a + b).toBe(expected)
})
@adrienjoly
adrienjoly / cypress.config.ts
Created March 11, 2023 11:02
Logging from Cypress E2E tests, for better troubleshooting
import { defineConfig } from 'cypress'
const cypressConfig = defineConfig({
video: true,
chromeWebSecurity: false,
e2e: {
baseUrl: 'http://localhost:3000',
supportFile: 'cypress/support/e2e/index.js',
setupNodeEvents(on, config) {
require('cypress-terminal-report/src/installLogsPrinter')(on, {