Skip to content

Instantly share code, notes, and snippets.

View dewomser's full-sized avatar
😎
leisure at work

Stefan Höhn dewomser

😎
leisure at work
View GitHub Profile
@dewomser
dewomser / google_query_csv.sh
Last active March 12, 2024 21:16
Googlequery output as csv a Bash 1-liner
# mit http
# funktioniert sofort.
query="linux%20worms";lynx -dump -cookies="" --display_charset=utf-8 "http://google.com/search?q=$(echo $query | sed 's/ /+/g')"|grep '^[[:blank:]][[:blank:]].[[:digit:]][[:punct:]]'| grep http://www.google.com/url\?q=http | sed -e 's/http:\/\/www.google.com\/url?q=//g' |sed -e 's/&sa=.*$//g'|grep -v google | cut -c5- | sed -rn "=;p;"| sed -r "N;s/\n//" | sed -e "s/\<\([0-9]\{1,2\}\)\>/0000\1/; s/\<0*\([0-9]\{2\}\)\>/\1/" |sed -e "s/^/ /g"| sed -e "s/\./;/1" > googlequery.csv
# mit https und cookies.
# Damit die Zeile funktioniert:
# zuerst "lynx-cookies -accept_all_cookies https://www.google.com"
# dann das Zeugs bestätigen damit alle Cookies persistent gesetzt sind
# danach funktioniert diese Zeile solange die Cookies nicht gelöscht werden.
@dewomser
dewomser / yt-dlp_over_tor.txt
Last active March 3, 2024 17:20
yt-dlp over tor
systemctl start tor
yt-dlp --proxy socks5://127.0.0.1:9050 https://www.youtube.com/watch?v=
@dewomser
dewomser / klimastreifen_worms.py
Created January 11, 2024 07:40
Erzeugt einen Klimastreifen für Worms. Ein Pythonscript für die toolbox bei https://cds.climate.copernicus.eu
import cdstoolbox as ct
# Application plotting climate stripes of temperature anomaly.
@ct.application(title='Climate Stripes')
@ct.output.livefigure()
def plot_time_series():
# Retrieve surface temperature data between 1979 and 2022
data = ct.catalogue.retrieve(
'reanalysis-era5-single-levels',
from collections import OrderedDict
import cdstoolbox as ct
# Define dictionary of cities to extract data from
cities = OrderedDict({
'Worms': {'lat': 49.6327, 'lon': 8.3591},
'Rosenheim': {'lat': 47.85637,'lon': 12.1224},
'Emden': {'lat': 53.36745, 'lon': 7.2077},
'Aachen': {'lat': 50.7766,'lon':6.08342},
'Dresden': {'lat': 51.05089,'lon': 13.7383},
@dewomser
dewomser / multimeter.py
Created December 27, 2023 21:57
Multimeter von Parkside Lidl und die serielle Schnittstelle
import serial
# Modify the port name to match your serial port
port = serial.Serial('/dev/ttyUSB0', 2400, timeout=1, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE)
# Read data from the serial port
while True:
# Read 2-byte preamble
preamble = port.read(2)
@dewomser
dewomser / bashmenue.sh
Created November 22, 2023 08:27
Ausführen einzelner Bashbefehle aus einer Liste
#!/bin/bash
# Definieren Sie eine Liste von Befehlen
commands=("ponysay" "lolcat" "htop" "hollywood" "cmatrix" "figlet" "neofetch" "sl" "toilet" "bpytop" "asciiquarium" "cowsay")
# Hauptmenüschleife
while true; do
echo "Wählen Sie einen Befehl aus der Liste aus:"
select cmd in "${commands[@]}"; do
if [ -n "$cmd" ]; then
@dewomser
dewomser / firefox_copy_url.sh
Last active November 22, 2023 08:13
copy URL from Firefox to Bash
#!/bin/bash
# xdotool is necessary
# Search for the visible Firefox window(s) and get its window ID
window_id=$(xdotool search --onlyvisible --class "firefox")
# Send the keyboard shortcut to open the URL bar, copy the URL to clipboard and then close the URL bar by sending the Escape key.
# The command is sent to the Firefox window with the specified ID using the --window option.
xdotool key --window $window_id --delay 20 --clearmodifiers ctrl+l ctrl+c Escape
@dewomser
dewomser / screenshot for X and Wayland and toot a website
Last active November 1, 2023 15:55
Makes a screenshot in a Website, copies the URL , add own Text and put it on Mastodon toot !
#!/bin/bash
# enable for X
# import "$HOME"/bin/kdialog/toot.png
# enable or Wayland
spectacle -b -r -o "$HOME"/bin/kdialog/toot.png
wait
a=$(kdialog --textinputbox "Dialog-Tooter" "$1")
if [[ $? = 0 ]]; then
echo "$a"
@dewomser
dewomser / websecgo.sh
Created November 28, 2022 11:37
Webspace Security-test mit google
#!/bin/bash
me="weine-webseite.de"
b="%20intitle:index.of"
echo "Verzeichnisse, bei denen das Directory Listing aktiv ist: ($b)"
a=$(lynx -dump $(echo "http://www.google.com/search?channel=fs&q=site:$me$b")) && echo "$a"| grep "Es wurden keine mit deiner Suchanfrage " || echo "$a" | grep '^[[:blank:]][[:blank:]].[[:digit:]][[:punct:]].*com/url\?.*'| grep -v "accounts\|support\.google"
b="%20ext:xml%20|%20ext:conf%20|%20ext:cnf%20|%20ext:reg%20|%20ext:inf%20|%20ext:rdp%20|%20ext:cfg%20|%20ext:txt%20|%20ext:ora%20|%20ext:ini"
@dewomser
dewomser / bash.txt
Created October 18, 2023 16:42
My Mastodon toots. Search for Linux, Bash,Raspberrypi

Searching toots for bash 1 of 2266 [#>---------------------------] 0.04%
Found toot: #Linux #Bash Skript Da gibt man sich Mühe mit seiner ASCII-Kunst und wenn man das Werk in einer Webseite anzeigen lassen will, ist alles kaputt wegen dem falschen Zeichenfont. dort. Diese Skript macht einr PNG-Grafik und dann passt das immer. https://gist.github.com/dewomser/cea719bec695d36d9e083d46ba13257a Beispiel:Die Stadt Worms.de hat einen informativen Rss-Feed. Hier kommt der Link zum Bild:https://www.worms.de/neu-de/aktuelles/meldungen/2023-10-12-10-28-00.php
Date: 16 Oct 23 14:40 UTC
URL: https://social.tchncs.de/@dewomser/111245213231688902
Found toot: #bash exifFoto Beschreibung als Text in *.txtFür eine #Fotoshow, soll für jedes Photo eine gleichlautende Datei aber mit Endung txt erstellt werden.Verwende zusätzlich "Keywords" aus dem Metatags Exif ! for i in {5..7} ;do photo=100_125$i; exif=$(exiftool -Keywords $