Skip to content

Instantly share code, notes, and snippets.

View bayucandra's full-sized avatar
🙂

Bayu Candra bayucandra

🙂
View GitHub Profile
@bayucandra
bayucandra / download.go
Created April 7, 2022 09:52 — forked from albulescu/download.go
golang download file with progress
package main
/**
* @website http://albulescu.ro
* @author Cosmin Albulescu <cosmin@albulescu.ro>
*/
import (
"bytes"
"fmt"
package main
//https://play.golang.org/p/_iu24fTdt57
import (
"fmt"
"regexp"
)
func main() {
str := `an..19` //https://en.wikipedia.org/wiki/ISO_8583#Examples_3
@bayucandra
bayucandra / self-signed-certificate-with-custom-ca.md
Created January 3, 2020 01:50 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@bayucandra
bayucandra / mongo-get-duplicate-field.go
Created December 16, 2019 02:47
Mongo get duplicate field by using regular expression
package main
import (
"fmt"
"regexp"
)
func main() {
errStr := `rpc error: code = AlreadyExists desc = multiple write errors: [{write errors: [{E11000 duplicate key error ` +
`collection: mai_webmin_inventory_service.groups index: unique_name dup key: { name: "aa1234" }}]}, {<nil>}]`