Skip to content

Instantly share code, notes, and snippets.

View martin-kokos's full-sized avatar

martin-kokos martin-kokos

View GitHub Profile
@martin-kokos
martin-kokos / pv_vikend.md
Last active June 11, 2017 13:44
Python víkend: Zadání úkolu

Python víkend v Kiwi.com - vstupní úkol

Pomocí této úlohy nám prokážete, že jste s Pythonem již přišli do styku a znáte jeho základy. Tím pádem by nemělo nic bránit tomu, abyste si workshop užili a nebyl pro vás příliš složitý.

##Limitace

Žádné limitace.

  • Python2.7 nebo 3
  • všechny moduly jsou povoleny
@martin-kokos
martin-kokos / install_pip_grab.sh
Last active December 3, 2016 14:05
Install python vikend prerequisites on clean Ubuntu
#!/usr/bin/bash
apt-get install python-setuptools python-dev build-essential libcurl4-openssl-dev libssl-dev
easy_install pip
pip install grab cssselect
python -c 'import grab; print(grab.Grab().go("kiwi.com").code)'
@martin-kokos
martin-kokos / pv_booking_task.md
Last active January 15, 2018 09:41
Kiwi.com _Python víkend_ task

Kiwi.com Python víkend task

If you have applied for our Python vikend course this task serves to asess if you have sufficient knowledge to enjoy and learn something on our course.

Task

Your task is to use our flights API to find a flight and book the flight on the booking API. If it sounds too complicated. Don't worry, it's not.

APIs

Flights

We at Kiwi.com use simple APIs based on HTTP, usually with payload in JSON format. If you've never used an API click here:

@martin-kokos
martin-kokos / aiohttp_auto_decompress.md
Last active January 11, 2018 09:42
aiohttp decompress automatically based on Content-Encoding

Server

from aiohttp import web
import zlib

async def index(request):
    return web.Response(text=await request.text())

app = web.Application()
@martin-kokos
martin-kokos / workshop_glossary.md
Last active March 31, 2018 21:59
Workshop glossary

AL - airline

AP - airport

MS = metasearch = partner - web where people search for airline tickets (e.g. skyscanner, kayak, momondo), they usually don’t have content, they just calls APIs of its content providers (ALs, us, …)

src, dst - source and destination cities

Route - (src, dst) pair

@martin-kokos
martin-kokos / pydata_berlin_2018.md
Created July 11, 2018 12:30
Personal notes of pyData Berlin 2018

Populism & ML (political sciences)

  • scholars do not agree on definition
  • scrape manifests and speeches, label by expert
  • correlate populism x time in office x exit strategies
  • don't evaluate countries bellow democratic threshold (outliers)
  • "Populists in Europe"
  • used: TF-IDF, scattertext, gensim, pyLDA
  • cat and mouse problem - populists can avoid looking like populists

Smart contracts (Ethereum)

@martin-kokos
martin-kokos / pythonweekend_task_en.md
Last active October 17, 2021 16:43
Python weekend entry task

Python weekend Kiwi.com - Entry task

By solving this task, you will prove to us and yourself, that you are familiar with the basics of python, in which case we believe that you will enjoy the weekend workshop and it won't be too hard or too boring for you.

Requirements

  • python-2 or 3 (but you know the right choice here ;-) )
  • all modules are allowed

Description

@martin-kokos
martin-kokos / oneliner_sed_in_python.sh
Last active December 6, 2018 13:50
When you are unable to port the RegExp to sed
cat myfile | python3 -c "expr='YOUR_REGEXP'; import sys; import re; [print(match) for match in re.findall(expr, ''.join(sys.stdin.readlines()))]"
@martin-kokos
martin-kokos / advent.py
Last active December 21, 2018 13:35
Advent countdown
import datetime as dt
from time import sleep as s
curr_date = dt.datetime.now().replace(month=11,day=27)
class Candles(list):
def __repr__(self):
items = ['\N{CANDLE}' if i else '_' for i in self]
return '[{items}]'.format(items=', '.join(items))
@martin-kokos
martin-kokos / Webexpo 2019.md
Last active June 24, 2021 15:37
Webexpo 2019