Skip to content

Instantly share code, notes, and snippets.

View nikos-glikis's full-sized avatar

Nikos Glikis nikos-glikis

View GitHub Profile
int32(time.Now().Unix())
func addToLog(text string, logfile string) {
f, err := os.OpenFile(logfile, os.O_APPEND|os.O_WRONLY, 0600)
if err != nil {
panic(err)
}
defer f.Close()
if _, err = f.WriteString(text); err != nil {
$binPhash = base_convert($phash, 16, 2);
@nikos-glikis
nikos-glikis / my.ini
Created June 3, 2018 15:57
uniform conf
#######################################################################
# File name: my.ini
# Created By: The Uniform Server Development Team
# Edited Last By: Mike Gleaves (ric)
# V 1.0 24-7-2016
########################################################################
[mysql]
default-character-set=utf8
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208
# Configuration name server generated for a1565408@mvrht.net at 2018-06-10 10:08:14
[mysql]
# CLIENT #
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysqld]
@nikos-glikis
nikos-glikis / kill
Created March 26, 2019 16:44
Golang handle kill signal
var gracefulStop = make(chan os.Signal)
signal.Notify(gracefulStop, syscall.SIGTERM)
signal.Notify(gracefulStop, syscall.SIGINT)
go func() {
sig := <-gracefulStop
fmt.Printf("caught sig: %+v", sig)
fmt.Println("Wait for 5 second to finish processing")
time.Sleep(5 * time.Second)
os.Exit(0)
}()