Skip to content

Instantly share code, notes, and snippets.

@rutsky
rutsky / README.md
Created July 17, 2018 22:41
cgo race condition example

Ran on a laptop with 4 cores.

$ go version
go version go1.10.1 linux/amd64
$ go run cgo.go 
panic: Iteration 39068207 - receive: "y" != "\x00"

goroutine 5 [running]:
main.main.func1()
@rutsky
rutsky / README.txt
Last active June 30, 2018 13:07
pow
$ gcc -Wall -S pow.c
$ wc -l pow.s
118139 pow.s
@rutsky
rutsky / test
Created April 29, 2017 21:22
test
test
@rutsky
rutsky / backoff_asyncio_example.py
Created January 30, 2017 12:14
Example of backoff usage with asyncio
import asyncio
import logging
import aiohttp
import backoff
@backoff.on_exception(backoff.expo,
aiohttp.errors.ClientError,
max_tries=8)
@rutsky
rutsky / CMakeLists.txt
Created January 17, 2017 00:38
Place 8 Queens on Chessboard
project(eight_queens)
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
@rutsky
rutsky / README.rst
Last active January 15, 2017 15:05
Single-file buildbot-worker using PyInstaller

Clone gist:

git clone https://gist.github.com/9f6e5b84050a31b1c4ef10e3a1d86f51.git single-file-buildbot-worker
cd single-file-buildbot-worker

Build with:

sudo docker run -ti -v ${PWD}:/src/ --rm python:2.7 /src/build.sh

If all went fine, generated single-file buildbot-worker will be in

@rutsky
rutsky / bug1760.yaml
Created August 2, 2016 18:42
swagger-ui response render bug
swagger: '2.0'
info:
version: 1.0.0
title: Sample for testing display of reponse models
description: |
It seems like display of response models in swagger-ui depends on how they're defined.
Particularly, whether they're referenced or in line. It should not matter.
basePath: /sample
produces:
- application/json
@rutsky
rutsky / install.log
Created April 19, 2016 20:11
Install Buildbot master[docs] without enchant native library
$ sudo docker run -ti --rm -v $PWD/buildbot:/buildbot python:2.7 /bin/bash
root@7d76ec1e95ad:/# pip install -e /buildbot/master/[docs]
Obtaining file:///buildbot/master
Collecting Twisted>=14.0.1 (from buildbot===0.9.0b8-67-g9f3e79a)
Downloading Twisted-16.1.1.tar.bz2 (2.9MB)
100% |████████████████████████████████| 2.9MB 367kB/s
Collecting Jinja2>=2.1 (from buildbot===0.9.0b8-67-g9f3e79a)
Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
100% |████████████████████████████████| 266kB 2.4MB/s
Collecting zope.interface>=4.1.1 (from buildbot===0.9.0b8-67-g9f3e79a)
@rutsky
rutsky / docker2.log
Created February 9, 2016 19:08
Log of Docker 1.10.0 after start
time="2016-02-09T21:51:11.585544668+03:00" level=debug msg="docker group found. gid: 999"
time="2016-02-09T21:51:11.585602876+03:00" level=debug msg="Server created for HTTP on unix (/var/run/docker.sock)"
time="2016-02-09T21:51:11.585713633+03:00" level=debug msg="Using default logging driver json-file"
time="2016-02-09T21:51:11.585736796+03:00" level=debug msg="[graphdriver] trying provided driver \"overlay\""
time="2016-02-09T21:51:11.588455120+03:00" level=debug msg="Using graph driver overlay"
time="2016-02-09T21:51:11.676007058+03:00" level=debug msg="could not get checksum for \"061ea850f8e9bb47a04edf49c745c94a21dbb1a8bbced6bcd857c5fc699bc9a7\" with tar-split: \"open /var/lib/docker/graph/061ea850f8e9bb47a04edf49c745c94a21dbb1a8bbced6bcd857c5fc699bc9a7/tar-data.json.gz: no such file or directory\""
time="2016-02-09T21:51:11.676032346+03:00" level=debug msg="could not get checksum for \"0e57c609ffa9cf52d8e508554c2ca1e9af5a5dea226615ff58c421abfd4622d0\" with tar-split: \"stat /var/lib/docker/overla
@rutsky
rutsky / docker.log
Created February 9, 2016 13:18
Docker 1.10.0 fails to start
time="2016-02-09T16:15:21.565920451+03:00" level=debug msg="docker group found. gid: 999"
time="2016-02-09T16:15:21.565995328+03:00" level=debug msg="Server created for HTTP on unix (/var/run/docker.sock)"
time="2016-02-09T16:15:21.566129065+03:00" level=debug msg="Using default logging driver json-file"
time="2016-02-09T16:15:21.566163400+03:00" level=debug msg="[graphdriver] trying provided driver \"overlay\""
time="2016-02-09T16:15:21.568068833+03:00" level=debug msg="Using graph driver overlay"
time="2016-02-09T16:15:21.673983839+03:00" level=debug msg="could not get checksum for \"11421c362701030998085de69fbef501e4c16f91c2f008d820124808a4ddfe48\" with tar-split: \"open /var/lib/docker/graph/11421c362701030998085de69fbef501e4c16f91c2f008d820124808a4ddfe48/tar-data.json.gz: no such file or directory\""
time="2016-02-09T16:15:21.674026604+03:00" level=error msg="could not calculate checksum for \"11421c362701030998085de69fbef501e4c16f91c2f008d820124808a4ddfe48\", \"stat /var/lib/docker/overlay/11421c3