Skip to content

Instantly share code, notes, and snippets.

View rok's full-sized avatar

Rok Mihevc rok

  • Freelance
  • Amsterdam, Netherlands
View GitHub Profile
@rok
rok / uniformly-encrypted-table.cc
Created August 6, 2025 07:26
[C++] Write uniformly encrypted table to parquet
arrow::Status WriteUniformlyEncryptedFile() {
std::vector<std::shared_ptr<arrow::Array>> arrays;
std::shared_ptr<arrow::Table> _table;
std::vector<std::shared_ptr<arrow::Field>> fields;
const std::string KEY_LABEL = "kf";
const ::arrow::util::SecureString KEY_VALUE("0123456789abcdef");
std::string outFileName = "tbl.parquet";
std::filesystem::path exePath = std::filesystem::path("/home/somepath");
std::filesystem::path outPath = exePath / outFileName;
@rok
rok / pyarrow-duckdb-passing-uniformly-encrypted-parquet.ipynb
Created August 5, 2025 14:50
Create uniformly encrypted parquet file with PyArrow and attempt to read it with DuckDB
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rok
rok / timestamp_ambiguous-nonexistent_study (1).ipynb
Created June 8, 2022 02:44
timestamp_ambiguous-nonexistent_study
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rok
rok / timestamp_ambiguous-nonexistent_study.ipynb
Created May 27, 2022 20:31
timestamp_ambiguous-nonexistent_study
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rok
rok / code.py
Last active July 9, 2019 23:38
Conways's Game of Life for pewpew
# https://creativecommons.org/licenses/by/4.0/
# https://en.wikipedia.org/wiki/Conway's_Game_of_Life#Rules
# https://pewpew.readthedocs.io/en/latest/
import pew
import random
n = 8
n_states = 2
@rok
rok / unet_weight_map.py
Last active January 17, 2025 12:42
U-Net weight map generation
%matplotlib inline
import numpy as np
from skimage.io import imshow
from skimage.measure import label
from scipy.ndimage.morphology import distance_transform_edt
def generate_random_circles(n = 100, d = 256):
circles = np.random.randint(0, d, (n, 3))
x = np.zeros((d, d), dtype=int)
@rok
rok / jh.yml
Last active October 23, 2019 14:08
Add water for Jupyterhub
# To run:
# aws cloudformation create-stack \
# --template-body file://jh.yml \
# --profile <YOUR_USER_PROFILE> \
# --stack-name jupyterhub \
# --parameters ParameterKey=KeyName,ParameterValue=<YOUR_KEYPAIR_NAME> \
# ParameterKey=InstanceType,ParameterValue=t2.micro
Parameters:
KeyName:
//Width and height
var timeStretch = 1.6;
var h = 70;
var w = 920;
var barPadding = 1;
var timePeriod = 10;
var timeParser = d3.timeParse("%H:%M");
function dict2array(dict) {
var result = [];
@rok
rok / nl_school_holidays_2006_2019.csv
Last active February 16, 2021 15:39
Netherlands school holidays per region (2006 - 2019)
vacations_start vacations_end region education_level vacations
0 2006-02-18 00:00:00 2006-02-26 00:00:00 central base spring
1 2006-02-18 00:00:00 2006-02-26 00:00:00 central secondary spring
2 2006-02-18 00:00:00 2006-02-26 00:00:00 north base spring
3 2006-02-18 00:00:00 2006-02-26 00:00:00 north secondary spring
4 2006-02-25 00:00:00 2006-03-05 00:00:00 south base spring
5 2006-02-25 00:00:00 2006-03-05 00:00:00 south secondary spring
6 2006-04-29 00:00:00 2006-05-07 00:00:00 central base may
7 2006-04-29 00:00:00 2006-05-07 00:00:00 central secondary may
8 2006-04-29 00:00:00 2006-05-07 00:00:00 north base may