This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| import time | |
| from functools import lru_cache, wraps | |
| def get_ttl_hash(): | |
| """Return the same value withing time period""" | |
| now = datetime.datetime.now() | |
| # Here value changes every minute, but it can be anything: day, 5 hours, etc. | |
| return now.minute |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class Seat(row: Int, letter: Char) | |
| object Seat { | |
| def from_string(s: String): Seat = { | |
| val split_position = s.length - 1 | |
| val (row, letter) = s.splitAt(split_position) | |
| Seat(row.toInt, letter.head) | |
| } | |
| } |