Skip to content

Instantly share code, notes, and snippets.

View sharonjl's full-sized avatar

Sharon L sharonjl

View GitHub Profile
@sharonjl
sharonjl / decode_base58.sql
Created June 23, 2024 22:07
postgresql base58 encode/decode
-- Decode Base58
-- Based on https://digitalbazaar.github.io/base58-spec/
CREATE OR REPLACE FUNCTION decode_base58(input TEXT)
RETURNS BYTEA AS $$
DECLARE
base58_decode_map CONSTANT TEXT := '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
num BYTEA := E'\\x00';
char CHAR;
value INT;
carry INT;
@sharonjl
sharonjl / queue.go
Created November 17, 2022 18:25
postgresql queue with gorm
package pg
import (
"context"
"errors"
"fmt"
"time"
"github.com/google/uuid"
"gorm.io/gorm"
@sharonjl
sharonjl / queue.go
Last active August 10, 2022 01:45
basic queue in go (untested)
package queue
import "sync"
type Queue[T any] struct {
items []T
mu sync.RWMutex
}
func New[T any]() *Queue[T] {
@sharonjl
sharonjl / Canada
Created September 21, 2021 00:50
Timezones
America/Atikokan
America/Blanc-Sablon
America/Cambridge_Bay
America/Creston
America/Dawson
America/Dawson_Creek
America/Edmonton
America/Fort_Nelson
America/Glace_Bay
America/Goose_Bay