Skip to content

Instantly share code, notes, and snippets.

View fcamblor's full-sized avatar

Frédéric Camblor fcamblor

View GitHub Profile
@fcamblor
fcamblor / sunnytech.json
Last active May 13, 2024 22:13
voxxrin openplanner test
{
"openPlannerGeneratedJson": "https://gist.githubusercontent.com/fcamblor/2b4cb4f3ee1f2861cfe2ebb434dc6c20/raw/z_openplanner-sunnytech-generated-schedule.json",
"description": "",
"keywords": [],
"location": {
"country": "France",
"city": "Montpellier",
"coords": {
"latitude": 43.71636281966474,
"longitude": 3.847967787856771
@fcamblor
fcamblor / configuration.yaml
Created July 24, 2023 09:43
HA Enphase v7 sensors adjustments
template:
# from https://community.home-assistant.io/t/enphase-envoy-with-energy-dashboard/328668
# Envoy's current_power_consumption / current_power_production are not "subtracting" solar production from it
# So we need to deal with it ourselves
- sensor:
- name: Grid Import Power
state_class: measurement
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
{
"id": "devoxxpl23",
"cfpId": "devoxxpl23",
"cfpBaseUrl": "https://devoxxpl23.cfp.dev",
"eventFamily": "devoxx",
"headingTitle": "DevoxxPL 23",
"keywords": [
"Devoxx",
"Java",
"Kotlin",
@fcamblor
fcamblor / Code.gs
Created September 30, 2022 09:31
Analyse salaires région Bordelaise 2021 - Script
function computeSalariesPerXPResults(anneesXPCells, revenusCells, typesEntrepriseCells) {
if(anneesXPCells.length !== revenusCells.length || anneesXPCells.length !== typesEntrepriseCells.length) {
throw new Error("Different number of rows in inputs: "+JSON.stringify([anneesXPCells.length, revenusCells.length, typesEntrepriseCells.length]));
}
const distinctEntTypes = new Set();
const salariesPerXPResults = anneesXPCells.reduce((salariesPerXP, anneeXPRow, idx) => {
const anneeXP = Number(anneeXPRow[0]);
const salary = Number(revenusCells[idx][0]);
@fcamblor
fcamblor / source.md
Last active July 26, 2021 12:37
dict-fr.json

How I generated this file :

const fcontent = fs.readFileSync('./dela-fr-public.dic', 'utf16le')
const words = [...new Set(fcontent.split('\n').flatMap(line => line.split('.')[0].split(",").filter(v => !!v)))];
const singleWords = words.filter(w => w.indexOf(" ") === -1);
fs.writeFileSync("./words.json", JSON.stringify(words), 'utf16le')
fs.writeFileSync("./single-words.json", JSON.stringify(singleWords), 'utf16le')
#!/usr/bin/env zx
void async function() {
await $`curl -sSL https://raw.githubusercontent.com/fcamblor/bitrise-zx-scripts/main/index.mjs > /tmp/index.mjs`
const {config, cacheableCommand} = await import('/tmp/index.mjs');
config(process);
await cacheableCommand({
cacheName:'cma-npm-packages',
@fcamblor
fcamblor / filewriter-threadsafety.js
Last active January 7, 2021 22:55
cordova-file concurrent writes reproducer
function testingDirEntryFor(directoryName) {
return new Promise((resolve, reject) => {
window.resolveLocalFileSystemURL(cordova.file.dataDirectory, (rootDataDir) => {
rootDataDir.getDirectory(directoryName, { create: true }, (dirEntry) => {
resolve(dirEntry);
}, (error) => reject(error));
}, (error) => reject(error));
});
}
@fcamblor
fcamblor / identifyDevoxxScheduleOptims.js
Last active April 15, 2022 12:17
Helping script to adjust DevoxxFr schedule columns (rooms) width
async function loadScript(url) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
document.head.appendChild(script);
return new Promise((resolve) => setTimeout(resolve, 1000));
}
Promise.all([
loadScript("https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js")
@fcamblor
fcamblor / README.md
Last active December 20, 2019 15:44
Variables extractor

Idea is to provide a working implementation for extractVariablesFrom(str) js function. Basically, this function is intended to extract variable names from a string, considering that variable name should be surrounded with double or triple braces (mixing not allowed) and name should not contain any space. Obviously, variable may appear anywhere in the string (at the start/end typically, or "glued" to another variable).

Background : I translate an application into many languages. A translation can either be a raw string or a handlebar template string. In latter case, I give to my translator the raw template string (with some handlebar variables embedded into it) and I expect them to NOT alter this template string (typically, don't remove braces nor translate variable names).

@fcamblor
fcamblor / noel.md
Last active December 12, 2019 14:01
Et l'heureux gagnant est...

.... CAI !