Skip to content

Instantly share code, notes, and snippets.

@simonjenny
simonjenny / auto-cert
Last active August 12, 2021 08:49
Automagically create Letsencrypt Certificates for Nginx Virtual Hosts
#!/bin/bash
# Name your config Files like this : DOMAIN.conf eg. example.com.conf
IP=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
for filename in /etc/nginx/sites-enabled/*.conf; do
if ! grep -q "Certbot" $filename; then
CONF=$(echo "$filename" | cut -d'/' -f5)
DOMAIN=${CONF%.conf*}
if [[ $(dig +short a "$DOMAIN") == "$IP" ]]; then
@simonjenny
simonjenny / sshlist
Created June 23, 2020 11:01
Easy SSH Dialog based on your SSH Config
#!/bin/bash
DIALOG=${DIALOG=dialog}
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15
ar=()
for i in `cat ~/.ssh/config |grep -w Host| sed -e "s/Host //g" | grep -Ei '[a-z]'`
do
ar+=($i "")
done
$DIALOG --title "SSH Servers" --menu "Bitte wähle ein Server:" 0 0 10 "${ar[@]}" 2> $tempfile
@simonjenny
simonjenny / mag.py
Created December 26, 2020 21:52
Get Raspberry Pi Magazines
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import requests, os
def getFile(url, file, path):
if os.path.isfile('{}/{}'.format(path, file)):
print('{} ist bereits vorhanden!'.format(file))
else:
r = requests.get(url)
with open('{}/{}'.format(path, file), 'wb') as f: