This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
If the topic has no messages, the kafka reader starts to report | |
"the kafka reader got an unknown error reading partition x of my-topic at offset y: unexpected EOF", | |
see https://github.com/segmentio/kafka-go/issues/814. | |
$ go run main.go | |
2022/01/13 14:10:09 read message: fizz | |
2022/01/13 14:10:27 the kafka reader got an unknown error reading partition 0 of mytopic at offset 1: unexpected EOF | |
^C | |
2022/01/13 14:10:30 failed to read a message: context canceled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
"math/rand" | |
"time" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:groovy as build | |
RUN apt-get update && \ | |
apt-get install -y git flex bison llvm cmake clang libclang-dev libelf-dev libcap-dev python3-setuptools && \ | |
apt-get autoremove -y && \ | |
apt-get clean && \ | |
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
WORKDIR /opt/ | |
RUN git clone https://github.com/iovisor/bcc.git && \ | |
mkdir ./bcc/build/ && \ | |
cd ./bcc/build/ && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"editor.fontSize": 16, | |
"editor.autoClosingBrackets": "never", | |
"editor.matchBrackets": "never", | |
"editor.quickSuggestions": { | |
"comments": "off", | |
"strings": "off", | |
"other": "off" | |
}, | |
"editor.renderLineHighlight": "none", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// redisArgs prepends a Redis key to Redis values slice. | |
// For example, we want to add "key1" to ["val1", "val2"] Redis values. | |
// The result will be ["key1", "val1", "val2"]. | |
func redisArgs(key string, values ...string) []interface{} { | |
args := make([]interface{}, 0, len(values)+1) | |
args = append(args, key) | |
for _, v := range values { | |
args = append(args, v) | |
} | |
return args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function range(n) { | |
list = []; | |
for (var i = 0; i < n; i++) { | |
list[i] = i; | |
} | |
return list; | |
} | |
function show_items_by_indices(source_set, indices) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://docs.wand-py.org | |
from wand.image import Image | |
with Image(filename='original.gif') as img: | |
img.rotate(90) | |
img.resize(150, 150) | |
img.save(filename='converted.gif') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"auto_complete": false, | |
"auto_match_enabled": false, | |
"close_windows_when_empty": false, | |
"open_files_in_new_window": false, | |
"remember_open_files": false, | |
"ensure_newline_at_eof_on_save": true, | |
"trim_trailing_white_space_on_save": true, | |
"translate_tabs_to_spaces": true, | |
"fold_buttons": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@register.simple_tag | |
def fit_words_to_block(src_text, max_str_len, max_str_qty=None): | |
"""Truncates words from text thus they might be fitted to size of symbols block. | |
Also it can limit quantity of strings. | |
""" | |
if not src_text.strip(): | |
return u'' | |
words = [] |