Skip to content

Instantly share code, notes, and snippets.

View ClementGre's full-sized avatar

Clément Grennerat ClementGre

View GitHub Profile
@ClementGre
ClementGre / main.js
Created May 16, 2024 21:03
INKK Hébergement floors maps scrapping
const fs = require('fs');
const path = require('path');
const axios = require("axios");
const https = require("https");
const httpsAgent = new https.Agent({rejectUnauthorized: false});
const capaignId = 'clvwo2kc40001ncj8jgsroyoz'
const get_buildings_query = `query getAvailableEntries($buildingId: ID, $floorId: ID, $roomId: ID, $campaignId: ID!, $bedsCount: Int!) {
getAvailableEntries(
@ClementGre
ClementGre / Units Latexizer
Last active April 5, 2024 22:21
A Latex command that converts any non formatted unit, e.g. Kg.m2.s-1 into a beautifully formatted Latex $\textrm{Kg}\cdot\textrm{m}^2\cdot\textrm{s}^{-2}}$.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Units Latexizer by Clément Grennerat %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Actions:
% "deg" is replaced by °C
% Letters [A-Za-z] are put into textrm{}
% Numbers and minus are superscripted
% Dots are replaced by \cdot
\ExplSyntaxOn
@ClementGre
ClementGre / .phoenix.js
Created May 3, 2023 11:49
Phoenix MacOS script to keep finder windows on the desktop it were opened on (instead of switching between desks due to a but of MacOS Ventura).
// Utils
function getWindowSpace(window){
return Space.all().find(s => s.windows().find(w => w.isEqual(window)))
}
function getSpaceFromHash(hash){
return Space.all().find(s => s.hash() === hash)
}
// Default space definition
Event.on('windowDidOpen', (window) => {
@ClementGre
ClementGre / MutableAndNonMutableVars.java
Last active April 5, 2024 22:05
Understanding immutable and mutable objects, and how using "=" is losing the reference from the initial object.
package fr.clementgre;
public class Main {
public static void main(String[] args) {
MutablePerson friend = new MutablePerson(null, "Friend man", 20);
MutablePerson person = new MutablePerson(friend, "Person test", 19);
editMutablePerson(person);
System.out.println(person);
@ClementGre
ClementGre / pronote-api-nodejs-web-interface.js
Last active November 25, 2020 01:05
Serveur web nodeJs qui permet de se connecter à son compte pronote et de voir toutes les données disponibles. Montre les fonctionnalités de pronote-api de Litarvan.
const http = require('http');
const pronote = require('pronote-api');
const app = http.createServer(function (request, response) {
console.log('----- RECEIVED A REQUEST -----');
var body = "";
var isBodyGenerated = false;
var isResponseEnded = false;
@ClementGre
ClementGre / PixelPack 4x4 [Default Pack].zip
Last active November 25, 2020 01:09
Convertisseur de ressource pack Minecraft en différentes résolutions. Il permet par exemple de convertir un pack 16×16 en 4×4 ou même 2×2 avec des paramètres personnalisés (voir constantes).