Skip to content

Instantly share code, notes, and snippets.

View fridex's full-sized avatar
🔐
Encrypting...

Fridolín Pokorný fridex

🔐
Encrypting...
View GitHub Profile
@fridex
fridex / inspect.py
Created August 6, 2019 13:06
Adjusted Amun's inspect.py for local run
#!/usr/bin/env python3
# Amun
# Copyright(C) 2019 Fridolin Pokorny
#
# This program is free software: you can redistribute it and / or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@fridex
fridex / Random Termial
Last active February 10, 2020 21:03
Pick a random item from a list, prioritize items with lower index.
#!/usr/bin/env python3
import math
import random
import sys
def random_termial(n: int) -> int:
"""Get index to an item from a list of size n.
@fridex
fridex / profile.gif
Last active November 5, 2020 11:01
profile.gif
profile.gif
@fridex
fridex / termial.py
Last active February 28, 2020 20:15
Random termial with removed binomial coefficient
#!/usr/bin/env python3
# Based on https://gist.github.com/fridex/8a2442f7e187914af715968097688aa3
import math
import random
import sys
def random_termial(n: int) -> int:
"""Get index to an item from a list of size n.
@fridex
fridex / termial_bench.py
Last active February 28, 2020 20:16
Benchmark termial random
#!/usr/bin/env python3
import math
import os
import random
import sys
import timeit
_ROUNDS = int(os.getenv("TERMIAL_DEFAULT_ROUNDS", 3))
_ITERATIONS = int(os.getenv("TERMIAL_ITERATIONS", 1000000))
@fridex
fridex / termial_bench_mult.py
Created August 17, 2020 07:32
Termial random using multiplication optimization
#!/usr/bin/env python3
import math
import os
import random
import sys
import timeit
_ROUNDS = int(os.getenv("TERMIAL_DEFAULT_ROUNDS", 3))
_ITERATIONS = int(os.getenv("TERMIAL_ITERATIONS", 1000000))
@fridex
fridex / gist:681605f0bcf6437a71c5ed64883e0a24
Created September 4, 2020 08:09
TensorFlow and its dependency NumPy in the stack
>>> from thoth.storages import GraphDatabase
>>> graph = GraphDatabase()
>>> graph.connect()
The database schema is not in sync with library revisions, the current library revision heads: {'83e2900c3721'}, database heads: {'7c261487d4d4'}
>>> from pprint import pprint
>>> # The dict returned is formed out of extras name (None if no extra) and a list of possible direct dependencies respecting version range specification of packages.
>>> pprint(graph.get_depends_on("tensorflow", "2.2.0", "https://pypi.org/simple"))
{None: [('absl-py', '0.7.0'),
('absl-py', '0.7.1'),
('absl-py', '0.8.0'),
@fridex
fridex / termial_random.py
Created October 15, 2020 11:58
Termial random using CPython extension
#!/usr/bin/env python3
# pip install termial-random
from termial_random import random as termial_random
from termial_random import seed as termial_seed
import math
import os
import random
import sys
import timeit
@fridex
fridex / Pipfile.lock
Last active January 11, 2021 17:36
resolving stack
{
"_meta": {
"hash": {
"sha256": "4eee0da583a3e934b6f42c73441c40d91cf7ee1b46602bdc4851279a4e15dccc"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.8"
},
"sources": [
@fridex
fridex / Pipfile.lock
Created June 30, 2021 07:28
seldon-core with tensorflow Pipfile.lock
{
"_meta": {
"hash": {
"sha256": "82a12ed290169de6cf3ff88bf420740a5c4e04c69736ce73270409106ce98dd8"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.6"
},
"sources": [