Skip to content

Instantly share code, notes, and snippets.

View voronaam's full-sized avatar

Lex Vorona voronaam

View GitHub Profile
@voronaam
voronaam / nhl-rank.py
Last active April 26, 2020 19:55
An utility to rank games by a team in a certain year without revealing the game results.
#!/usr/bin/env python3
"""nhl-rank.py: An utility to rank games by a team in a certain year without revealing the results.
The data source and its copyright: https://sportsdatabase.com/
"""
__author__ = "Lex Vorona"
import sys, getopt
package org.sample;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
@voronaam
voronaam / background.go
Last active December 3, 2019 00:31
Benthos background processor
package processor
import (
"fmt"
"time"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/processor"
"github.com/Jeffail/benthos/v3/lib/types"
@voronaam
voronaam / mousewarp.py
Created June 9, 2021 16:48
Python script to warp the mouse comfortable around adges of a vertical display
#!/usr/bin/env python3
from Xlib import display
from time import sleep
from os import system
# My screen setup has a vertical display with a large dead zone:
#
# +----------------+
# | |
# DEAD | |
@voronaam
voronaam / example.rs
Created April 27, 2022 21:28
Poor man's specialization in Rust
macro_rules! assert_impls {(
#[rustc_on_unimplemented(message = $message:expr $(,)?)]
$T:ty : $($trait:tt)+
) => (const _: () = {
#[allow(unused)]
use __poormans_specialization::Fallback as _;
mod __poormans_specialization {
pub(super)
struct Wrapper<T : ?::core::marker::Sized>(T);
@voronaam
voronaam / balancemodel.py
Last active March 5, 2024 05:17
Model for an unbalanced game
#!/usr/bin/env python3
import argparse
import random
LADDER_PLAYERS = 1000
LADDER_GAMES = 1000000
TOURNAMENTS = 20
def win_probability(race1, race2, imbalance, rematch):