Skip to content

Instantly share code, notes, and snippets.

View helderjnpinto's full-sized avatar
☢️

ħþ helderjnpinto

☢️
View GitHub Profile
@helderjnpinto
helderjnpinto / postgres_queries_and_commands.sql
Last active January 25, 2023 16:31 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@helderjnpinto
helderjnpinto / docker-compose.yml
Created December 9, 2022 22:01 — forked from barnybug/docker-compose.yml
Docker compose for a Docker-in-docker gitlab runners setup
# Docker-in-Docker Gitlab runners setup taken from:
# https://medium.com/@tonywooster/docker-in-docker-in-gitlab-runners-220caeb708ca
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:17.09.0-ce-dind
command:
- --storage-driver=overlay2
Random Value : ok
Compare XOR : ok
Compare SUB : ok
Compare MUL : ok
Compare DIV : ok
Compare OR : ok
Compare AND : ok
Sequential Increment: ok
Solid Bits : ok
Block Sequential : ok
@helderjnpinto
helderjnpinto / gist:1a7f0ab78a676544c12f684c5ad25e73
Last active November 17, 2022 22:36
memtesterSlot1 22191413495
FAILURE: 0x76ffa13a12f7ec54 != 0x76ffa13a12f5ec54 at offset 0xa1d1b230.
FAILURE: 0x76ffa13a12f7ec55 != 0x76ffa13a12c7ec55 at offset 0xa1d1b238.
FAILURE: 0x76ffa13a12f7ec57 != 0x76ffa13a12ffec57 at offset 0xa1d1b248.
FAILURE: 0x76ffa13a12f7ec59 != 0x76ffa13a12e6ec59 at offset 0xa1d1b258.
FAILURE: 0x76ffa13a12f7ec5b != 0x76ffa13a12faec5b at offset 0xa1d1b268.
FAILURE: 0x76ffa13a12f7ec5d != 0x76ffa13a1267ec5d at offset 0xa1d1b278.
FAILURE: 0x76ffa13a12f7ec5f != 0x76ffa13a12dfec5f at offset 0xa1d1b288.
FAILURE: 0x76ffa13a12f7ec60 != 0x76ffa13a12f5ec60 at offset 0xa1d1b290.
FAILURE: 0x76ffa13a12f7ec61 != 0x76ffa13a1266ec61 at offset 0xa1d1b298.
FAILURE: 0x76ffa13a12f7ec62 != 0x76ffa13a12f5ec62 at offset 0xa1d1b2a0.
@helderjnpinto
helderjnpinto / memtester
Created November 15, 2022 14:46
memtester Asus tyf a 15
memtester version 4.5.1 (64-bit)
Copyright (C) 2001-2020 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).
pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 24576MB (25769803776 bytes)
got 24576MB (25769803776 bytes), trying mlock ...locked.
Loop 1/5:
Stuck Address : ok
@helderjnpinto
helderjnpinto / decode_ethers_revertReason.js
Created September 1, 2022 17:11
ethers decode revertReason besu ethereum
const { revertReason } = await ethers.provider.send('eth_getTransactionReceipt', [error.transaction.hash])
const output = revertReason.slice(2)
const strLen = parseInt(output.slice(8 + 64, 8 + 128), 16)
const reason = ethers.utils.toUtf8String('0x' + output.slice(8 + 128, 8 + 128 + (strLen * 2)))
console.log('🚀 ~ reason', reason)
console.log('with abi decoder', ethers.utils.defaultAbiCoder.decode(['string'], ethers.utils.hexDataSlice(revertReason, 4))[0])
@helderjnpinto
helderjnpinto / ArraysViews.sol
Created June 10, 2022 22:35
Working with views dinamic arrays in solidity
pragma solidity ^0.8.14;
// SPDX-License-Identifier: GPL-3.0
pragma experimental ABIEncoderV2;
contract Money {
struct People{
uint id;
string name;
uint amount;
}
mapping (uint => People) public peoples;
@helderjnpinto
helderjnpinto / contracts...5_ContractWallet.sol
Created May 11, 2022 15:13
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.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol";
abstract contract AUSD {
/**
* @dev Returns the cost of withdraw
* @param sig is the withdraw method signature
@helderjnpinto
helderjnpinto / contracts...earnw.sol
Created April 29, 2022 14:11
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.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// Sources flattened with hardhat v2.6.0 https://hardhat.org
// File contracts/IEarn.sol
pragma solidity ^0.8.0;
/**
* @title IEarn interface
* @dev Interface only available with stake and unstake methods used in FactoryEarnDepositRelayer
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the