Fri 30/10/2020 22:02

This commit is contained in:
Joan Milev 2020-10-30 22:02:38 +02:00
parent 27aeedb0c8
commit 6bd1da1ebb
36 changed files with 245 additions and 284 deletions

View file

@ -1,3 +1,3 @@
#!/bin/dash #! /bin/sh
curl -s -L https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh | bash curl -fsL "https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh" | bash

View file

@ -1,18 +1,17 @@
#!/bin/bash #! /bin/sh
#Creates a clip of the currently watched streamer, opens the editor with xdg-open #Creates a clip of the currently watched streamer, opens the editor with xdg-open
#In case we're calling the clipit function without watching a stream first #In case we're calling the clipit function without watching a stream first
cd $(dirname "$0") cd "$(dirname "$0")"
config=$(readlink -f config) config="$(readlink -f config)"
source $config source "$config"
oauth="$(cat oauth|tr -d '\n')" oauth="$(cat oauth|tr -d '\n')"
broadcast_id=$(cat bId.txt) broadcast_id="$(cat bId.txt)"
clip=$(curl -s \ clip="$(curl -s \
-H "Client-ID: $client_id" \ -H "Client-ID: $client_id" \
-H "Authorization: Bearer $oauth" \ -H "Authorization: Bearer $oauth" \
-X POST "https://api.twitch.tv/helix/clips?broadcaster_id=$broadcast_id" | jq -c '.data[] | {"":.edit_url}' | tr -d '\"\{\}') -X POST "https://api.twitch.tv/helix/clips?broadcaster_id=$broadcast_id" | jq -c '.data[] | {"":.edit_url}' | tr -d '\"\{\}')"
if [[ -z $clip ]];then [ -z $clip ] && \
notify-send "Theatron" "Either the streamer isn't online or you're not watching anyone" notify-send "Theatron" "Either the streamer isn't online or you're not watching anyone"
fi
#Delete the first character(:) #Delete the first character(:)
clip="${clip:1}" clip="${clip:1}"

View file

@ -1,22 +1,23 @@
#!/bin/bash #! /bin/sh
cd $(dirname "$0") cd "$(dirname "$0")"
function poll(){ poll () {
id=$(curl -H 'Accept: application/vnd.twitchtv.v5+json' \ id="$(curl -H 'Accept: application/vnd.twitchtv.v5+json' \
-H 'Client-ID: fendbm5b5q1c2820m59sbdv9z95vs4' \ -H 'Client-ID: fendbm5b5q1c2820m59sbdv9z95vs4' \
-X GET "https://api.twitch.tv/kraken/users?login=$notify_me" | jq -c '.users[] |._id'| tr -d '"' | tr '\n' ',') -X GET "https://api.twitch.tv/kraken/users?login=$notify_me" | jq -c '.users[] |._id'| tr -d '"' | tr '\n' ',')"
live=$(curl -H 'Accept: application/vnd.twitchtv.v5+json' \ live="$(curl -H 'Accept: application/vnd.twitchtv.v5+json' \
-H 'Client-ID: fendbm5b5q1c2820m59sbdv9z95vs4' \ -H 'Client-ID: fendbm5b5q1c2820m59sbdv9z95vs4' \
-X GET "https://api.twitch.tv/kraken/streams/?channel=$id" | jq -c '.streams[] | .channel | {"": .name , " playing " : .game , " " : .status}' | tr -d '\{\}\,\"\:' | awk '{print $0"\n"}') -X GET "https://api.twitch.tv/kraken/streams/?channel=$id" \
| jq -c '.streams[] | .channel | {"": .name , " playing " : .game , " " : .status}' | tr -d '\{\}\,\"\:' | awk '{print $0"\n"}')"
echo "$live" echo "$live"
if [ -z "$live" ]; then if [ -z "$live" ]; then
echo "No one is on" echo "No one is on"
else else
notify-send -u critical "Theatron" "$live" notify-send -u critical "Theatron" "$live"
name=$(echo $live | awk '{print $1}') name="$(echo "$live" | awk '{print $1}')"
notify_me="${notify_me//$name}" notify_me="${notify_me//$name}"
echo $notify_me echo "$notify_me"
fi fi
sleep $1 sleep "$1"
} }
# The first argument is the interval # The first argument is the interval
@ -25,9 +26,9 @@ function poll(){
# Add strings for people you want to be notified about, ex. notify_me="imaqtpie,reckful" # Add strings for people you want to be notified about, ex. notify_me="imaqtpie,reckful"
notify_me="reckful,imaqtpie,strawbunnyhunny,pokimane,sodapoppin,methodjosh,nerites,forsen,asmongold,disguisedtoast,avoidingthepuddle,cxlibri" notify_me="reckful,imaqtpie,strawbunnyhunny,pokimane,sodapoppin,methodjosh,nerites,forsen,asmongold,disguisedtoast,avoidingthepuddle,cxlibri"
if [[ $1 == "once" ]];then if [ "$1" = "once" ];then
poll 0 poll 0
elif [[ -n $1 ]];then elif [ -n $1 ];then
while true while true
do do
poll "$1" poll "$1"

View file

@ -1,5 +1,5 @@
#!/bin/bash #! /bin/sh
while read -r input; do while read -r input; do
echo $input | sed 's/\s\+/\n/g' | sed -n '/.\{5\}.\+/p' echo "$input" | sed 's/\s\+/\n/g' | sed -n '/.\{5\}.\+/p'
done | fzf --height 10 | tr -d '\n' | kitty @send-text --stdin -m "id:$1" done | fzf --height 10 | tr -d "\n" | kitty @send-text --stdin -m "id:$1"

View file

@ -1,5 +1,5 @@
#!/bin/bash #! /bin/sh
sudo chmod 666 /dev/ttyACM0 sudo chmod 666 "/dev/ttyACM0"
#~/Downloads/Bazecor-0.2.0.AppImage #~/Downloads/Bazecor-0.2.0.AppImage
~/Downloads/Bazecor-0.2.2.AppImage ~/Downloads/Bazecor-0.2.2.AppImage

View file

@ -1,25 +1,22 @@
#!/bin/sh #! /bin/sh
print_host() print_host () {
{ [ -z "$HOST" ] && cat "/etc/hostname" || printf "%s\n" "$HOST"
[ -z "$HOST" ] && cat /etc/hostname || printf "$HOST\n"
} }
print_kernel() print_kernel () {
{ kernel="$(uname -r)"
kernel=$(uname -r)
kernel="${kernel%%_*}" kernel="${kernel%%_*}"
kernel="${kernel%%-*}" kernel="${kernel%%-*}"
printf "$kernel\n" printf "%s\n" "$kernel"
} }
print_pkgs() print_pkgs () {
{ C () { command -v "$@" >"/dev/null" 2>&1 ; }
C() { command -v "$@" >/dev/null 2>&1 ; } if [ -d "/bedrock" ] ; then
if [ -d /bedrock ] ; then
pkgs="N/A" pkgs="N/A"
elif C dpkg ; then elif C dpkg ; then
pkgs="$(printf $(dpkg-query -f '${binary:Package}\n' -W | wc -l))" pkgs="$(printf "$(dpkg-query -f "${binary:Package}\n" -W | wc -l)")"
elif C rpm ; then elif C rpm ; then
pkgs="$(rpm -qa | wc -l)" pkgs="$(rpm -qa | wc -l)"
elif C pacman ; then elif C pacman ; then
@ -39,57 +36,50 @@ print_pkgs()
else else
pkgs="N/A" pkgs="N/A"
fi fi
printf "$pkgs\n" printf "%s\n" "$pkgs"
} }
print_shell() print_shell () {
{
shell="${SHELL##*/}" shell="${SHELL##*/}"
printf "$shell\n" printf "%s\n" "$shell"
} }
print_os() print_os () {
{
if [ -e /etc/os-release ] && . /etc/os-release ; then if [ -e /etc/os-release ] && . /etc/os-release ; then
printf "$PRETTY_NAME\n" printf "%s\n" "$PRETTY_NAME"
elif [ -d /bedrock ] ; then elif [ -d "/bedrock" ] ; then
cat /bedrock/etc/bedrock-release cat "/bedrock/etc/bedrock-release"
else else
uname -s || printf "N/A\n" uname -s || printf "%s\n" "N/A"
fi fi
} }
print_wal() print_wal () {
{ wal="$(xrdb -q | grep wallpaper | awk 'NR == 2 {print $2}')"
wal=$(xrdb -q | grep wallpaper | awk 'NR == 2 {print $2}') printf "%s\n" "$wal"
printf "$wal\n"
} }
print_colors() print_colors () {
{
colors="$(xrdb -q | grep "#include" | awk '{print $2}')" colors="$(xrdb -q | grep "#include" | awk '{print $2}')"
colors="${colors##*/}" colors="${colors##*/}"
colors=${colors%\"} colors=${colors%\"}
printf "$colors\n" printf "%s\n" "$colors"
} }
print_user() print_user () {
{
if [ -z "$LOGNAME" ]; then if [ -z "$LOGNAME" ]; then
printf "N/A\n" printf "%s\n" "N/A"
else else
printf "$LOGNAME\n" printf "%s\n" "$LOGNAME"
fi fi
} }
print_resolution() print_resolution () {
{
printf "\n" printf "\n"
} }
set_colors() set_colors () {
{
r="\033[32m" r="\033[32m"
re="\033[0m" re="\033[0m"
gb="\033[42m" gb="\033[42m"
@ -99,22 +89,21 @@ set_colors()
} }
print_colors() print_colors () {
{
printf "\n" printf "\n"
printf " \e[41m \e[42m \e[43m \e[44m \e[45m \e[46m \e[0m\n" printf " \e[41m \e[42m \e[43m \e[44m \e[45m \e[46m \e[0m\n"
printf "\n" printf "\n"
} }
print_wm() print_wm () {
{ [ "$(command -v xprop >/dev/null 2>&1)" ] && \
if command -v xprop >/dev/null 2>&1 ; then WM="$(xprop -id "$(xprop -root -notype \
WM=$(xprop -id $(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t | grep "WM_NAME" | cut -f2 -d \") | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}')" -notype -f _NET_WM_NAME 8t \
else | grep -i "WM_NAME" \
| cut -f2 -d \")" || \
WM="TTY" WM="TTY"
fi
printf "$WM\n" printf "%s\n" "$WM"
} }
set_colors set_colors
@ -129,4 +118,3 @@ printf " $r│ HOS:$re %-30s$r│$re\n" "$(print_host)"
printf " $r│ USE:$re %-30s$r$re\n" "$(whoami)" printf " $r│ USE:$re %-30s$r$re\n" "$(whoami)"
printf " $r└────────────────────────────────────┘$re\n" printf " $r└────────────────────────────────────┘$re\n"
printf "\n" printf "\n"

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python3 #! /usr/bin/env python3
import re import re
import time import time
import subprocess import subprocess

View file

@ -1,2 +1,3 @@
#!/bin/bash #! /bin/sh
curl "cheat.sh/$*"
curl -fsL "cheat.sh/$*"

View file

@ -1,22 +1,21 @@
#!/bin/bash #! /bin/sh
get_coords() { get_coords () {
while read -r input; do while read -r input; do
name="$(echo "$input" | sed -r 's/^(.*)\s*\| .*$/\1/g' | tr -s " ")" name="$(echo "$input" | sed -r 's/^(.*)\s*\| .*$/\1/g' | tr -s " ")"
loc="$(echo "$input" | sed -r 's/^.*\s*\| (.*)$/\1/g')" loc="$(echo "$input" | sed -r 's/^.*\s*\| (.*)$/\1/g')"
escaped_query="$(echo "$loc" | sed 's/ /%20/g')" escaped_query="$(echo "$loc" | sed 's/ /%20/g')"
result=$(curl --silent \ result="$(curl --silent \
--header "Content-Type: application/json; charset=utf-8" \ --header "Content-Type: application/json; charset=utf-8" \
--header "Accept: application/json, application/geo+json"\ --header "Accept: application/json, application/geo+json"\
--header "application/gpx+xml, img/png; charset=utf-8" \ --header "application/gpx+xml, img/png; charset=utf-8" \
'https://api.openrouteservice.org/geocode/search?api_key=5b3ce3597851110001cf62484d58426d15954cf5a48cc900072babfb&text='"$escaped_query" \ 'https://api.openrouteservice.org/geocode/search?api_key=5b3ce3597851110001cf62484d58426d15954cf5a48cc900072babfb&text='"$escaped_query" \
| jq -c '.bbox | [.[0], .[1]]') | jq -c '.bbox | [.[0], .[1]]')"
echo "{\"name\": \"$name\", \"coordinates\": $result}" echo "{\"name\": \"$name\", \"coordinates\": $result}"
sleep 2 sleep 2
done done
} }
cat ~/Downloads/Unternehmensliste | get_coords cat "$HOME/Downloads/Unternehmensliste" | get_coords

View file

@ -1,4 +1,4 @@
#!/bin/bash #! /bin/sh
# distance in meter, duration in sekunden ( hier: per auto ) # distance in meter, duration in sekunden ( hier: per auto )
@ -20,6 +20,6 @@ distance() {
echo "{\"name\": \"$name\", \"dist\": $result}" echo "{\"name\": \"$name\", \"dist\": $result}"
sleep 2 sleep 2
done done
} }
cat ~/tmp/coordinates.json | distance cat ~/tmp/coordinates.json | distance

View file

@ -1,16 +1,15 @@
#!/bin/bash #! /bin/sh
last_selection=$(cat /tmp/fzf-open-conf-last 2>/dev/null) last_selection="$(cat "/tmp/fzf-open-conf-last" 2>"/dev/null")"
config_files_path="/home/leon/scripts/bookmarks/config_files" config_files_path="$HOME/scripts/bookmarks/config_files"
config_file_count=$((2+$(cat "$config_files_path" | wc -l))) config_file_count="$((2+$(cat "$config_files_path" | wc -l)))"
options=$(awk '{print $1}' $config_files_path) options="$(awk '{print $1}' "$config_files_path")"
if [ -n "$last_selection" ] ; then [ -n "$last_selection" ] && \
options="$last_selection\n$(echo "$options" | grep -v "$last_selection")" options="$last_selection\n$(echo "$options" | grep -v "$last_selection")"
fi
selected=$(echo -e "$options" | fzf --history=/tmp/conf-open-history --cycle --reverse --height "$config_file_count") selected="$(echo -e "$options" | fzf --history=/tmp/conf-open-history --cycle --reverse --height "$config_file_count")"
test "$selected" = "" && exit 1 test "$selected" = "" && exit 1
echo "$selected" > /tmp/fzf-open-conf-last echo "$selected" > "/tmp/fzf-open-conf-last"
file=$(grep "$selected" "$config_files_path" | sed -r 's/^\w*\s+(.*)$/\1/g') file="$(grep "$selected" "$config_files_path" | sed -r 's/^\w*\s+(.*)$/\1/g')"
echo "nvim $file" echo "$EDITOR $file"

View file

@ -1,7 +1,8 @@
# sh gitlab-api-script.sh | jq '[.data.namespace.projects.nodes[] | { name: .name, pipelines: .pipelines.nodes }]' | fx # sh gitlab-api-script.sh | jq '[.data.namespace.projects.nodes[] | { name: .name, pipelines: .pipelines.nodes }]' | fx
# sh gitlab-api-script.sh | jq '[.data.namespace.projects.nodes[] | { name: .name, pipelines: .pipelines.nodes }] | map(select((.pipelines | length) > 0))' | fx # sh gitlab-api-script.sh | jq '[.data.namespace.projects.nodes[] | { name: .name, pipelines: (.pipelines.nodes | map([.finishedAt, .status] | join(": ")))}] | map(select((.pipelines | length) > 0))' | fx # sh gitlab-api-script.sh | jq '[.data.namespace.projects.nodes[] | { name: .name, pipelines: .pipelines.nodes }] | map(select((.pipelines | length) > 0))' | fx # sh gitlab-api-script.sh | jq '[.data.namespace.projects.nodes[] | { name: .name, pipelines: (.pipelines.nodes | map([.finishedAt, .status] | join(": ")))}] | map(select((.pipelines | length) > 0))' | fx
token="i3_yxQr4ypsKkcht4AnS" data=$(curl "https://git.xware-gmbh.de/api/graphql" -H "Authorization: Bearer $token" -H "Content-Type: application/json" --request POST -s --data @- << GQL token="i3_yxQr4ypsKkcht4AnS" data="$(curl -fsL "https://git.xware-gmbh.de/api/graphql" -H "Authorization: Bearer $token" \
-H "Content-Type: application/json" --request POST -s --data @- << GQL
{ "query": " { "query": "
query { query {
namespace(fullPath: \"xware\") { namespace(fullPath: \"xware\") {
@ -22,25 +23,23 @@ token="i3_yxQr4ypsKkcht4AnS" data=$(curl "https://git.xware-gmbh.de/api/graphql"
}" }"
} }
GQL GQL
) )"
#echo $data | jq '[.data.namespace.projects.nodes[] | { name: .name, pipelines: (.pipelines.nodes[0].status)}] | map(select((.pipelines | length) > 0)) | map([.name, .pipelines] | join(": "))' | sed 's/"//g' | sed 's/^null$//' #echo $data | jq '[.data.namespace.projects.nodes[] | { name: .name, pipelines: (.pipelines.nodes[0].status)}] | map(select((.pipelines | length) > 0)) | map([.name, .pipelines] | join(": "))' | sed 's/"//g' | sed 's/^null$//'
filter () { filter () {
now=$( date +%s ) now="$( date +%s )"
maxAge=$( expr $now - 60 \* 5) maxAge="$($(("$now" - 60 * 5)))"
while read input; do while read input; do
agePart=$( echo $input | sed 's/::::.*$//g' | sed 's/"//g' ) agePart="$( echo $input | sed 's/::::.*$//g' | sed 's/"//g' )"
age=$( date --date="$agePart" +%s ) age="$( date --date="$agePart" +%s )"
if [ -z "$agePart" ]; then # -z -> length of string is < 0 [ -z "$agePart" ] && \ # -z -> length of string is < 0
echo age $pagePart echo "age "$pagePart""
echo $input | sed 's/:::://g' echo "$input" | sed 's/:::://g' || \
elif [ $maxAge -lt $age ]; then [ "$maxAge" -lt "$age" ] && \
echo $input | sed 's/^.*:::://g' echo "$input" | sed 's/^.*:::://g'
fi
done done
} }
a=$(echo $data | jq '[.data.namespace.projects.nodes[] | {name: .name, status: .pipelines.nodes[0].status, finishedAt: .pipelines.nodes[0].finishedAt}]') a="$(echo "$data" | jq '[.data.namespace.projects.nodes[] | {name: .name, status: .pipelines.nodes[0].status, finishedAt: .pipelines.nodes[0].finishedAt}]')"
b=$(echo $a | jq 'map(select(.status | length > 0)) | map(.finishedAt + "::::" + .name + ": " + .status) | .[]' | sort -nr | head -n 1) b="$(echo "$a" | jq 'map(select(.status | length > 0)) | map(.finishedAt + "::::" + .name + ": " + .status) | .[]' | sort -nr | head -n 1)"
echo $b | filter echo "$b" | filter

View file

@ -1,7 +1,8 @@
#! /bin/sh #! /bin/sh
exec xprop -notype \ exec xprop -notype \
-f WM_NAME 8s ':\n title =\? $0\n' \ -f WM_NAME 8s ':\n title =\? $0\n' \
-f WM_CLASS 8s ':\n appName =\? $0\n className =\? $1\n' \ -f WM_CLASS 8s ':\n appName =\? $0\n className =\? $1\n' \
-f WM_WINDOW_ROLE 8s ':\n stringProperty "WM_WINDOW_ROLE" =\? $0\n' \ -f WM_WINDOW_ROLE 8s ':\n stringProperty "WM_WINDOW_ROLE" =\? $0\n' \
WM_NAME WM_CLASS WM_WINDOW_ROLE \ WM_NAME WM_CLASS WM_WINDOW_ROLE \
${1+"$@"} "${1+"$@"}"

View file

@ -1,22 +1,21 @@
#!/bin/bash #! /bin/bash
menu_name="$1" menu_name="$1"
if [ -n "$menu_name" ]; then [ -n "$menu_name" ] && \
last_selection=$(cat "/tmp/fzfopen_$menu_name" 2>/dev/null) last_selection="$(cat "/tmp/fzfopen_$menu_name" 2>"/dev/null")"
fi
options_list=$(</dev/stdin) options_list="$(</dev/stdin)"
option_count=$((2+$(echo -e "$options_list" | wc -l))) option_count="$((2+$(echo -e "$options_list" | wc -l)))"
options=$(echo -e "$options_list" | awk '{print $1}') options="$(echo -e "$options_list" | awk '{print $1}')"
if [ -n "$last_selection" ]; then [ -n "$last_selection" ] && \
options="$last_selection\n$(echo -e "$options" | grep -v "$last_selection")" options="$last_selection\n$(echo -e "$options" | grep -v "$last_selection")"
fi
selected=$(echo -e "$options" | fzf --history=/tmp/conf-open-history --cycle --reverse --height "$option_count") selected=$(echo -e "$options" | fzf --history=/tmp/conf-open-history --cycle --reverse --height "$option_count")
[[ -z "$selected" ]] && exit 1 [[ -z "$selected" ]] && exit 1
[[ -n "$menu_name" ]] && echo "$selected" > "/tmp/fzfopen_$menu_name" [[ -n "$menu_name" ]] && echo "$selected" > "/tmp/fzfopen_$menu_name"
selected_value=$(echo -e "$options_list" | grep "$selected" | sed -r 's/^\w*\s+(.*)$/\1/g') selected_value="$(echo -e "$options_list" | grep "$selected" | sed -r 's/^\w*\s+(.*)$/\1/g')"
echo "$selected_value" echo "$selected_value"

View file

@ -1,10 +1,7 @@
#!/bin/dash #! /bin/sh
#sudo cat /sys/kernel/debug/dri/0/amdgpu_pm_info #sudo cat /sys/kernel/debug/dri/0/amdgpu_pm_info
[ "$1" = "--watch" ] && \
if [ "$1" = "--watch" ]; then sudo watch --no-title -n "0.5" "cat /sys/kernel/debug/dri/0/amdgpu_pm_info | grep -A 10 'GFX Clocks and Power'" || \
sudo watch --no-title -n 0.5 "cat /sys/kernel/debug/dri/0/amdgpu_pm_info | grep -A 10 'GFX Clocks and Power'" sudo cat "/sys/kernel/debug/dri/0/amdgpu_pm_info" \
else | sed -n 's/^GPU Load: \(.*\)$/\1/gp'
sudo cat /sys/kernel/debug/dri/0/amdgpu_pm_info \
| sed -n 's/^GPU Load: \(.*\)$/\1/gp'
fi

View file

@ -1,12 +1,10 @@
#!/bin/sh #! /bin/sh
kak -clear kak -clear
session="${PWD##*/}" session="${PWD##*/}"
if ! kak -l | grep -q "$session"; then [ ! "$(kak -l | grep -iq "$session")" ] && \
kak -d -s "$session" & kak -d -s "$session" &
fi
kak -c "$session" "$@" kak -c "$session" "$@"

View file

@ -1,9 +1,9 @@
#!/bin/bash #! /bin/sh
killall -q lemonbar pkill -9 lemonbar
datetime() { datetime() {
datetime=$(date "+%H:%M | %a, %d.%m.%y") datetime="$(date "+%H:%M | %a, %d.%m.%y")"
#echo -e -n "\uf073 ${datetime}" #echo -e -n "\uf073 ${datetime}"
#echo -e -n " ${datetime}" #echo -e -n " ${datetime}"
echo -e -n "${datetime}" echo -e -n "${datetime}"
@ -12,7 +12,7 @@ datetime() {
output() { output() {
while true; do while true; do
echo -e -n "%{l}%{l}%{r}\ue0b0 $(datetime)%{r}" echo -e -n "%{l}%{l}%{r}\ue0b0 $(datetime)%{r}"
sleep 0.1s sleep "0.1s"
done done
} }

View file

@ -1,3 +1,2 @@
#!/bin/bash #! /bin/sh
echo "%{r} $(date "+%H:%M - %a, %d.%m.%y")%{-r} " | lemonbar -p -f "Jetbrains Mono:size=10" -f "Font Awesome:size=10" -B "#66282833" -g "480x25+2066+7" echo "%{r} $(date "+%H:%M - %a, %d.%m.%y")%{-r} " | lemonbar -p -f "Jetbrains Mono:size=10" -f "Font Awesome:size=10" -B "#66282833" -g "480x25+2066+7"

View file

@ -1,4 +1,4 @@
#!/bin/bash #! /bin/sh
#xmonad-log | lemonbar -p -f "Jetbrains Mono:size=9" -B "#66282833" -g "420x25+14+7" #xmonad-log | lemonbar -p -f "Jetbrains Mono:size=9" -B "#66282833" -g "420x25+14+7"
#xmonad-log | lemonbar -p -f "Jetbrains Mono:size=10" -B "#66282833" -g "480x25+14+7" #xmonad-log | lemonbar -p -f "Jetbrains Mono:size=10" -B "#66282833" -g "480x25+14+7"

View file

@ -1,8 +1,8 @@
#!/bin/bash #! /bin/sh
stack new "$1" stack new "$1"
cd "$1" cd "$1"
echo -e "cradle:\n stack:" >> hie.yaml echo "cradle:\n stack:" >> hie.yaml
sed -i 's/^resolver: .*$/resolver: lts-15.0/' stack.yaml sed -i 's/^resolver: .*$/resolver: lts-15.0/' stack.yaml
stack setup stack setup
stack build --fast stack build --fast

View file

@ -1,15 +1,11 @@
#!/bin/bash #! /bin/sh
repo_url="$1" repo_url="$1"
rev="$2" rev="$2"
[ -n "$rev" ] && \
output="$(nix-prefetch-git "$repo_url" --rev "$rev" 2>"/dev/null")" || \
if [ -n "$rev" ]; then output="$(nix-prefetch-git "$repo_url" 2>"/dev/null")"
output="$(nix-prefetch-git "$repo_url" --rev "$rev" 2>/dev/null)"
else
output="$(nix-prefetch-git "$repo_url" 2>/dev/null)"
fi

View file

@ -1,20 +1,19 @@
#!/bin/sh #! /bin/sh
NIX_STASH_DIR="$XDG_CONFIG_HOME/nix_stash" NIX_STASH_DIR="$XDG_CONFIG_HOME/nix_stash"
FILE_STACK_PATH="$NIX_STASH_DIR/nix_stash_stack" FILE_STACK_PATH="$NIX_STASH_DIR/nix_stash_stack"
# pop the last line from the file-stack and return it # pop the last line from the file-stack and return it
pop_from_file_stack() { pop_from_file_stack () {
line="$(tail -n 1 "$FILE_STACK_PATH")" line="$(tail -n 1 "$FILE_STACK_PATH")"
if [ -z "$line" ]; then [ -z "$line" ] && \
exit 1 exit 1
fi
sed -i "$ d" "$FILE_STACK_PATH" sed -i "$ d" "$FILE_STACK_PATH"
echo "$line" echo "$line"
} }
do_pop() { do_pop () {
last_file="$(pop_from_file_stack)" || exit 1 last_file="$(pop_from_file_stack)" || exit 1
echo "restoring $last_file" echo "restoring $last_file"
trash "$last_file" trash "$last_file"
@ -23,19 +22,17 @@ do_pop() {
} }
do_stash() { do_stash () {
config_file="$(realpath --no-symlinks "$1")" config_file="$(realpath --no-symlinks "$1")"
if [ ! -L "$config_file" ]; then [ ! -L "$config_file" ] && \
echo "Given file is not a symlink into the nix-store" echo "Given file is not a symlink into the nix-store" && \
exit 1 exit 1
fi
file_in_store="$(readlink -f "$config_file")" file_in_store="$(readlink -f "$config_file")"
if ! echo "$file_in_store" | grep -q "/nix/store"; then [ ! "$(echo "$file_in_store" | grep -iq "/nix/store")" ] && \
echo "file is not a symlink into the nix store" echo "file is not a symlink into the nix store" && \
exit 1 exit 1
fi
# remove the symlink and write the path to the stack # remove the symlink and write the path to the stack
mkdir -p "$NIX_STASH_DIR" mkdir -p "$NIX_STASH_DIR"
@ -50,11 +47,11 @@ do_stash() {
"$EDITOR" "$config_file" "$EDITOR" "$config_file"
} }
do_list() { do_list () {
cat "$FILE_STACK_PATH" cat "$FILE_STACK_PATH"
} }
print_usage() { print_usage () {
echo "usage: $0 {<filepath> | pop | list}" echo "usage: $0 {<filepath> | pop | list}"
echo " to stash a file: $0 <filepath>" echo " to stash a file: $0 <filepath>"
echo " to restore a file: $0 pop" echo " to restore a file: $0 pop"
@ -76,6 +73,3 @@ case "$1" in
do_stash "$1" do_stash "$1"
;; ;;
esac esac

View file

@ -1,6 +1,6 @@
#!/bin/bash #! /bin/sh
expac -SsH M "%m: %n$\t%d" $@ | sort -h | tr '$' '\n' expac -SsH M "%m: %n$\t%d" "$@" | sort -h | tr "$" "\n"
# less verbose: expac -S -H M "%m %n"|sort -n # less verbose: expac -S -H M "%m %n"|sort -n

View file

@ -1,27 +1,22 @@
#!/bin/sh #! /bin/sh
type="$(file --mime-type "$@")"
case "$(file --mime-type "$1")" in case "$type" in
*text*) *text*)
bat --color always --plain --theme gruvbox "$1" bat --color always --plain --theme gruvbox "$@"
;; ;;
*image* | *pdf) *image* | *pdf)
if command -v timg; then [ "$(command -v timg)" ] && \
timg -g50x50 -E -F "$1" timg -g50x50 -E -F "$@" || \
elif command -v catimg; then [ "$(command -v catimg)" ] && \
catimg -w 100 -r 2 "$1" catimg -w 100 -r 2 "$@" || \
else
echo "Install timg or catimg to view images!" echo "Install timg or catimg to view images!"
fi
;; ;;
*directory*) *directory*)
exa --icons -1 --color=always "$1" exa --icons -1 --color=always "$@"
;; ;;
*) *)
echo "unknown file format" echo "unknown file format"
;; ;;
esac esac

View file

@ -1,10 +1,10 @@
#!/bin/sh #! /bin/sh
calc_percentage() { calc_percentage () {
echo "$(($(("$1" / 100)) * "$2"))" echo "$(($(("$1" / 100)) * "$2"))"
} }
help() { help () {
cat << EOT cat << EOT
Usage: resizeGif.sh <input-file> [OPTIONS] Usage: resizeGif.sh <input-file> [OPTIONS]
@ -17,10 +17,9 @@ Options:
EOT EOT
} }
if [ -z "$1" ]; then [ -z "$1" ] && \
help help && \
exit 1 exit 1
fi
IN_FILE="$1" IN_FILE="$1"
shift shift
@ -50,35 +49,29 @@ done
base_resolution=$(identify "$IN_FILE" | awk 'NR==1{print $3}') base_resolution="$(identify "$IN_FILE" | awk 'NR==1{print $3}')"
x_res="$(echo "$base_resolution" | sed 's/\(.*\)x\(.*\)/\1/g')" x_res="$(echo "$base_resolution" | sed 's/\(.*\)x\(.*\)/\1/g')"
y_res="$(echo "$base_resolution" | sed 's/\(.*\)x\(.*\)/\2/g')" y_res="$(echo "$base_resolution" | sed 's/\(.*\)x\(.*\)/\2/g')"
if [ -n "$PERCENTAGE" ]; then [ -n "$PERCENTAGE" ] && \
x_scaled="$(calc_percentage "$x_res" "$PERCENTAGE")" x_scaled="$(calc_percentage "$x_res" "$PERCENTAGE")" && \
y_scaled="$(calc_percentage "$y_res" "$PERCENTAGE")" y_scaled="$(calc_percentage "$y_res" "$PERCENTAGE")" || \
elif [ -n "$COARSE_IN" ]; then [ -n "$COARSE_IN" ] && \
arg_x="$(echo "$COARSE_IN" | sed 's/\(.*\)x\(.*\)/\1/g')" arg_x="$(echo "$COARSE_IN" | sed 's/\(.*\)x\(.*\)/\1/g')" && \
arg_y="$(echo "$COARSE_IN" | sed 's/\(.*\)x\(.*\)/\2/g')" arg_y="$(echo "$COARSE_IN" | sed 's/\(.*\)x\(.*\)/\2/g')" && \
x_fact="$(( $((arg_x * 100)) / x_res))" x_fact="$(( $((arg_x * 100)) / x_res))" && \
y_fact="$(( $((arg_y * 100)) / y_res))" y_fact="$(( $((arg_y * 100)) / y_res))" && \
if [ "$x_fact" -lt "$y_fact" ]; then [ "$x_fact" -lt "$y_fact" ] && \
lower_fact="$x_fact" lower_fact="$x_fact" || \
else lower_fact="$y_fact" && \
lower_fact="$y_fact" x_scaled="$(calc_percentage "$x_res" "$lower_fact")" && \
fi y_scaled="$(calc_percentage "$y_res" "$lower_fact")" || \
echo "You need to give --percentage or --coarse-in." && \
x_scaled="$(calc_percentage "$x_res" "$lower_fact")"
y_scaled="$(calc_percentage "$y_res" "$lower_fact")"
else
echo "You need to give --percentage or --coarse-in."
exit 1 exit 1
fi
if [ -z "$OUT_FILE" ]; then [ -z "$OUT_FILE" ] && \
OUT_FILE="smaller_${IN_FILE}" OUT_FILE="smaller_${IN_FILE}"
fi
echo "resizing to ${x_scaled}x${y_scaled}" echo "resizing to ${x_scaled}x${y_scaled}"

View file

@ -1,14 +1,10 @@
#!/bin/bash #! /bin/sh
groups="$(ls "$HOME/scripts/bookmarks")\nauswahl" groups="$(ls "$HOME/scripts/bookmarks")\nauswahl"
group_selection=$(echo -e "$groups" | rofi -i -matching fuzzy -p open -dmenu -no-custom) group_selection="$(echo "$groups" | rofi -i -matching fuzzy -p open -dmenu -no-custom)"
if [ "$group_selection" = "auswahl" ]; then [ "$group_selection" = "auswahl" ] && \
auswahl "$(auswahl --list | rofi -dmenu -i -no-custom)" auswahl "$(auswahl --list | rofi -dmenu -i -no-custom)" || \
else selection=$( cat "$HOME/scripts/bookmarks/$group_selection" | sed -r 's/^([^ ]*) .*$/\1/' | rofi -p open -matching fuzzy -dmenu -i -no-custom) && \
selection=$( cat "$HOME/scripts/bookmarks/$group_selection" | sed -r 's/^([^ ]*) .*$/\1/' | rofi -p open -matching fuzzy -dmenu -i -no-custom)
[ -z "$selection" ] && exit 1 [ -z "$selection" ] && exit 1
cat "$HOME/scripts/bookmarks/$group_selection" | sed -n -r "s/^$selection (.*)$/\1/p" | bash cat "$HOME/scripts/bookmarks/$group_selection" | sed -n -r "s/^$selection (.*)$/\1/p" | bash
fi

View file

@ -1,5 +1,8 @@
#!/bin/bash #! /bin/sh
token="i3_yxQr4ypsKkcht4AnS" data=$(curl "https://git.xware-gmbh.de/api/graphql" -H "Authorization: Bearer $token" -H "Content-Type: application/json" --request POST -s --data @- << GQL token="i3_yxQr4ypsKkcht4AnS" data="$(curl "https://git.xware-gmbh.de/api/graphql" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
--request POST -s --data @- << GQL
{ "query": " { "query": "
query { query {
xware: namespace(fullPath: \"xware\") { xware: namespace(fullPath: \"xware\") {
@ -11,9 +14,8 @@ token="i3_yxQr4ypsKkcht4AnS" data=$(curl "https://git.xware-gmbh.de/api/graphql"
}" }"
} }
GQL GQL
) )"
a=$(echo "$data" | jq -r '.data.xware.projects.nodes + .data.leon.projects.nodes | map(.name + "::::" + .httpUrlToRepo)[]') a="$(echo "$data" | jq -r '.data.xware.projects.nodes + .data.leon.projects.nodes | map(.name + "::::" + .httpUrlToRepo)[]')"
selection=$(echo "$a" | sed -r 's/^(.*)::::.*$/\1/g' | rofi -dmenu -i -theme "$HOME/scripts/rofi-scripts/default_theme.rasi") selection="$(echo "$a" | sed -r 's/^(.*)::::.*$/\1/g' | rofi -dmenu -i -theme "$HOME/scripts/rofi-scripts/default_theme.rasi")"
[ ! "$selection" = "" ] && echo "$a" | sed -r -n "s/^$selection::::(.*)$/\1/pg" | xargs qutebrowser [ ! "$selection" = "" ] && echo "$a" | sed -r -n "s/^$selection::::(.*)$/\1/pg" | xargs qutebrowser

View file

@ -1,2 +1,3 @@
#!/bin/bash #! /bin/sh
DISPLAY=:0 Xephyr -br -ac -noreset -screen 1920x1080 -keybd ephyr,,,xkbmodel=evdev,xkblayout=de :2 DISPLAY=:0 Xephyr -br -ac -noreset -screen 1920x1080 -keybd ephyr,,,xkbmodel=evdev,xkblayout=de :2

View file

@ -1,4 +1,4 @@
#!/bin/bash #! /bin/sh
file="$HOME/Bilder/gifs/gif_$(date +%s).gif" file="$HOME/Bilder/gifs/gif_$(date +%s).gif"
giph -s -l -y -f 10 -c 1,1,1,0.3 -b 5 -p 5 "$file" giph -s -l -y -f 10 -c 1,1,1,0.3 -b 5 -p 5 "$file"

View file

@ -1,7 +1,7 @@
#!/bin/dash #! /bin/sh
if [ -z "$1" ]; then
echo "usage: screenrecorder.sh <output-file-path>"
exit 1
fi
ffmpeg -video_size 2560x1080 -framerate 25 -f x11grab -i :0.0 "$1" [ -z "$1" ] && \
echo "usage: screenrecorder.sh <output-file-path>" && \
exit 1
ffmpeg -video_size 2560x1080 -framerate 25 -f x11grab -i :0.0 "$@"

View file

@ -1,20 +1,23 @@
#!/bin/bash #! /bin/sh
to_file=0 to_file="0"
fullscreen=0 fullscreen="0"
for arg in "$@"; do
case $arg in case $arg in
--tofile) to_file=1;; --tofile)
--fullscreen) fullscreen=1;; to_file="1"
esac ;;
done --fullscreen)
fullscreen="1"
;;
esac
# Do not quote this, this is multiple flags # Do not quote this, this is multiple flags
select_flag="-s --highlight --color 1,1,1,0.1" select_flag="-s --highlight --color 1,1,1,0.1"
[ $fullscreen -eq 1 ] && select_flag="" [ "$fullscreen" -eq 1 ] && select_flag=""
if [ $to_file -eq 1 ]; then if [ "$to_file" -eq 1 ]; then
file="$HOME/Bilder/screenshots/screenshot_$(date +%s).png" file="$HOME/Bilder/screenshots/screenshot_$(date +%s).png"
echo "$file" echo "$file"
[ -z "$select_flag" ] && sleep 1 [ -z "$select_flag" ] && sleep 1

View file

@ -1,4 +1,4 @@
#!/bin/sh #! /bin/sh
rec_filename="$HOME/Bilder/screenvids/$(date '+%Y-%m-%d_%H-%M-%S').mp4" rec_filename="$HOME/Bilder/screenvids/$(date '+%Y-%m-%d_%H-%M-%S').mp4"
scr -m s -c "$rec_filename" scr -m s -c "$rec_filename"

View file

@ -1,4 +1,4 @@
#!/bin/bash #! /bin/sh
# NAME: dropshadow.sh # NAME: dropshadow.sh
# VERSION: # VERSION:
# AUTHOR: (c) 2013 Glutanimate # AUTHOR: (c) 2013 Glutanimate
@ -21,11 +21,11 @@
SCREENSHOTFOLDER="$HOME/Pictures/Screenshots" SCREENSHOTFOLDER="$HOME/Pictures/Screenshots"
FILE="${1}" FILE="${1}"
FILENAME="${FILE##*/}" FILENAME="${FILE##*/}"
FILEBASE="${FILENAME%.*}" FILEBASE="${FILENAME%.*}"
convert "${FILE}" \( +clone -background black -shadow 80x20+0+15 \) +swap -background transparent -layers merge +repage "$SCREENSHOTFOLDER/${FILEBASE}.png" convert "${FILE}" \( +clone -background black -shadow 80x20+0+15 \) +swap \
-background transparent -layers merge +repage "$SCREENSHOTFOLDER/${FILEBASE}.png"
rm "$FILE" #remove this line to preserve original image rm "$FILE" #remove this line to preserve original image

View file

@ -1,19 +1,19 @@
#! /bin/bash #! /bin/sh
file="$HOME/.local/share/unhide" file="$HOME/.local/share/unhide"
app="$1" app="$1"
#target="$2" #target="$2"
tid=$(xdo id) tid="$(xdo id)"
hidecurrent() { hidecurrent() {
echo $tid+$app >> $file & xdo hide echo "$tid+$app" >> "$file" & xdo hide
} }
showlast() { showlast() {
sid=$(cat $file | grep "$app" | awk -F "+" 'END{print $1}') sid="$(cat $file | grep "$app" | awk -F "+" 'END{print $1}')"
xdo show -r $sid xdo show -r "$sid"
} }
hidecurrent & $@ ; showlast hidecurrent & "$@" ; showlast

View file

@ -1,6 +1,7 @@
#!/bin/dash #! /bin/sh
if [ -z "$1" ]; then
echo "timer.sh <time>" [ -z "$1" ] && \
echo "timer.sh <time>" && \
exit 1 exit 1
fi
termdown -o /home/leon/scripts/remainingTime.txt "$1" && notify-send "Timer" "Timer finished: $1" termdown -o /home/leon/scripts/remainingTime.txt "$1" && notify-send "Timer" "Timer finished: $1"

View file

@ -1,13 +1,13 @@
#!/bin/bash #! /bin/sh
xdg-open 'https://jira-student.it.hs-heilbronn.de/secure/RapidBoard.jspa?rapidView=323&projectKey=RUNDUM&selectedIssue=RUNDUM-141' xdg-open 'https://jira-student.it.hs-heilbronn.de/secure/RapidBoard.jspa?rapidView=323&projectKey=RUNDUM&selectedIssue=RUNDUM-141'
cd ~/coding/studium/swlab/backend_studez/ || exit cd "$HOME/coding/studium/swlab/backend_studez/" || exit
#docker-compose stop #docker-compose stop
#docker-compose rm -f #docker-compose rm -f
docker-compose up -d docker-compose up -d
nohup ~/intelliJInstall/bin/idea.sh ~/coding/studium/swlab/backend_studez/studez_backend & nohup "$HOME/intelliJInstall/bin/idea.sh" "$HOME/coding/studium/swlab/backend_studez/studez_backend" &
kitty @ launch --keep-focus --type=tab --cwd ~/coding/studium/swlab/frontend_studez/studez_frontend/ npm start kitty @ launch --keep-focus --type=tab --cwd "$HOME/coding/studium/swlab/frontend_studez/studez_frontend/" npm start
cd ~/coding/studium/swlab/frontend_studez/studez_frontend/src || exit cd "$HOME/coding/studium/swlab/frontend_studez/studez_frontend/src" || exit
git fetch git fetch
kitty @ send-text "cd ~/coding/studium/swlab/frontend_studez/studez_frontend/src\ngit checkout " kitty @ send-text "cd $HOME/coding/studium/swlab/frontend_studez/studez_frontend/src\ngit checkout "