Skip to content

Instantly share code, notes, and snippets.

View pom421's full-sized avatar
🦊
Yes, What's happening?

Pierre-Olivier Mauguet pom421

🦊
Yes, What's happening?
View GitHub Profile
@pom421
pom421 / associateQueryWithParams.ts
Last active July 24, 2024 22:24
Build SQL query with parameters in Script Kit and display a link for Datasette
// Name: Associate SQL query with params
import "@johnlindquist/kit"
const DATASETTE_URL = "http://localhost:8001/xyz"
// Example usage : call `associateQueryWithParams` with the following log message:
// Query: select "id", "cout_abonnement", "cout_maintenance", "facture_energetique", "cout_isolation_enveloppe", "cout_solution_15", "aides_solution_15" from "bdd_eco" where "bdd_eco"."typologie" = ? and "bdd_eco"."zone_climatique" = ? and "bdd_eco"."type_CH" = ? and "bdd_eco"."type_ECS" = ? and "bdd_eco"."CH" = ? and "bdd_eco"."ECS" = ? and "bdd_eco"."scenario_renovation_enveloppe" = ? and "bdd_eco"."scenario_renovation_systeme" = ? limit ? -- params: ["Petit collectif (2001-2005)", "75 - Paris", "FIOUL", "FIOUL", "COL", "COL", "INIT", "CH + ECS Hybride : PAC + Chaudière", 1]
function associateQueryWithParams(logMessage: string): string {
// Extract query and params from the log message

Comment utiliser Matomo sans bannière de consentement

  1. permettre aux visiteurs de refuser d’être suivis (Opt-out) (exemple)
  2. désactiver les cookies (par l'usage de disableCookies ou via l'admin de Matomo)
  3. anonymiser les IP : anonymiser au moins 2 octets via l’admin de Matomo
  4. anonymiser le référent via l’admin de Matomo
  5. exclure les données personnelles des URL et titre des pages
  6. exclure les données personnelles des variables personnalisées, dimensions, évènements (usage avancé)
  7. *masquer les données personnelles dans le
@pom421
pom421 / script.mjs
Last active March 8, 2023 13:54
Script web3 to call a method of a smart contract
import Web3 from "web3";
import dotenv from "dotenv";
import HDWalletProvider from "@truffle/hdwallet-provider";
// We assume you have a .env file with MNEMONIC and INFURA_ID variables
dotenv.config();
const provider = new HDWalletProvider(
`${process.env.MNEMONIC}`, // Seed phrase of your wallet
`https://goerli.infura.io/v3/${process.env.INFURA_ID}` // Infura ID token
@pom421
pom421 / contracts...Projet 1 - Voting...Voting.sol
Created February 10, 2023 00:30
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Voting
*/
contract Voting is Ownable {
@pom421
pom421 / contracts...corrections...Devinez.sol
Created February 9, 2023 23:05
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
contract devinez is Ownable {
string private mot;
string public indice;
address public gagnant;
@pom421
pom421 / contracts...corrections...Student.sol
Created February 9, 2023 23:05
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
contract Notes is Ownable {
struct Student {
string name;
uint256 noteBiology;
uint256 noteMaths;
@pom421
pom421 / contracts...corrections...Devinez2.sol
Created February 9, 2023 23:04
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
contract epargne is Ownable {
string private mot;
string public indice;
address public gagnant;
mapping(address=>bool) played;
address[] public players;
@pom421
pom421 / contracts...corrections...Deviez2.sol
Created February 9, 2023 23:04
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
contract epargne is Ownable {
string private mot;
string public indice;
address public gagnant;
mapping(address=>bool) played;
address[] public players;
@pom421
pom421 / contracts...Heritage.sol
Created February 9, 2023 23:04
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
/**
*
*/
contract ParentContract {
uint256 internal sensDeLaVie = 42;
@pom421
pom421 / contracts...ExternalStorage.sol
Created February 9, 2023 23:04
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.18;
import "./1_Storage.sol";
interface IStorage {
function store(uint256 num) external ;
function retrieve() external view returns (uint256);
}