Skip to content

Instantly share code, notes, and snippets.

View wnklb's full-sized avatar

Sebastian Winkler wnklb

  • Munich
  • 03:19 (UTC +01:00)
View GitHub Profile
@wnklb
wnklb / .envrc
Created November 3, 2020 13:11
.envrc for env exports
#!/usr/bin/env bash
for line in $(cat .env); do
eval "export $line"
done
@wnklb
wnklb / logging.py
Created November 3, 2020 13:10
Python logging
import json
import logging.config
import os
# https://docs.python.org/3/howto/logging-cookbook.html#configuring-filters-with-dictconfig
class MaxLevelFilter(logging.Filter):
def __init__(self, level=None):
super().__init__()
self.level = level
[flake8]
exclude =
__pycache__,
build,
dist,
mocks,
venv
ignore =
F405,
F403
@wnklb
wnklb / count_word_frequencies.py
Created March 19, 2018 20:04
Count Word Frequencies
"""
This script counts the word frequencies in a given text-file
(via argv) and outputs it as a descending list.
Further steps for production:
* code review
* exception handling (e.g. unexpected encoding)
* integrate with tests
"""