Skip to content

Instantly share code, notes, and snippets.

View valterlobo's full-sized avatar

Valter Lobo valterlobo

View GitHub Profile
@valterlobo
valterlobo / PostgreSQL-active-conection.md
Last active April 20, 2021 16:33
PostgreSQL active connection

select pid as process_id, usename as username, datname as database_name, client_addr as client_address, application_name, backend_start, state, state_change from pg_stat_activity;

@valterlobo
valterlobo / gist:491ebdfe4cc76a85efb14ca6b9116131
Last active May 7, 2022 17:06
Golang Transaction - Duvidas em pseudo-código
func criarDado(sql.Tx, ctx, dado Dado) (error) {
}
func criarItem(sql.Tx, ctx, item Item) (error) {
}
pedido ( dado:Dado, itens:[]Item )
@valterlobo
valterlobo / js
Last active July 1, 2022 00:56
javascript sleep async
async function main() {
async function bot(cod) {
console.log("START BOOT:", cod);
let i = 0;
while (i < 10000) {
i++;
}
console.log("END BOOT:", cod);
}
@valterlobo
valterlobo / gist:5c8fd88a9534897fdad751ba9afdb66c
Created July 14, 2022 02:34
Blockchain in DeFi - Smart Contracts
Blockchain in DeFi - Smart Contracts
- AMM (Only Uniswap V2, Fork it)
- Lending (Collateralized Lending)
- ERC 20 (Fungible Token Standard)
- Vaults (Decentralized Crypto Safe Storing)
- Staking (Deposit Token Into Contract for Yield)
- Flash Loans (Borrow Crypto Without Collateral)
- Airdrop (Giveaway Token for Marketing Purposes)
@valterlobo
valterlobo / todolist.sol
Last active August 18, 2022 03:09
TODO LIST
pragma solidity ^0.8.9;
// import "hardhat/console.sol";
//Todo list do Jhon
contract Todolist {
struct Todo {
string todo;
bool isCompleted;
uint256 todoId;
address owner;
Pull from remote overwriting local changes.
i) git stash (revert and stash changes locally)
ii) git pull (pull from remote normally)
to retrieve changes, do
'git stash apply'
Delete only untracked files from working tree
git clean -f -d
@valterlobo
valterlobo / gas_array.sol
Created September 22, 2022 13:11
Solidity : gas array
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract Gas_Test{
uint[] public arrayFunds;
uint public totalFunds;
constructor() {
arrayFunds = [1,2,3,4,5,6,7,8,9,10,11,12,13];
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract CrudSimples {
struct Pessoa {
string name;
uint8 idade;
uint id;
@valterlobo
valterlobo / TRANSFER_WEB3_PY
Created March 9, 2023 15:37
TRANSFER ETH AND ERC 20
import os
from dotenv import load_dotenv
from web3 import Web3
load_dotenv()
# ERC 20 SEND
@valterlobo
valterlobo / pass-getting-started.md
Created March 15, 2023 21:32 — forked from layoaster/pass-getting-started.md
Cheat sheet/ getting-started guide to pass

pass cheat sheet/guide

Getting started guide to the unix password manager pass. Manage gpg encripted passwords (files) in a standar directory-like hierarchy. Such files can be copied or stored in a git repository.

Requirements

  1. Install [pass][pass-homepage] (standard unix password manager):

Ubuntu/Debian:

$ sudo apt-get install pass