Skip to content

Instantly share code, notes, and snippets.

View zzir's full-sized avatar
🆒
e^(iπ) + 1 = 0

zzir zzir

🆒
e^(iπ) + 1 = 0
View GitHub Profile
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func main() {
package echopprof
import (
"github.com/labstack/echo/v4"
"net/http"
"net/http/pprof"
"sync"
)
type customEchoHandler struct {
@zzir
zzir / weighted_random.go
Last active November 29, 2022 03:43
golang weighted random
package main
import (
"encoding/json"
"fmt"
"math/rand"
"time"
)
func IterMethod() string {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zzir
zzir / A-ExpJ.py
Last active November 29, 2022 04:34
Weighted random
# RECOMMENDED READING
# https://lotabout.me/2018/Weighted-Random-Sampling/
# https://www.cnblogs.com/UnGeek/p/5917995.html
import random
import collections as coll
data = {"A": 2, "B": 2, "C": 4, "D": 6, "E": 11}
# http://tools.ietf.org/html/rfc4226
# http://tools.ietf.org/html/rfc6238
import hmac
import base64
import struct
import hashlib
import time
import sys
package main
import (
"crypto/hmac"
"crypto/sha1"
"encoding/base32"
"fmt"
"os"
"strings"
"time"