Scripts

Bash - Snippets

some Bash snippets Change Working Directory Switch the Working Directory to the Base Path where the Scripts remains. Helpfull for Includes, Log Files, Relative Path and so on … #!/usr/bin/env bash script_path=$(dirname "$0") cd "$script_path" Check Return Code Run a Command, store the Return Code, and check if it was successfull or failed #!/usr/bin/env sh check_ret () { if [[ "$ret" == "0" ]]; then echo "Command terminated sucessfully" else echo "Command returned an Error: ${ret}" fi } which bash > /dev/null 2>&1 ret=$?

Python - Little Wordcloud

Do you like Word Clouds ? I do …! following a litte Script which Parse a Website and build a appropriate Word Cloud Script mkdir ~/mywordcloud; cd ~/mywordcloud cat <<'EOF' > main.py import fire import matplotlib.pyplot as plt import pandas as pd import re import requests from bs4 import BeautifulSoup from wordcloud import STOPWORDS, WordCloud def gen_cloud_tag(url: str = "https://blog.stoege.net"): # add https if not url.startswith("https://"): url = "https://" + url # get Webpage response = requests.