Skip to content

Instantly share code, notes, and snippets.

Working from home


Working from home
View GitHub Profile
dakait / help.txt
Last active Mar 29, 2019
Mysql install/remove
View help.txt
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
dakait / decorators.go
Created Aug 29, 2018
Chaining handler functions with gin
View decorators.go
//Golang doesn't have python-Django like decorators but here is
//a small example of what you can do
package main
import ""
func Handler(h gin.HandlerFunc, decors ...func(gin.HandlerFunc)gin.HandlerFunc) gin.HandlerFunc {
for i := range decors {
dakait / code.go
Created Aug 29, 2018
Generate random code golang
View code.go
import "crypto/rand"
func generateRandomSecret(size int) string {
alphanum := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefbgijklmnopqrstuvwxyz0123456789"
var bytes = make([]byte, size)
for i, b := range bytes {
bytes[i] = alphanum[b%byte(len(alphanum))]
return string(bytes)
dakait / cipher.go
Last active Dec 18, 2020
AES-256 GCM Encryption/Decryption Example in Golang
View cipher.go
package secure
import (
dakait / validators.go
Last active Aug 28, 2018
Golang Custom Validator examples
View validators.go
package main
import (
"" //for uuid