This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Removing mysql completely | |
| sudo apt-get remove --purge mysql-server mysql-client mysql-common -y | |
| sudo apt-get autoremove -y | |
| sudo apt-get autoclean | |
| rm -rf /etc/mysql | |
| sudo find / -iname 'mysql*' -exec rm -rf {} \; | |
| Installing mysql: | |
| sudo apt install mysql-server mysql-client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Golang doesn't have python-Django like decorators but here is | |
| //a small example of what you can do | |
| package main | |
| import "github.com/gin-gonic/gin" | |
| func Handler(h gin.HandlerFunc, decors ...func(gin.HandlerFunc)gin.HandlerFunc) gin.HandlerFunc { | |
| for i := range decors { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import "crypto/rand" | |
| func generateRandomSecret(size int) string { | |
| alphanum := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefbgijklmnopqrstuvwxyz0123456789" | |
| var bytes = make([]byte, size) | |
| rand.Read(bytes) | |
| for i, b := range bytes { | |
| bytes[i] = alphanum[b%byte(len(alphanum))] | |
| } | |
| return string(bytes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package secure | |
| import ( | |
| "crypto/aes" | |
| "crypto/cipher" | |
| "encoding/hex" | |
| "fmt" | |
| "crypto/sha512" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "github.com/satori/go.uuid" //for uuid | |
| "gopkg.in/validator.v2" | |
| "reflect" | |
| "regexp" | |
| "time" | |
| ) |