Skip to content

Instantly share code, notes, and snippets.

@akovardin
akovardin / Makefile
Created October 21, 2018 20:17
Makefile for Go Projects
GOPATH=$(shell pwd)/vendor:$(shell pwd)
GOBIN=$(shell pwd)/bin
GOFILES=$(wildcard *.go)
GONAME=$(shell basename "$(PWD)")
PID=/tmp/go-$(GONAME).pid
build:
@echo "Building $(GOFILES) to ./bin"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -o bin/$(GONAME) $(GOFILES)
@akovardin
akovardin / cr.bash
Last active October 10, 2018 13:39
Все кроны
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
@akovardin
akovardin / event.go
Created August 6, 2018 09:43
Unblock Send
package mcalc
import (
"context"
"github.com/propellerads/offer-api/app/log/field"
"go.uber.org/zap"
)
type EventSender struct {
@akovardin
akovardin / errgroup.go
Created August 1, 2018 10:44
errgroup
package gateway
import (
"context"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"google.golang.org/grpc"
"golang.org/x/sync/errgroup"
@akovardin
akovardin / md5-example.go
Last active July 26, 2018 17:31 — forked from sergiotapia/md5-example.go
Go MD5 string
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@akovardin
akovardin / image-proxy.conf
Created July 11, 2018 11:05 — forked from tmaiaroto/image-proxy.conf
Nginx Image Filter Resize Proxy Service
# Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below).
proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G;
# Gzip was on in another conf file of mine...You may need to uncomment the next line.
#gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 4;
gzip_proxied any;
# Again, be careful that you aren't overwriting some other setting from another config's http {} section.
@akovardin
akovardin / g.bash
Created July 3, 2018 14:47
Go get from https
git config --global url."git@gitlab.com:".insteadOf "https://gitlab.com/"
@akovardin
akovardin / nil_receiver.go
Created July 3, 2018 09:21
Nill in receiver
package main
import (
"fmt"
)
type Example struct {
id int
}
@akovardin
akovardin / map.go
Created July 3, 2018 09:20
Map modification
package main
import (
"fmt"
)
func call() {
mm := m()
fmt.Println(mm)
@akovardin
akovardin / controlller.swift
Created July 2, 2018 20:55
Кнопки в тулбар
let addButton:UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(FeedsController.add))
self.navigationItem.setRightBarButtonItems([addButton], animated: true)