Skip to content

Instantly share code, notes, and snippets.

View jirfag's full-sized avatar

Denis Isaev jirfag

View GitHub Profile
@jirfag
jirfag / cent_django.js
Last active April 27, 2016 15:29
Centrifugo in Django
#static/js/answers_subscribe.js
function subscribe_to_new_answers() {
var $info = $('#answers-cent-data');
var centrifuge = new Centrifuge({
url: $info.data('cent-url'),
user: $info.data('cent-user').toString(),
timestamp: $info.data('cent-ts').toString(),
info: $info.data('cent-info'),
token: $info.data('cent-token'),
debug: false,
#search/templates/search/search.html
{% extends 'app/base.html' %}
{% block content %}
<div class="row">
<div class="col-md-12">
<form method="get" action=".">
<table>
{{ form.as_table }}
<tr>
@jirfag
jirfag / nginx_ws.conf
Created April 27, 2016 17:16
Nginx websockets config
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name ws.disaev.ru;
location / {
func (p *printer) addWhitespace(kind ctrlSymbol, text string) {
p.pending = append(p.pending, whitespace{p.lastTok, kind /*text*/})
switch kind {
case semi:
p.lastTok = _Semi
case newline:
p.lastTok = 0
// TODO(gri) do we need to handle /*-style comments containing newlines here?
}
}
@jirfag
jirfag / prealloc.go
Created July 1, 2018 12:58
Issue in Go source found by prealloc in cmd/go/internal/work/gc.go
func (gcToolchain) pack(b *Builder, a *Action, afile string, ofiles []string) error {
var absOfiles []string
for _, f := range ofiles {
absOfiles = append(absOfiles, mkAbs(a.Objdir, f))
}
// ...
}
@jirfag
jirfag / nakedret.go
Created July 1, 2018 13:12
Issue found by nakedret linter in Beego
func (d *dbBase) collectValues(mi *modelInfo, ind reflect.Value, cols []string, skipAuto bool, insert bool, names *[]string, tz *time.Location) (values []interface{}, autoFields []string, err error) {
if names == nil {
ns := make([]string, 0, len(cols))
names = &ns
}
values = make([]interface{}, 0, len(cols))
for _, column := range cols {
var fi *fieldInfo
if fi, _ = mi.fields.GetByAny(column); fi != nil {
@jirfag
jirfag / .golangci.yml
Created July 1, 2018 13:17
Golangci-Lint self config's snippet
linters-settings:
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
@jirfag
jirfag / logger.go
Created July 1, 2018 13:20
Depguard demo in golangci-lint
package logger
import (
"github.com/sirupsen/logrus" //nolint:depguard
)
@jirfag
jirfag / GolangCI_CLA.md
Last active November 20, 2022 16:25
GolangCI CONTRIBUTION LICENSE AGREEMENT

CONTRIBUTION LICENSE AGREEMENT

This Contribution License Agreement (the “CLA”) is between the individual set forth in the signature block (“You”) and Golangci OÜ, (“GolangCI”), effective as of the date of Your signature and sets forth the terms pursuant to which You provides Contributions to GolangCI.

You accept and agree to the following terms and conditions for Your present and future Contributions submitted to GolangCI. In return, GolangCI will not use Your Contributions in a way that is contrary to GolangCI’s business objectives. Except for the license granted herein to GolangCI and recipients of software distributed by GolangCI, You reserve all right, title, and interest in and to Your Contributions.

Definitions. “Contribution” means any original work of authorship, including any modifications or additions to an existing work, that You intentionally submit to GolangCI for inclusion in, or documentation of, any of the products owned or managed by GolangCI (the “Work”). “Submit” means any form of elec

prometheus:
prometheusSpec:
resources:
requests:
memory: 200Mi
limits:
memory: 500Mi
additionalScrapeConfigs:
- job_name: 'kubernetes-pods'
kubernetes_sd_configs: