Skip to content

Instantly share code, notes, and snippets.

View Kobzol's full-sized avatar

Jakub Beránek Kobzol

View GitHub Profile
@Kobzol
Kobzol / backfill.py
Created March 4, 2025 09:11
Backfill script to fill in PyLadies alumni from git history
import dataclasses
import io
import json
import os
from collections import defaultdict
from typing import Any, Dict, List, Optional
import git
import tqdm
import yaml
# Requires $ pip install tqdm gitpython
import datetime
from collections import defaultdict
from os import path
from git import Repo
from tqdm import tqdm
def iter_merge_commits(days: int):
@Kobzol
Kobzol / cartpole.py
Created December 4, 2023 17:16
CartPole (Deep) Q-learning
import collections
import dataclasses
import random
from typing import Optional, Tuple
import cv2
import numpy as np
import numpy.random
import tensorflow as tf
from tqdm import tqdm
@Kobzol
Kobzol / tf-installation.md
Created July 23, 2020 17:51
Building Tensorflow 2.2 with Cuda 10.2, CuDNN 8 and TensorRT 7.1 from source

Bulding TF 2.2 with TensorRT 7.1 from source

This is a short tutorial for installing Tensorflow 2.2 with Cuda 10.2, CuDNN 8 and TensorRT 7.1 on Ubuntu 18.04 with Python 3.6 and GCC 7.5. It works on my machine as of 23. 07. 2020 :) However, if you're reading this, the guide is probably already outdated.

If you have the exact same specification as I do, you can try your luck with my prebuilt pip wheel: https://mega.nz/file/MAozBYhI#8Tp7W8t-X5sBuWCVEviTN5quQnNNwaVMv90OAnEvGD0

Recently I got hold of Nvidia Xavier NX, which has JetPack 4.4 with Tensorflow 2.2 and TensortRT 7.1. I wanted to have the same environment on my desktop/server, but sadly, Tensorflow does not support CUDA 10.2, TensorRT 7.1 and CuDNN 8 by default

#include <zmq.hpp>
#include <sys/epoll.h>
#include <iostream>
zmq_msg_t msg()
{
zmq_msg_t msg;
zmq_msg_init_size(&msg, 5);
std::memcpy(zmq_msg_data(&msg), "Hello", 5);
return msg;
@Kobzol
Kobzol / parse.py
Created December 2, 2019 14:12
Dask distributed packet parser
import msgpack
BYTES = []
def parse_messages(stream):
data = stream.read(8)
if len(data) < 8:
return []
chunk_count = int.from_bytes(data, "little", signed=False)
#include <zmq.hpp>
#include <sys/epoll.h>
#include <iostream>
int main()
{
void* ctx = zmq_ctx_new();
void* socket = zmq_socket(ctx, ZMQ_PUSH);
std::cerr << zmq_connect(socket, "tcp://127.0.0.1:5555") << std::endl;
str_hodnota = function(v, p)
{
sum(v * p);
}
rozptyl = function(v, p)
{
str_hodnota(v ** 2, p) - str_hodnota(v, p) ** 2
}
var_koeficient = function(v, p)
{
@Kobzol
Kobzol / nahodna_velicina.R
Last active March 1, 2017 22:21
PS - nahodna velicina
str_hodnota = function(v, p)
{
sum(v * p);
}
rozptyl = function(v, p)
{
str_hodnota(v ** 2, p) - str_hodnota(v, p) ** 2
}
var_koeficient = function(v, p)
{
@Kobzol
Kobzol / words.c
Created October 20, 2016 14:57
Generate word at a given index
void generate(int index, int wordSize, int alphabetSize, char* result, char base = 0)
{
for (int i = wordSize - 1; i >= 0; i--)
{
int toSkip = std::pow(alphabetSize, i);
char c = index / toSkip;
result[wordSize - i - 1] = base + c;
index = index % toSkip;
}
}