Skip to content

Instantly share code, notes, and snippets.

View horvatha's full-sized avatar

Árpád Horváth horvatha

View GitHub Profile
@horvatha
horvatha / composers_21_century.csv
Created October 20, 2020 05:28
Fetching data from wikipedia article's table
article name birth death nationality notable_21_century_works era
Cassandra_Miller Cassandra Miller 1976 Canadian About Bach (string quartet) 21st-century classical
Caio_Fac%C3%B3 Caio Facó 1992 Brazilian Diário das Narrativas Fantásticas: Uma fantasia sobre a história da América do Sul (for chamber orchestra)[1] 21st-century classical
Rolf_Riehm Rolf Riehm 1937 German Sirenen (opera) 21st-century classical
Hiro_Fujikake Hiro Fujikake 1949 Japan Pastoral Fantasy (1975),The Rope Crest (1977), Symphony Japan(1993), Symphony IZUMO(2005) 21st-century classical
Ann_Cleare Ann Cleare 1983 Irish Claustrophobia (orchestra) 21st-century classical
Sarah_Hutchings Sarah Hutchings 1984 American 21st-century classical
Peter_Seabourne Peter Seabourne 1960 English Steps piano cycle series – 6 volumes 21st-century classical
Eric_Salzman Eric Salzman 1933 2017 American The True Last Words of Dutch Schultz (opera) 21st-century classical
Johannes_Kreidler Johannes Kreidler 1980 German Fremdarbeit 21st-century classic
@horvatha
horvatha / A1_WikiTable_Composers_21st_century.ipynb
Last active October 20, 2020 05:32
Fetching from wikipedia
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@horvatha
horvatha / kvarcora4.py
Last active November 18, 2020 11:12
Hibás változat IT megmérettetés 2020, Nyelvfüggetlen programozás és adatbáziskezelés (SAP), 4. forduló feladata
import unittest
def clock():
maxdiff_ = 90
for h in range(12):
for m in range(60):
for s in range(60):
current_diffs = diffs(h, m, s)
current_maxdiff = maxdiff(current_diffs)
@horvatha
horvatha / kvarcora4.py
Last active November 18, 2020 11:11
IT megmérettetés 2020, Nyelvfüggetlen programozás és adatbáziskezelés (SAP), 4. forduló feladata
import unittest
def clock():
maxdiff_ = 90
for h in range(12):
for m in range(60):
for s in range(60):
current_diffs = diffs(h, m, s)
current_maxdiff = maxdiff(current_diffs)
with open("naplo.txt") as f:
lines = f.readlines()
hi = []
for l in lines:
if l[0] != '#':
hi.append(l)
print(f'A naplóban {len(hi)}')
# Ugyanezt csinálja, list comprehension néven kereshetsz rá
@horvatha
horvatha / loader_factory.py
Last active December 30, 2020 09:22
Decorator for registering a function with key. It was wrong (until version 3), but now it works, thanks Real Python and Kryssz90
import functools
import unittest
from typing import Callable
class LoaderFactory:
def __init__(self) -> None:
self.registered_functions = dict(
)
@horvatha
horvatha / szoszamlalo.py
Last active March 25, 2021 07:43
Szóstatisztikát készít
from collections import Counter
with open('szavak.txt', encoding="utf-8") as f:
szavak = f.read().split()
ossz = len(szavak)
szamlalo = Counter(szo for szo in szavak)
for szo, darab in szamlalo.most_common(8):
print(f"{darab/ossz*100:5.2f}% {szo} ")
def ones(num: int, number_of_bytes: int = 4) -> int:
num_ones = 0
for i in range(number_of_bytes * 8):
if (2 ** i) & num:
num_ones += 1
return num_ones
def ones(num: int) -> int:
bin_string = f"{num:b}"
@horvatha
horvatha / loose_transform.py
Last active July 26, 2022 07:45
Loose transformation for pyrsistent. Similar to the transform method, but it works even if there are missing keys.
from typing import List, Callable, Union
from pyrsistent import PVector, PMap, ny, freeze
def loose_transform(structure: Union[PVector,PMap], path: List, command: Callable):
if not path:
return command(structure) if callable(command) else command
key_spec = path[0]
if not callable(key_spec):
@horvatha
horvatha / eredmeny.txt
Last active August 6, 2022 13:08
A földhivatal fájljából adatok kinyerése
Ebből indulva https://pastebin.com/raw/nPbzGFmu
az eredmény:
Szakasz: Tulajdonosi adatok
{'Tul.hányad': '1/2', 'Szerz.jogcím': 'adásvétel', 'Név': 'Gipsz Csaba', 'Anyja neve': 'Próba Katalin', 'Jogállás': 'tulajdonos', 'Cím': '4965 MINTA, Kölcsey utca 105'}
{'Tul.hányad': '1/2', 'Szerz.jogcím': 'adásvétel', 'Név': 'Gipsz Csabáné', 'Szül.név': 'Gipsz Éva', 'Anyja neve': 'Minta Borbála', 'Jogállás': 'tulajdonos', 'Cím': '4965 MINTA, Kölcsey utca 105'}
Szakasz: Jogok-tények jogosultjai
{'Jog-tény neve': 'Önálló szöveges bejegyzés', 'Szöveg': 'Lakcímváltozás átvezetése.'}
{'Jog-tény neve': 'Jelzálogjog', 'Név': 'MAGYAR ÁLLAM', 'Cím': '-,'}
{'Jog-tény neve': 'Elidegenítési és terhelési tilalom', 'Név': 'MAGYAR ÁLLAM', 'Cím': '-,', 'Utalások': 'III/14'}