Benchmark file read from disk, CSV parsing, write and read operations to Redis or Memcached
$ python --version
Python 2.7.10
$ pip freeze |grep -E 'redis|memcached'
FROM golang:1.15.5-alpine AS builder | |
ADD catcher.go /go/ | |
RUN go build catcher.go | |
FROM alpine | |
COPY --from=builder /go/catcher /bin | |
CMD ["/bin/catcher"] |
may out come come at your him when be down like people and from which is now have were at that one but would by other the other | |
time with then hot would and | |
know of was day a see down people see may your people other first with who no most was then of him the it one my other | |
time about one about so word use said first many who way which the each call be in there were people and call her than them number can out all has were have | |
who than out would or at can we know | |
sound see may use have was but are you then other about be her at had has way we if long call many one has day be sound an could | |
have we may so day her at an number her the it | |
out who she or other at use at most said by first | |
what call a thing each how a a we who them were them at as other people do hot who number some down been there | |
so there this it from or there |
LINES = """ | |
Thank you for asking, but that isn't going to work out for me. | |
Thank you for asking, but I'm not doing any interviews while I'm writing my book. | |
I want to do that, but I'm not available until April. Will you ask me again then? | |
I can't do it, but I'll bet Shelly can. I'll ask her for you. | |
None of those dates work for me, but I would love to see you. Send me some more dates. | |
I can't put anything else on my calendar this month, but I'd love to do that with you sometime. Will you call me right before you go again? | |
Thank you so much for your enthusiasm and support! I'm sorry I'm not able to help you at this time. | |
You know, I feel like moms are always getting to do the holiday parties at school. Let's ask Dad if he wants to help this year. | |
I can't speak at your event, but I will help you promote it on my blog. |
""" | |
See https://www.codewars.com/kata/reverse-polish-notation-calculator | |
Your job is to create a calculator which evaluates expressions in Reverse Polish notation. | |
For example expression 5 1 2 + 4 * + 3 - (which is equivalent to 5 + ((1 + 2) * 4) - 3 in normal notation) should evaluate to 14. | |
For your convenience, the input is formatted such that a space is provided between every token. | |
Empty expression should evaluate to 0. | |
Valid operations are +, -, *, /. | |
You may assume that there won't be exceptional situations (like stack underflow or division by zero). | |
""" |
""" | |
See https://www.codewars.com/kata/reverse-polish-notation-calculator | |
Your job is to create a calculator which evaluates expressions in Reverse Polish notation. | |
For example expression 5 1 2 + 4 * + 3 - (which is equivalent to 5 + ((1 + 2) * 4) - 3 in normal notation) | |
should evaluate to 14. | |
For your convenience, the input is formatted such that a space is provided between every token. | |
Empty expression should evaluate to 0. | |
Valid operations are +, -, *, /. | |
You may assume that there won't be exceptional situations (like stack underflow or division by zero). |
a = 'space' | |
print(a) | |
a = 100500 | |
print(a) | |
a = -6.5 | |
print(a) | |
#!/usr/bin/env python | |
import random | |
NAME_TO_GITHUB = { | |
'Adam': 'ajbeairsto', | |
'Ihor': 'ikalnytskyi', | |
'Ivan': 'inesusvet', | |
'Maddie': 'madmott', | |
'Roman P': 'malor', | |
'Roman K': 'romankolpak', |
""" | |
See https://www.codewars.com/kata/love-vs-friendship/train/python | |
If a = 1, b = 2, c = 3 ... z = 26 | |
Then l + o + v + e = 54 | |
and f + r + i + e + n + d + s + h + i + p = 108 | |
So friendship is twice stronger than love :-) |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Можно скачать Войну и Мир здесь | |
http://vojnaimir.ru/files/book1.txt | |
http://vojnaimir.ru/files/book2.txt | |
""" | |
import codecs |