Skip to content

Instantly share code, notes, and snippets.

View omry's full-sized avatar

Omry Yadan omry

View GitHub Profile
@omry
omry / config.yaml
Created December 7, 2024 05:23
STL cooling rack generator
width: 600 # Width of the cooling rack in mm
depth: 800 # Depth of the cooling rack in mm
height: 2200 # Total height of the rack in mm
grid_spacing: 50 # Spacing between grid bars in mm
rack_bar_thickness: 2 # Thickness of the rack bars in mm
frame_thickness: 25 # Thickness of the frame and legs in mm
leg_height: 100 # Height of the legs in mm
num_levels: 8 # Number of stacked levels
file_path: "Cooling_Rack_With_Vertical_Frame.stl" # Output STL file path
@omry
omry / config.yaml
Created March 6, 2021 10:29
Hydra C++ example
app: ${hydra:runtime.cwd}/main
db:
driver: mysql
user: omry
password: secret
@omry
omry / my_app.py
Created September 17, 2020 22:47
recursive example
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from dataclasses import dataclass, field
from typing import Any, List
from omegaconf import MISSING, II, OmegaConf
import hydra
from hydra.core.config_store import ConfigStore
from hydra.utils import instantiate
@omry
omry / recursive_example_my_app.py
Created September 17, 2020 22:32
Recursive instantiation usage prototype
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from dataclasses import dataclass, field
from typing import Any, List
from omegaconf import MISSING, II, OmegaConf
import hydra
from hydra.core.config_store import ConfigStore
from hydra.utils import instantiate
@omry
omry / Override.g4
Last active July 26, 2020 16:05
Hydra-interpolations-grammar
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
// Regenerate parser by running 'python setup.py antlr' at project root.
// If you make changes here be sure to update the documentation (and update the grammar in command_line_syntax.md)
grammar Override;
single_override : override EOF;
overrides_file : override ('\n' override)*;
override: (
from typing import Any, Dict
class Singleton(type):
_instances: Dict[type, "Singleton"] = {}
def instance(cls: Any, *args: Any, **kwargs: Any) -> Any:
return cls(*args, **kwargs)
def __call__(cls, *args: Any, **kwargs: Any) -> Any:
from contextlib import contextmanager
from typing import Any
@contextmanager
def foo() -> Any:
print("1 before")
yield
print("1 after")
from contextlib import contextmanager
from typing import Any
@contextmanager
def foo() -> Any:
print("1 before")
yield
print("1 after")
@omry
omry / 1.py
Created June 23, 2020 23:09
dual_use_context
from contextlib import contextmanager
from typing import Any
@contextmanager
def foo() -> Any:
print("1 before")
yield
print("1 after")