env_keys = ['SSM_NAME_PREFIX', 'SSM_DB_PASSWORD', 'DB_PORT', 'DB_USERNAME']
ssm_name_suffixes = ['name', 'host', 'schema']
db_params = aws_ssm.get_parameters(env_keys=env_keys, ssm_name_suffixes=ssm_name_suffixes)
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 pathlib import Path | |
from git import Repo | |
class Contributor: | |
def __init__(self, name: str, email: str) -> None: | |
self.name = name | |
self.email = email | |
def __eq__(self, other): |
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
import subprocess | |
output_path = Path('output') | |
list_files = [f.name for f in output_path.iterdir() if f.is_file() and f.suffix == f'.csv'] | |
for f in list_files: | |
if my_file in f: | |
print(f'found the file: {f}') | |
dir_path = Path(Path.cwd(), output_path) | |
subprocess.call(['nautilus', dir_path]) |
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 pathlib import Path | |
import ipywidgets as widgets | |
from IPython.display import display | |
def get_files_widget(dir_path: str, extension_names: list[str], order_by_date=True) -> widgets.Dropdown: | |
""" Returns a widget to list the files in the given dir. """ | |
path = Path(Path.cwd(), dir_path) | |
extensions = [f'.{e}' for e in extension_names] | |
objects = [f for f in path.iterdir() if f.is_file() and f.suffix in extensions] |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
[...] | |
/* RouteKeyPresses | |
* | |
* Reroutes cursor keys etc to track bar. | |
*/ | |
void RouteKeyPresses(PMSG pMsg) | |
{ | |
/* Hack for PowerPoint | |
* | |
* Mail from PaulWa: |
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
.DEFAULT_GOAL := help | |
.PHONY: help | |
help: ## Displays this list and descriptions of available targets | |
@echo "" | |
@echo "targets:" | |
@echo "" | |
@awk -F ':|##' '/^[^\t].+:.*##/ {printf "\033[36mmake % -30s\033[0m -%s\n", $$1, $$NF }' $(MAKEFILE_LIST) | sort | |
@echo "" |
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
#!/bin/python3 | |
import os | |
from faker import Faker | |
from faker.providers import internet, lorem | |
from tabulate import tabulate | |
fake = Faker() | |
fake.add_provider(internet) | |
fake.add_provider(lorem) |
Occasionally, a git source code repository needs to have something removed from it permanently, even from the history.
Replace MY_GIT_REPOSITORY with the URL of your git repository. This will also track all the branches so all branches can be cleaned as well. (source)
cd /tmp
git clone MY_GIT_REPOSITORY.git workingrepo
cd workingrepo
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
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
class Cipher: | |
""" | |
https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher | |
""" | |
def __init__(self, key: str): | |
self.key = key | |
def encode(self, text: str, key: str = None) -> str: | |
""" |