This file contains 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
# Copyright (C) 2019 Chris Lawrence | |
# You may freely modify, copy, and reuse this software under the terms of the MIT License. | |
def test_bitmask(value: int, mask: str) -> bool: | |
mask = mask.replace("_", "") | |
testval: int = 1 | |
for bit in reversed(mask): | |
if bit == '1' and not (value & testval): | |
return False | |
elif bit == '0' and (value & testval): |
This file contains 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
#!/usr/bin/env python3 | |
import argparse | |
import random | |
import sys | |
DEFAULT_PERCENTAGE = 40 | |
def randcaps(text: str, percentage: float = DEFAULT_PERCENTAGE) -> str: |
OlderNewer