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
| """ we are the knits of the round table ... """ | |
| from typing import Tuple | |
| class ChessBoard: | |
| """ | |
| simple hackerrank style chessboard game with mulitple knights | |
| - approach use Sprague Grundy Theorem to determine the winner of a |
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
| class Board: | |
| """ | |
| given a coin a position | |
| determine if it is a winner or a loser | |
| """ | |
| N=15 | |
| MOVES = [(-2, +1), (-2, -1), (+1, -2), (-1, -2)] | |
| def __init__(self): | |
| self.grundy = [[-1 for _ in range(self.N + 1)] for _ in range(self.N + 1)] |
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
| """nim for several piles""" | |
| def calculate_mex(s): | |
| """minimum excludant""" | |
| mex = 0 | |
| while mex in s: | |
| mex += 1 | |
| return mex |
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
| def superdigit(n: str, k: int): | |
| p = n * k | |
| lp = list(p) | |
| psum = sum([ int(d) for d in lp ]) | |
| if psum < 10: | |
| return psum | |
| return superdigit(str(psum), 1) | |
| if __name__ == '__main__': | |
| maxidigit = '9875' |
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
| alpha_wheel = [c for c in "abcdefghijklmnopqrstuvwxyz"] | |
| def rotate_wheel(wheel, n): | |
| """Rotate the wheel by n positions.""" | |
| n = n % len(wheel) # Normalize the rotation | |
| return wheel[n:] + wheel[:n] | |
| def caesarcipher(text: str, n: int) -> str: |
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
| from collections import deque | |
| from typing import Tuple | |
| class ChessBoardFindError(Exception): | |
| """error on failure""" | |
| pass | |
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
| - blockchain: MegaETH | |
| network: megaeth-testnet | |
| name: Wrapped Ether | |
| symbol: WETH | |
| address: "0x776401b9bc8aae31a685731b7147d4445fd9fb19" | |
| decimals: 18 | |
| atom: 1000000000000000000 | |
| - blockchain: MegaETH | |
| network: megaeth-testnet | |
| name: AWE |
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
| // SPDX-License-Identifier: UNLICENSED | |
| pragma solidity ^0.8.13; | |
| interface GTELauncher { | |
| function BASE_SCALING() external view returns (uint256); | |
| function BONDING_SUPPLY() external view returns (uint256); | |
| function LAUNCH_FEE() external view returns (uint256); | |
| function QUOTE_SCALING() external view returns (uint256); | |
| function TOTAL_SUPPLY() external view returns (uint256); | |
| function bondingCurve() external view returns (address); |
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
| # Stage 1: Build yamlfmt | |
| FROM golang:1 AS go-builder | |
| # defined from build kit | |
| # DOCKER_BUILDKIT=1 docker build . -t ... | |
| ARG TARGETARCH | |
| # Install yamlfmt | |
| WORKDIR /yamlfmt | |
| RUN go install github.com/google/yamlfmt/cmd/[email protected] && \ | |
| strip $(which yamlfmt) && \ |
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
| """ simple jinja performance sanity check """ | |
| from jinja2 import Template | |
| import time | |
| query = """ | |
| -- fetch token from db | |
| -- param | |
| -- 1: user_id |