Skip to content

Instantly share code, notes, and snippets.

This is my learning towards how to generate Time Based OTP using SHA-512 algorithm.

@yusufsyaifudin
yusufsyaifudin / main_test.go
Created March 23, 2021 11:22
Implement As method to convert interface type to the right data structure as it is first write. That means, if it use struct A, it only valid to output target as A. If we re-declare struct A, it will not match since it is not the real A in the first declaration.
package main_test
import (
"fmt"
"reflect"
"testing"
)
type AnimalName string
@yusufsyaifudin
yusufsyaifudin / useful_scripts.md
Last active July 23, 2021 02:29
Useful scripts

Useful script

Tunnel Private Network to Local using SSH Tunneling

ssh -L localhost:port:remote_ip:remote_port username@<IP that have access to remote_ip>
  • Ensure that you can SSH ssh username@<IP that have access to remote_ip> (public key already added in the instance)
  • Ensure that your SSH instance can access remote target, it can be db, http or etc
@yusufsyaifudin
yusufsyaifudin / parse_json.go
Created September 15, 2021 08:23 — forked from mjohnsullivan/parse_json.go
Parse JSON objects with arbitrary key names in Go using interfaces and type assertions
// Parsing arbitrary JSON using interfaces in Go
// Demonstrates how to parse JSON with abritrary key names
// See https://blog.golang.org/json-and-go for more info on generic JSON parsing
package main
import (
"encoding/json"
"fmt"
)
@yusufsyaifudin
yusufsyaifudin / main.go
Created May 22, 2025 07:03
golang worker
package main
import (
"context"
"fmt"
"log/slog"
"os"
"os/signal"
"sync"
"sync/atomic"