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
# Dynamically binds port 1080 on localhost to a remote ssh server. | |
# can be used as a socks 5 proxy | |
# usage ./ssh_proxy.sh user host port | |
ssh -f -N -n -D localhost:1080 -p $3 -l $1 $2 |
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
def check_filename(filename: str) -> str: | |
"""Verifica se já existe um arquivo com o mesmo nome, adiciona um número ao final do nome caso exista. | |
Arguments: | |
filename {string} -- Nome do arquivo | |
Returns: | |
string -- Nome de arquivo válido com numero no final. | |
""" | |
n = 2 |
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
from typing import Iterable, TypeVar | |
T = TypeVar("T") | |
def first(items: Iterable[T], pred: callable) -> T | None: | |
return next((i for i in items if pred(i)), None) |
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
""" | |
The PatternFly design-kit symbols are organized is a deep nested folder structure. | |
In order to create a custom Lucidchart shapes library, one must have all SVG files in a single directory. | |
This script copies all SVGs to a new folder called "svg" appending the original path to the new filename. | |
PatternFly design-kit => https://github.com/patternfly/patternfly-design-kit | |
Linux and Mac only. | |
""" |
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
from itertools import combinations | |
def diminishing_combinations(arr: list): | |
for i in range(len(arr)): | |
for c in combinations(arr, i): | |
if len(c) < 1: | |
continue | |
yield c | |
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
from itertools import combinations | |
from functools import cache | |
NOTAS = [50, 20, 10, 5, 2] | |
@cache | |
def int_div(a, b): | |
return a // b | |
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
flags_bytes = ["00000000", "00000001", "00000110", "00000011", "01001100", "10001000"] | |
flags = [0, 1, 6, 3, 76, 136] | |
lsb_expected = [0, 1, 2, 1, 4, 8] | |
def naive_lsb(num): | |
for i, bit in enumerate(bin(num)[2:][::-1]): | |
if int(bit) == 1: | |
return 2**i |
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
version: "3" | |
services: | |
sonarqube: | |
image: sonarqube | |
expose: | |
- 9000 | |
ports: | |
- "127.0.0.1:9000:9000" | |
networks: |
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
from typing import List, Dict | |
def vaquinha(lista_de_compras: List[list], emails: List[str]) -> Dict[str, int]: | |
"""Esta função recebe uma lista de compras e uma lista de e-mails e divide de forma | |
justa o valor total da lista de compras entre os e-mails. | |
Args: | |
lista_de_compras (List[list]): | |
Lista de compras como matriz: | |
[ |
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
from pendulum import datetime | |
from airflow.decorators import dag, task | |
from platform import node | |
from typing import Optional, Callable, Sequence | |
from airflow.providers.docker.decorators.docker import _DockerDecoratedOperator | |
from airflow.decorators.base import task_decorator_factory | |
class DockerDecoratedOperator(_DockerDecoratedOperator): |
OlderNewer