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 / bash_color.txt
Last active April 8, 2025 12:29
Bash wird Bunt .Escapesequenzen für Menschen. Geeignet für .bashrc
##############################################################################
# COLORS AND BACKGROUNDS
##############################################################################
# note: \e or \x1B also work instead of \033
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
@dewomser
dewomser / =mastotool_statistik.txt
Last active April 1, 2025 09:01
Mastodon Monatsstatistik für @dewomser. Kommando: mastotool stats -r=100
Total toots: 100 (excluding replies & boosts)
Toots per day: 0.04 (account created 2648 days ago)
Ratio toots/replies: 16.67
New followers per day: 0.10
New followings per day: 0.08
Likes per toot: 0.39 (total likes: 39)
Boosts per toot: 0.12 (total boosts: 12)
Replies per toot: 0.14 (total replies: 14)
┌──────────────────────────────┬──────────────┐
@dewomser
dewomser / github_backup,sh
Last active March 31, 2025 17:09
Github Backup . Alle Repositories klonen, Ordner zippen
#!/bin/bash
datum="gitub_backup_$(date +%y_%m_%d_%H)"
mkdir $HOME/$datum
cd $HOME/$datum
# die Curl-Zeile hann auch als 1-Zeiler benutzt weden.
curl --header "Authorization: 'token' '$GIST_TOKEN'" -L "https://api.github.com/users/Dein_Username/repos?per_page=100&page=1" | jq '.[] .clone_url'|xargs -n1 -r git clone
cd
tar -czvf $datum.tar.gz $datum
# rm -f -r $datum
@dewomser
dewomser / Das_Haus_vom_Nikolaus.turtle
Created March 17, 2025 18:13
Beispiel für Logo als Kturtle mit deutschem Zeichensatz und Syntax
kturtle-script-v1.0
@(reset)
@(gox) 300
@(goy) 350
@(forward) 200
@(turnleft) 45
@(forward) 141
@(turnleft) 90
@dewomser
dewomser / OCR2Cliboard.sh
Created March 4, 2025 06:13
From Screenshot to OCR to Klipper
#!/usr/bin/bash
# spectacle and tesseract is required
#works with Wayland
spectacle -r -n -b -d 5000 -o "$HOME"/bin/text_erkennen.png
wait
tesseract -l deu "$HOME"/bin/text_erkennen.png "$HOME"/bin/text_erkennen
#eng
wait
text=$(cat "$HOME/bin/text_erkennen.txt")
dbus-send --type=method_call --dest=org.kde.klipper /klipper org.kde.klipper.klipper.setClipboardContents string:"$text"
@dewomser
dewomser / test.txt
Created March 1, 2025 06:22
Zwischenablage Sa 1. Mär 07:22:32 CET 2025
date=$(date);gist -d "Zwischenablage $date" -f test.txt <<<"$(qdbus org.kde.klipper /klipper getClipboardHistoryItem 0)"
@dewomser
dewomser / tmp.mMBEjmBi10
Created February 18, 2025 15:00
Latest commit diff
diff --git a/lottoschein.-bunt1sh b/lottoschein.-bunt1sh
deleted file mode 100644
index 941d21b..0000000
--- a/lottoschein.-bunt1sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-#Copilot hat bei diesem Skript geholfen
-
@dewomser
dewomser / lottoschein-bunt1.sh
Last active February 18, 2025 16:33
Lotto 6 aus 49 Gibt random ausgefülltes Kästchen zurück als Bashskript
#!/bin/bash
#test
#Copilot hat bei diesem Skript geholfen
# Generiere sechs zufällige Zahlen im Bereich von 1 bis 49
lotto_numbers=$(shuf -i 1-49 -n 6)
# Sortiere die Zahlen der Reihe nach
sorted_numbers=$(echo $lotto_numbers | tr ' ' '\n' | sort -n)
@dewomser
dewomser / bofh_dialog.md
Last active March 16, 2025 12:58
BOFH in a dialog box . A bashcript

Kann man sich auch in ~/.bashrc einbauen. Dann wird man beim Öffnen des Terminals damit begrüßt.

Abhängigkeiten:

  • fortune
  • bofh-excuses
  • dialog ( oder boxes )

text="$(fortune bofh-excuses)"&& dialog --title "Your ticket has been rejected" --colors --msgbox "${text}" 0 0

oder einfacher

@dewomser
dewomser / git_back.md
Last active February 12, 2025 11:21
Git commits zurück nehmen

git commit rückgängig machen

  1. git log -> (Nummer wählen)
  2. git revert < Nummer >

revert macht nur die Änderung im commit rückgängig.
reset macht alles rückgängig bis dahin.

Dieser Gist ist ungenau oder auch falsch. Bei mir hats jetzt mal so funktioniert. Manpage lesen !