Skip to content

Instantly share code, notes, and snippets.

@petres
petres / puzzle.py
Created January 26, 2025 09:23
puzzle
import random
import sys
print(sys.getrecursionlimit())
sys.setrecursionlimit(300000)
# singleton
class Graph(dict):
@petres
petres / bin_numbers.py
Last active December 18, 2023 12:58 — forked from lukpueh/bin_numbers.py
TUF hash bin delegation (optimal bin numbers)
"""TUF hash bin delegation (optimal bin numbers)
Calculate the optimal number of bins for given number of target files.
Problem description
===================
Given 'targets_count', 'bin_meta_size' and 'target_meta_size', I want to know
the optimal 'bin_count', for which 'snapshot_size' plus 'bin_size' are minimal.
Constraints
@petres
petres / agnoster.md
Created January 30, 2016 13:45
Zsh (oh-my-zsh) Agnoster Theme Adaption for SVN

Agnoster Adaption

The SVN plugin of the oh-my-zsh ZSH distribution is not working with the agnoster theme, because it's simple not used in the prompt of the theme. Here two adaption of the theme file (themes/agnoster.zsh-theme) are listed, which are showing a nice prompt when you are in a SVN working directory.

  • Using the SVN plugin (with dirty symbol)
prompt_svn() {
  local rev branch
  if in_svn; then