Skip to content

Instantly share code, notes, and snippets.

View inesusvet's full-sized avatar
🇬🇧
You know: fish, chips, cup 'o tea, bad food, worse weather, Mary flippin Poppins

Ivan Styazhkin inesusvet

🇬🇧
You know: fish, chips, cup 'o tea, bad food, worse weather, Mary flippin Poppins
View GitHub Profile
@inesusvet
inesusvet / Dockerfile
Last active October 28, 2021 08:38
Simple HTTP server to accept file uploads and serve files from work dir
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"]
@inesusvet
inesusvet / README.md
Created September 8, 2020 14:43
Benchmark file read from disk, CSV parsing, write and read operations to Redis or Memcached

Test scenario

Benchmark file read from disk, CSV parsing, write and read operations to Redis or Memcached

Environment info:

$ python --version
Python 2.7.10
$ pip freeze |grep -E 'redis|memcached'
@inesusvet
inesusvet / gibberish.txt
Created June 15, 2020 16:02
A sample file to analyze
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.
@inesusvet
inesusvet / reversed.py
Created March 14, 2019 22:54
Coding dojo session result from 2019-03-14
"""
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).
"""
@inesusvet
inesusvet / reverse_polish.py
Created February 24, 2019 14:49
Coding dojo in Minsk session result for 2019-02-24
"""
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).
@inesusvet
inesusvet / space.py
Created February 23, 2019 13:54
Introduction to Python 2019-02-23
a = 'space'
print(a)
a = 100500
print(a)
a = -6.5
print(a)
@inesusvet
inesusvet / randomize.py
Created February 9, 2019 18:19
Simple script for a PR Tsar duties - I want to distribute incoming PRs evenly in the team. Cats are the power here
#!/usr/bin/env python
import random
NAME_TO_GITHUB = {
'Adam': 'ajbeairsto',
'Ihor': 'ikalnytskyi',
'Ivan': 'inesusvet',
'Maddie': 'madmott',
'Roman P': 'malor',
'Roman K': 'romankolpak',
@inesusvet
inesusvet / love_vs_friendship.py
Created February 9, 2019 13:04
Coding dojo in Minsk session result for 2019-02-09
"""
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 :-)
@inesusvet
inesusvet / leo.py
Created February 3, 2019 17:01
Simple performance test of a VigenereCipher class on text of a famous book by Leo Tolstoy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Можно скачать Войну и Мир здесь
http://vojnaimir.ru/files/book1.txt
http://vojnaimir.ru/files/book2.txt
"""
import codecs