Scripts

Bash - Snippets

some Bash snippets Change Working Directory #!/usr/bin/env bash script_path=$(dirname "$0") cd "$script_path" sha256: 14702c6f56acf7fb0c71b5e04b7c9de9264ed0dbbef43c34e34ec12fbd6e8baa

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.

Oneliners

Misc Oneliners Dump Certs Chain s="google.com"; timeout 2 openssl s_client -servername ${s} -connect ${s}:443 -showcerts > /tmp/${s}.chain selfsigned certificate for 1 year cd /etc/ssl; openssl req -nodes -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 356 set default branch to main git config --global init.defaultBranch main bash - check multiple files [ -f /etc/resolv.conf -a -f /etc/hosts ] && echo "Both files exist" || echo "One or Both Files are missing" remove word ’nosuid’ on the line /var in /etc/fstab sed -E -i.

Aslo - AS Lookup

ASLO AS Lookup Helper Script. It’s written for OpenBSD and need’s some modification for Linux. It basically depends on Python, PIP Installer and Python Package “aslookup”. Have Fun ! Download wget https://blog.stoege.net/scripts/aslo chmod 755 aslo ./aslo 1.1.1.1 Script … and the Content himelf. It basically check’s if pip is installed, if as-lookup is installed, and then does the as lookup for the given IP Adress #!/usr/bin/env bash # AS Lookup for IP Address install_pip() { echo -e "\npip not found, install ?

Bigdata

How to Process Large Files … ? Large is a variable Term, 700 GB is large for me, while it could be a small peace for others. Assuming you need to count the lines … this simple Task can take minutes ! Size [user@host /tmp]$ du -sh bigfile 745G bigfile Wordcount -> 10 min if you need to count the lines, use the wordcount command and you get the exact number … but you have to wait for minutes, depending in your disk subsystem and the file size of course