Skip to content

Instantly share code, notes, and snippets.

@marcocastignoli
marcocastignoli / database.test.js
Created January 23, 2024 12:38
sourcify postgres test mock
const { expect } = require("chai");
const { StorageService } = require("../dist/server/services/StorageService");
const config = require("config");
const { EventEmitter } = require("stream");
class PostgresPoolMock extends EventEmitter {
queryResults = [];
queryIndex = 0;
constructor(...args) {
// 1. Install `gcloud` cli
// 2. `gcloud init` to initialize gcloud with your account (it will open browser)
// 3. `gcloud auth application-default login` to set your account as the default account
import pg from "pg";
import { Connector } from "@google-cloud/cloud-sql-connector";
const { Pool } = pg;
const connector = new Connector();
const clientOpts = await connector.getOptions({
@marcocastignoli
marcocastignoli / calendar.txt
Last active May 9, 2023 09:36
Interesting ChatGPT prompts
Provide your answer in JSON form. Reply with only the answer in JSON form and include no other commentary. this is the format:
{
event?: {
name: string,
start: string,
end?: string
},
description: string
}
@marcocastignoli
marcocastignoli / compile-js.sh
Created February 16, 2023 14:58
Compiler error on Sourcify, not with truffle/hardhat
npx solc@0.6.5 --standard-json < standard-sourcify.json
@marcocastignoli
marcocastignoli / readme.md
Last active November 7, 2022 07:46
I'm a person!

My name is Ajit Dalit, I live in Raurkela in India. I leave here, in this block, a message of hope. I have been working in a Captcha Farm for a year, the working conditions are extreme, for most of the day we live like chickens: locked up in one of the hundreds of bunks that fill a shed that I have never seen the end of. The only moments in which we go down, forming long queues on the ladders, or we go to the bathroom or recover some supplements; I haven't eaten food for 65 days when good Devendra left me a bite of chapati.

While we work we cannot lose even a second because we have to certify at least 5400 blocks a day, one every 10 seconds for 15 hours. At the end of working hours and during breaks, the device turns off so we have no free time on the internet. I've been writing this message for two weeks in the few moments I save when I can certify two transactions in 10 seconds. You may wonder why I am staying here ... There is no other job in India that allows me to earn a salary that offers my family the

@marcocastignoli
marcocastignoli / flow.md
Last active January 24, 2022 19:50
diamond framework
  1. fetch diamond infos and creates the example.diamond file
$ npx hardhat diamond loupe --address "0x123123..." -o "example.diamond"
  1. the command creates the file example.diamond
<Diamond
{
"name": "Marco Casti",
"age": 26,
"favorite_color": "#ffa500",
"gender": "male",
"date": "",
"pets": [
{
"type": "dog",
"name": "Walter"
@marcocastignoli
marcocastignoli / notification_wa_writing.js
Last active February 4, 2020 16:53
Notification on whatsapp when contact is writing
var notificationNumber = 0
const timer = window.setInterval(function(){
var notification
if(document.getElementsByClassName('_2ZAIy').length > 0) {
if (notificationNumber < 10) {
notificationNumber++
} else {
notificationNumber = 0
notification = new Notification('stanno scrivendo', { body: "stanno scrivendo" });
@marcocastignoli
marcocastignoli / errors
Last active October 25, 2019 07:02
imlost.rs
www_1 | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
www_1 |
www_1 | error[E0277]: the trait bound `(clientifornitori::schema::abcf::columns::ABCF_ID, clientifornitori::schema::abcf::columns::CF, clientifornitori::schema::abcf::columns::CD_CF, clientifornitori::schema::abcf::columns::RAG_CF, clientifornitori::schema::abcf::columns::IND_CF, clientifornitori::schema::abcf::columns::LOC_CF, clientifornitori::schema::abcf::columns::TBNAZ_ID, clientifornitori::schema::abcf::columns::TBCOM_ID, clientifornitori::schema::abcf::columns::CAP_CF, clientifornitori::schema::abcf::columns::TBPRO_ID, clientifornitori::schema::abcf::columns::CFIS_CF, clientifornitori::schema::abcf::columns::PIVA_CF, clientifornitori::schema::abcf::columns::COG, clientifornitori::schema::abcf::columns::NOME, clientifornitori::schema::abcf::columns::TEL1, clientifornitori::schema::abcf::columns::TEL2, clientifornitori::schema::abcf::columns: