Skip to content

Instantly share code, notes, and snippets.

@renowncoder
renowncoder / tinkrsa.go
Created January 18, 2026 06:18 — forked from salrashid123/tinkrsa.go
tink-golang sign/verify and extract rsa.PublicKey
package main
import (
"bytes"
"crypto"
"crypto/rsa"
"crypto/sha256"
"crypto/x509"
"encoding/json"
"encoding/pem"
@renowncoder
renowncoder / UUIDv6.sql
Created September 21, 2025 04:10 — forked from fabiolimace/UUIDv6.sql
Functions for generating UUIDv6 and UUIDv7 on PostgreSQL
/*
* MIT License
*
* Copyright (c) 2023-2024 Fabio Lima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@renowncoder
renowncoder / ksuid.sql
Created September 21, 2025 04:09 — forked from fabiolimace/ksuid.sql
Functions for generating Segment's KSUIDs on PostgreSQL
/*
* MIT License
*
* Copyright (c) 2023 Fabio Lima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@renowncoder
renowncoder / json_read.go
Created January 27, 2024 06:42 — forked from sugab/json_read.go
Read JSON File form a filePath. American movies dataset can be found here: https://raw.githubusercontent.com/prust/wikipedia-movie-data/master/movies.json. 200,000+ Jeopardy question dataset can be found here: https://www.reddit.com/r/datasets/comments/1uyd0t/200000_jeopardy_questions_in_a_json_file/.
package main
import (
"encoding/json"
"io/ioutil"
)
func readJSON(fileName string, filter func(map[string]interface{}) bool) []map[string]interface{} {
datas := []map[string]interface{}{}
@renowncoder
renowncoder / main.ts
Created January 25, 2024 07:58 — forked from zicklag/main.ts
Deno TLS Proxy Using Traefik `acme.json` File For Certificates
import { copy } from "https://deno.land/[email protected]/streams/conversion.ts";
const DATA_FILE = Deno.args[0];
const LISTEN_PORT = Deno.args[1];
const TARGET_ADDR = Deno.args[2];
const DOMAIN = Deno.args[3];
interface AcmeJsonFile {
letsencrypt: {
Certificates: {
package main
import (
"fmt"
"gorm.io/datatypes"
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
@renowncoder
renowncoder / json_map.go
Created January 3, 2024 21:57 — forked from jquiterio/json_map.go
JSONMap definition for gorm
import (
"database/sql/driver"
"encoding/json"
"errors"
"fmt"
"gorm.io/gorm"
"gorm.io/gorm/schema"
)
// JSONMap defiend JSON data type, need to implements driver.Valuer, sql.Scanner interface
@renowncoder
renowncoder / nullHandle_extends.go
Created January 3, 2024 21:46 — forked from rsudip90/nullHandle_extends.go
database rows null handling in go by extending types
package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"time"
"github.com/go-sql-driver/mysql"
@renowncoder
renowncoder / README.md
Created January 3, 2024 00:32 — forked from sancar/README.md
An upgradable read write lock for go

And upgradable read write lock for go

UpgradableRWMutex is an enhanced version of the standard sync.RWMutex. It has the all methods sync.RWMutex with exact same semantics. It gives more methods to give upgradable-read feature.

The new semantics for upgradable-read are as follows:

  • Multiple goroutines can get read-lock together with a single upgradable-read-lock.
  • Only one goroutine can have a write-lock and no read-lock/upgradable-read-lock can be acquired in this state.
@renowncoder
renowncoder / docker-iptables-fix.sh
Created January 2, 2024 22:51 — forked from pedrolamas/docker-iptables-fix.sh
Script to fix Docker iptables on Synology NAS
#!/bin/bash
currentAttempt=0
totalAttempts=10
delay=15
while [ $currentAttempt -lt $totalAttempts ]
do
currentAttempt=$(( $currentAttempt + 1 ))
echo "Attempt $currentAttempt of $totalAttempts..."