Skip to content

Instantly share code, notes, and snippets.

View andreimerlescu's full-sized avatar
💻
Programming In Go

Andrei Merlescu andreimerlescu

💻
Programming In Go
View GitHub Profile
This NFT represents $APARIO DAO NFT Owner ##/47 of Project Apario LLC. Congratulations!
Owning this NFT grants you a position on the Project Apario Decentralized Autonomous Organization.
Project Apario LLC will be lead by this Decentralized Autonomous Organization by means of voting rights on the project's tokenomics and direction. It additionally will provide you exclusive access to the dedicated web application dao.apario.app where you'll be able to manage your ownership rights over Project Apario LLC.
Purchasing this NFT directly funds Project Apario but does not contribute anything to the APARIO/XRP AMM liquidity pool. The proceeds from this NFT will be used for compensating the development team for their labor.
Royalties on this NFT are 50% and whenever a deposit of XRP reaches Project Apario due to a resell of ownership of the token, 75% of those proceeds will be air dropped equally to all $APARIO DAO NFT owners. This is performed manually by the team members at Project Apario who manage the softwar
@andreimerlescu
andreimerlescu / go_gin_tls_tutorial.md
Last active June 10, 2023 19:38
Go + Gin + A Better Way To Do TLS/SSL

Golang w/ Gin and TLS/SSL Auto-Configuration

Sometimes you need SSL, and sometimes you want to use a self signed certificate, and sometimes you want to handle certificate rotations behind the scenes without restarting the application. This tutorial will introduce an alternative way to serve TLS/SSL with Go and Gin by leveraging a few packages that I've created to provide a seemless experience to the engineer setting up TLS for their Go Gin application.

main()

package main

import (
@andreimerlescu
andreimerlescu / go_flag_usage.go
Created June 10, 2023 14:10
Format Go Flag Into Human Readable Output
flag.Usage = func() {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "%v [FLAGS]\n", os.Args[0])
fmt.Fprintln(w, "Flag\tDefault\tDescription")
nl, dl, ul := 4, 7, 11
out := ""
flag.VisitAll(func(f *flag.Flag) {
out += fmt.Sprintf("-%s\t%s\t%s\n", f.Name, f.DefValue, f.Usage)
if len(f.Name)+1 > nl {
nl = len(f.Name) + 1
REGEX_1 = /(\d{1,2})[st|nd|rd|th]?{2}\s{1}(January|Jan|February|Feb|March|Mar|April|Apr|May|June|Jun|July|Jul|August|Aug|September|Sep|October|Oct|November|Nov|December|Dec),?\s(\d{2,4})/
REGEX_2 = /(January|Jan|February|Feb|March|Mar|April|Apr|May|June|Jun|July|Jul|August|Aug|September|Sep|October|Oct|November|Nov|December|Dec)\s{1}(0\d{1}|\d{1,2})[st|nd|rd|th]{2}?(,?)\s(\d{2,4})/
REGEX_3 = /(0\d{1}|\d{1}|1\d{1})\/(0\d{1}|\d{1}|1\d{1})\/(\d{2,4})/
MONTH_STR_TO_NUM={
"JANUARY": 1,
"January": 1,
"Jan": 1,
"FEBRUARY": 2,
"February": 2,
"Feb": 2,
m,
`$b
.ss, $$: .,d$
`$$P,d$P' .,md$P"'
,$$$$$b/md$$$P^'
.d$$$$$$/$$$P'
$$^' `"/$$$' ____ _ _ _ _
$: ,$$: / ___|(_) __| | ___| | _(_) __ _
`b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` |
m,
`$b
.ss, $$: .,d$
`$$P,d$P' .,md$P"'
,$$$$$b/md$$$P^'
.d$$$$$$/$$$P'
$$^' `"/$$$' ____ _ _ _ _
$: ,$$: / ___|(_) __| | ___| | _(_) __ _
`b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` |
m,
`$b
.ss, $$: .,d$
`$$P,d$P' .,md$P"'
,$$$$$b/md$$$P^'
.d$$$$$$/$$$P'
$$^' `"/$$$' ____ _ _ _ _
$: ,$$: / ___|(_) __| | ___| | _(_) __ _
`b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` |
# ⇒ ruby string_find_test.rb
# Started 2020-01-02 15:20:04 -0500
# Ended 2020-01-02 15:20:05 -0500
# Speed 1.7854981422424316s
#
#
#
# Started 2020-01-02 15:20:05 -0500
# Ended 2020-01-02 15:20:09 -0500
# Speed 3.125840902328491s

To run a Docker Registry via Docker-Compose with HTPASSWD Auth

1. Recommended Minimum Purchases

The total cost of your setup is going to be $204.27/year ($17.03/month or 2 cups of Coffee at Starbucks) What you'll get is a private docker registry (v2) with 100GB of dedicated storage for your containers.

  1. Create a $5 VM by signing up for DigitalOcean and deploying a Marketplace Docker container. Make sure you add Block Storage! $100GB for $10/month is not expensive and you will thank me later. I also recommend you enable backups for $1.00/mmonth.
  2. Register an awesome domain name at Epik (.xyz domains are $0.89 for the first year [2019] and then just $8.50/year thereafter)
  3. Purchase a $3.77/year SSL certificate from ssls.com