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 org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.stereotype.Service; | |
import jakarta.annotation.PostConstruct; | |
import jakarta.annotation.PreDestroy; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.io.InputStreamReader; | |
import java.io.FileInputStream; | |
import javax.net.ssl.KeyManagerFactory; |
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
function Show-Usage { | |
@" | |
pyclean (custom PowerShell script impl) | |
Description: | |
Recursively finds and deletes Python bytecode files (*.pyc, *.pyo) and | |
__pycache__ and .ipynb_checkpoints directories within the specified directories. | |
Usage: | |
pyclean [directories...] | |
[directories ...] One or more directories where the cleanup should be performed. | |
Example: |
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
Param( | |
[Parameter(Mandatory, Position = 0, HelpMessage = "Path to save PNG file")] [string] $SavePath | |
) | |
if (-not [System.IO.Directory]::Exists([System.IO.Path]::GetDirectoryName($SavePath))) { | |
Throw "Save directory doesn't exist." | |
} | |
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 | |
class SlidingWindowDivisible: | |
""" | |
Test whether the product of a sliding window is divisible by a given number | |
""" | |
def __init__(self, k: int): | |
self.k = k | |
self.queue = deque() |
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
''' | |
A simple in-memory banking system which supports: | |
- Create accounts | |
- Deposit money | |
- Transfer money from one account to another | |
- Make payments, which adds 2% cashback after one day | |
- Get payment status at current timestamp | |
- Get balance at certain timestamp | |
- Merge accounts | |
- Get the most active accounts in terms of spending money |