Skip to content

Instantly share code, notes, and snippets.

View jirfag's full-sized avatar

Denis Isaev jirfag

View GitHub Profile
@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))
}
// ...
}
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 / 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 / {
#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 / 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,
@jirfag
jirfag / inst_cent_js.sh
Created April 25, 2016 08:19
install centrifugo js client
wget https://raw.githubusercontent.com/centrifugal/centrifuge-js/master/centrifuge.js -O static/js/centrifuge.js
./manage.py collectstatic
@jirfag
jirfag / inst_cent.sh
Created April 25, 2016 08:14
Install centrifugo
wget https://github.com/centrifugal/centrifugo/releases/download/v1.4.5/centrifugo-1.4.5-linux-amd64.zip
unzip centrifugo-1.4.5-linux-amd64.zip
cd centrifugo-1.4.5-linux-amd64/
./centrifugo -h
@jirfag
jirfag / memc.conf
Created April 24, 2016 08:10
memc.conf
# memcached default config file
# 2003 - Jay Bonci <[email protected]>
# This configuration file is read by the start-memcached script provided as
# part of the Debian GNU/Linux distribution.
# Run memcached as a daemon. This command is implied, and is not needed for the
# daemon to run. See the README.Debian that comes with this package for more
# information.
-d
@jirfag
jirfag / tnt_vs_memc_bench_cfg.lua
Created April 24, 2016 08:09
tnt_vs_memc_bench_cfg.lua
-- This is default tarantool initialization file
-- with easy to use configuration examples including
-- replication, sharding and all major features
-- Complete documentation available in: http://tarantool.org/doc/
--
-- To start this example just run "sudo tarantoolctl start example" or
-- use init scripts provided by binary packages.
-- To connect to the instance, use "sudo tarantoolctl enter example"
-- Features:
-- 1. Database configuration
@jirfag
jirfag / install_es.sh
Created April 23, 2016 11:36
ElasticSearch instllation on ubuntu for Django Haystack
# wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
# echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
# sudo apt-get update
# sudo apt-get install –y openjdk-7-jre-headless elasticsearch
# pip install elasticsearch