Skip to content

Instantly share code, notes, and snippets.

{
"title": "TEMExperimentDataSet",
"description": "Visual data collected from a transmission electron microscopy experiment in a single grain of a sample.",
"type": "object",
"properties": {
"author": {
"title": "Author",
"description": "Person who designed and/or performed the experiment.",
"type": "string"
},
@apirogov
apirogov / rsync-prepare
Created September 7, 2022 18:08
Script to fix moved/renamed files before running rsync to avoid useless retransmissions
#!/usr/bin/env python3
"""
Fix moved/renamed files before running rsync to avoid useless retransmissions.
Copyright (C) 2022 Anton Pirogov, licensed under the MIT License
"""
from itertools import chain
from typing import List, Dict, Optional
from dataclasses import dataclass
from pathlib import Path
@apirogov
apirogov / enum_indexed_structs.cpp
Created January 17, 2025 13:26
Enum-indexed product types in C++
/// Utilities to implement a type-safe enum-indexed product type.
///
/// A product type is the dual of a sum type (std::variant provides a generic sum type in C++).
///
/// The canonical product type is std::tuple, however this is not the best choice for a good API.
///
/// Any struct can be considered a product type over the member types, but then adding a
/// new named case would require boilerplate, such as:
/// * adding a new member
/// * possibly, adding access methods