Skip to content

Instantly share code, notes, and snippets.

@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 / 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)
@akovardin
akovardin / header.swift
Created July 2, 2018 20:53
Скрываем заголовок секции
tableView.contentInset = UIEdgeInsets(top: -30, left: 0, bottom: 0, right: 0)
@akovardin
akovardin / prepare.swift
Created July 2, 2018 20:52
Prepare controller
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let controller = segue.destination as! FeedController
switch sender {
case let sender as UITableViewCell:
let indexPath = tableView.indexPath(for: sender as! UITableViewCell)!
controller.feed = items[indexPath.row]
case let sender as UIBarButtonItem:
controller.feed = FeedModel()
default: