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 / distcc_ubuntu.md
Last active March 23, 2024 19:26
Install distcc on Ubuntu

Install gcc

apt-add-repository ppa:ubuntu-toolchain-r/test
apt update
apt install gcc-13 g++-13
ll /usr/bin/gcc-13
ll /usr/bin/g++-13
update-alternatives --display gcc
ll /etc/alternatives/g*
update-alternatives --remove-all gcc
@martin-kokos
martin-kokos / task_manager.py
Last active January 8, 2021 14:40
Simple multiprocessing task manager
'''
If the tasks are inequally sized, it may happen with starmap and similar schedulers
which schedule tasks ahead of time, that some workers are lucky and finish early and some unlucky
and finish much later having the effect of the task batch using all CPU cores at first,
but then lucky workers finishing and core sitting idle.
This task manager serves as an example on how to have workers fetch tasks from a Queue.
Joblib, Pool.starmap or something else might be better, but maybe this is useful.
'''
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
JAVA_ANT_ENCODING=UTF-8
ESVN_REPO_URI="https://josm.openstreetmap.de/svn/trunk"
inherit eutils java-pkg-2 java-ant-2 subversion desktop
@martin-kokos
martin-kokos / kravi_hora_server.py
Last active August 31, 2020 18:48
Kravi hora occupancy provider
'''
Provides occupancy number http://localhost:8080/kravi_hora
'''
import logging
import re
import requests
from bs4 import BeautifulSoup
from aiohttp import web
@martin-kokos
martin-kokos / Webexpo 2019.md
Last active June 24, 2021 15:37
Webexpo 2019
@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 / 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 / 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 / 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 / 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