Skip to content

Instantly share code, notes, and snippets.

View fernandoporazzi's full-sized avatar

Fernando Porazzi fernandoporazzi

  • Bitvavo
  • Amsterdam
View GitHub Profile
@fernandoporazzi
fernandoporazzi / sign-previous-commits.md
Created September 2, 2025 09:52 — forked from sbolel/sign-previous-commits.md
How to sign previous commits in a PR

To sign all your commits in the Git Pull Request (PR), you can use a combination of git rebase and git commit --amend. Here are the steps:

  1. Before starting, make sure you've configured Git to use your signing key. You can do this with:

    git config --global user.signingkey YOUR_SIGNING_KEY
    git config --global commit.gpgsign true

    Replace YOUR_SIGNING_KEY with your GPG key ID.

  2. Then you need to start an interactive rebase with the parent of your first commit. If you don't know what commit that is, you can use git log to display your commit history. Once you have your commit hash, start the rebase:

@fernandoporazzi
fernandoporazzi / main.c
Created May 9, 2025 14:05
Open ports scanner
#include <stdio.h>
#include <sys/socket.h>
#include <errno.h>
#include <netdb.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <time.h>
@fernandoporazzi
fernandoporazzi / recursos-nostr-em-portugues.md
Last active May 5, 2025 17:51
Recursos Nostr em Português

TL;DR: nostr1 é um protocolo que tem o poder de substituir ferramentas como Twitter, Telegram e etc.


O que é nostr?

Nostr é algo novo e confuso, mas ao mesmo tempo é algo muito legal. Nostr é o protocolo aberto mais simples que é capaz de criar uma rede social global que é resistente a censuras de uma vez por todas.

Footnotes

  1. nostr = Notes and Other Stuff Transmitted by Relays

package main
import (
"fmt"
"github.com/fernandoporazzi/blockchain-golang/blockchain"
)
func main() {
blockchain := blockchain.CreateBlockchain()
func (b *Blockchain) CreateGenesisBlock() {
block := block.CreateBlock()
block.Index = 0
block.PreviousHash = "0000000000000000000000000000000000000000000000000000000000000000"
block.Data = "Genesis Block"
block.Difficulty = b.Difficulty
block.Mine()
package blockchain
import (
"github.com/fernandoporazzi/blockchain-golang/block"
)
type Blockchain struct {
Blocks []block.Block
Index int
Difficulty int
func (b *Block) GenerateHash() {
index := strconv.Itoa(b.Index)
nonce := strconv.Itoa(b.Nonce)
b.Hash = fmt.Sprintf("%x", sha256.Sum256([]byte(index+b.PreviousHash+b.Data+b.Timestamp.String()+nonce)))
}
func (b *Block) Mine() {
prefix := getPrefix(b.Difficulty)
package block
import (
"time"
)
type Block struct {
Index int
PreviousHash string
Data string
package main
import (
"fmt"
"strings"
)
func CompareTwoStrings(stringOne, stringTwo string) float32 {
removeSpaces(&stringOne, &stringTwo)
package main
import "fmt"
func main() {
urls := []string{"github.com",
"twitter.com",
"facebook.com",
"instagram.com"}