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
#In case we're calling the clipit function without watching a stream first
cd $(dirname "$0")
config=$(readlink -f config)
source $config
cd "$(dirname "$0")"
config="$(readlink -f config)"
source "$config"
oauth="$(cat oauth|tr -d '\n')"
broadcast_id=$(cat bId.txt)
clip=$(curl -s \
broadcast_id="$(cat bId.txt)"
clip="$(curl -s \
-H "Client-ID: $client_id" \
-H "Authorization: Bearer $oauth" \
-X POST "https://api.twitch.tv/helix/clips?broadcaster_id=$broadcast_id" | jq -c '.data[] | {"":.edit_url}' | tr -d '\"\{\}')
if [[ -z $clip ]];then
-X POST "https://api.twitch.tv/helix/clips?broadcaster_id=$broadcast_id" | jq -c '.data[] | {"":.edit_url}' | tr -d '\"\{\}')"
[ -z $clip ] && \
notify-send "Theatron" "Either the streamer isn't online or you're not watching anyone"
fi
#Delete the first character(:)
clip="${clip:1}"

View file

@ -1,22 +1,23 @@
#!/bin/bash
cd $(dirname "$0")
function poll(){
id=$(curl -H 'Accept: application/vnd.twitchtv.v5+json' \
#! /bin/sh
cd "$(dirname "$0")"
poll () {
id="$(curl -H 'Accept: application/vnd.twitchtv.v5+json' \
-H 'Client-ID: fendbm5b5q1c2820m59sbdv9z95vs4' \
-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' \
-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' \
-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"
if [ -z "$live" ]; then
echo "No one is on"
else
notify-send -u critical "Theatron" "$live"
name=$(echo $live | awk '{print $1}')
name="$(echo "$live" | awk '{print $1}')"
notify_me="${notify_me//$name}"
echo $notify_me
echo "$notify_me"
fi
sleep $1
sleep "$1"
}
# 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"
notify_me="reckful,imaqtpie,strawbunnyhunny,pokimane,sodapoppin,methodjosh,nerites,forsen,asmongold,disguisedtoast,avoidingthepuddle,cxlibri"
if [[ $1 == "once" ]];then
if [ "$1" = "once" ];then
poll 0
elif [[ -n $1 ]];then
elif [ -n $1 ];then
while true
do
poll "$1"

View file

@ -1,5 +1,5 @@
#!/bin/bash
#! /bin/sh
while read -r input; do
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"
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"

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.2.AppImage

View file

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

View file

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

View file

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

View file

@ -1,22 +1,21 @@
#!/bin/bash
#! /bin/sh
get_coords() {
get_coords () {
while read -r input; do
name="$(echo "$input" | sed -r 's/^(.*)\s*\| .*$/\1/g' | tr -s " ")"
loc="$(echo "$input" | sed -r 's/^.*\s*\| (.*)$/\1/g')"
escaped_query="$(echo "$loc" | sed 's/ /%20/g')"
result=$(curl --silent \
result="$(curl --silent \
--header "Content-Type: application/json; charset=utf-8" \
--header "Accept: application/json, application/geo+json"\
--header "application/gpx+xml, img/png; charset=utf-8" \
'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}"
sleep 2
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 )
@ -20,6 +20,6 @@ distance() {
echo "{\"name\": \"$name\", \"dist\": $result}"
sleep 2
done
}
}
cat ~/tmp/coordinates.json | distance

View file

@ -1,16 +1,15 @@
#!/bin/bash
last_selection=$(cat /tmp/fzf-open-conf-last 2>/dev/null)
#! /bin/sh
last_selection="$(cat "/tmp/fzf-open-conf-last" 2>"/dev/null")"
config_files_path="/home/leon/scripts/bookmarks/config_files"
config_file_count=$((2+$(cat "$config_files_path" | wc -l)))
config_files_path="$HOME/scripts/bookmarks/config_files"
config_file_count="$((2+$(cat "$config_files_path" | wc -l)))"
options=$(awk '{print $1}' $config_files_path)
if [ -n "$last_selection" ] ; then
options="$(awk '{print $1}' "$config_files_path")"
[ -n "$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
echo "$selected" > /tmp/fzf-open-conf-last
file=$(grep "$selected" "$config_files_path" | sed -r 's/^\w*\s+(.*)$/\1/g')
echo "nvim $file"
echo "$selected" > "/tmp/fzf-open-conf-last"
file="$(grep "$selected" "$config_files_path" | sed -r 's/^\w*\s+(.*)$/\1/g')"
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 }] | 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 {
namespace(fullPath: \"xware\") {
@ -19,28 +20,26 @@ token="i3_yxQr4ypsKkcht4AnS" data=$(curl "https://git.xware-gmbh.de/api/graphql"
}
}
}
}"
}"
}
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$//'
filter () {
now=$( date +%s )
maxAge=$( expr $now - 60 \* 5)
now="$( date +%s )"
maxAge="$($(("$now" - 60 * 5)))"
while read input; do
agePart=$( echo $input | sed 's/::::.*$//g' | sed 's/"//g' )
age=$( date --date="$agePart" +%s )
if [ -z "$agePart" ]; then # -z -> length of string is < 0
echo age $pagePart
echo $input | sed 's/:::://g'
elif [ $maxAge -lt $age ]; then
echo $input | sed 's/^.*:::://g'
fi
agePart="$( echo $input | sed 's/::::.*$//g' | sed 's/"//g' )"
age="$( date --date="$agePart" +%s )"
[ -z "$agePart" ] && \ # -z -> length of string is < 0
echo "age "$pagePart""
echo "$input" | sed 's/:::://g' || \
[ "$maxAge" -lt "$age" ] && \
echo "$input" | sed 's/^.*:::://g'
done
}
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)
echo $b | filter
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)"
echo "$b" | filter

View file

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

View file

@ -1,22 +1,21 @@
#!/bin/bash
#! /bin/bash
menu_name="$1"
if [ -n "$menu_name" ]; then
last_selection=$(cat "/tmp/fzfopen_$menu_name" 2>/dev/null)
fi
[ -n "$menu_name" ] && \
last_selection="$(cat "/tmp/fzfopen_$menu_name" 2>"/dev/null")"
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")"
fi
selected=$(echo -e "$options" | fzf --history=/tmp/conf-open-history --cycle --reverse --height "$option_count")
[[ -z "$selected" ]] && exit 1
[[ -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"

View file

@ -1,10 +1,7 @@
#!/bin/dash
#! /bin/sh
#sudo cat /sys/kernel/debug/dri/0/amdgpu_pm_info
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'"
else
sudo cat /sys/kernel/debug/dri/0/amdgpu_pm_info \
| sed -n 's/^GPU Load: \(.*\)$/\1/gp'
fi
[ "$1" = "--watch" ] && \
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" \
| sed -n 's/^GPU Load: \(.*\)$/\1/gp'

View file

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

View file

@ -1,9 +1,9 @@
#!/bin/bash
#! /bin/sh
killall -q lemonbar
pkill -9 lemonbar
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 " ${datetime}"
echo -e -n "${datetime}"
@ -12,8 +12,8 @@ datetime() {
output() {
while true; do
echo -e -n "%{l}%{l}%{r}\ue0b0 $(datetime)%{r}"
sleep 0.1s
done
sleep "0.1s"
done
}
output | lemonbar -f "Roboto:size=10" -f "Font Awesome:size=10" -f "Iosevka Nerd Font" -B "#282828" -g "2532x30+14+7" &

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"

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=10" -B "#66282833" -g "480x25+14+7"

View file

@ -1,8 +1,8 @@
#!/bin/bash
#! /bin/sh
stack new "$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
stack setup
stack build --fast

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,8 @@
#!/bin/bash
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
#! /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
{ "query": "
query {
xware: namespace(fullPath: \"xware\") {
@ -8,12 +11,11 @@ token="i3_yxQr4ypsKkcht4AnS" data=$(curl "https://git.xware-gmbh.de/api/graphql"
leon: namespace(fullPath: \"leon\") {
projects { nodes { name, httpUrlToRepo } }
}
}"
}"
}
GQL
)
)"
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")
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 -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

View file

@ -1,4 +1,4 @@
#!/bin/bash
#! /bin/sh
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"

View file

@ -1,7 +1,7 @@
#!/bin/dash
if [ -z "$1" ]; then
echo "usage: screenrecorder.sh <output-file-path>"
exit 1
fi
#! /bin/sh
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,25 +1,28 @@
#!/bin/bash
#! /bin/sh
to_file=0
fullscreen=0
for arg in "$@"; do
case $arg in
--tofile) to_file=1;;
--fullscreen) fullscreen=1;;
esac
done
to_file="0"
fullscreen="0"
case $arg in
--tofile)
to_file="1"
;;
--fullscreen)
fullscreen="1"
;;
esac
# Do not quote this, this is multiple flags
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"
echo "$file"
[ -z "$select_flag" ] && sleep 1
maim $select_flag --format png "$file"
echo "$file" | xclip -selection clipboard
echo "$file" | xclip -selection clipboard
else
[ -z "$select_flag" ] && sleep 1
maim $select_flag --format png /dev/stdout | xclip -selection clipboard -t image/png -i

View file

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

View file

@ -1,10 +1,10 @@
#!/bin/bash
#! /bin/sh
# NAME: dropshadow.sh
# VERSION:
# VERSION:
# AUTHOR: (c) 2013 Glutanimate
# DESCRIPTION: - adds transparent dropshadow to images (e.g. screenshots)
# - moves them to predefined screenshot folder
# FEATURES:
# FEATURES:
# DEPENDENCIES: imagemagick suite
#
# LICENSE: MIT license (http://opensource.org/licenses/MIT)
@ -12,8 +12,8 @@
# NOTICE: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
# OR OTHER DEALINGS IN THE SOFTWARE.
#
#
@ -21,11 +21,11 @@
SCREENSHOTFOLDER="$HOME/Pictures/Screenshots"
FILE="${1}"
FILENAME="${FILE##*/}"
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

View file

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

View file

@ -1,6 +1,7 @@
#!/bin/dash
if [ -z "$1" ]; then
echo "timer.sh <time>"
#! /bin/sh
[ -z "$1" ] && \
echo "timer.sh <time>" && \
exit 1
fi
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'
cd ~/coding/studium/swlab/backend_studez/ || exit
cd "$HOME/coding/studium/swlab/backend_studez/" || exit
#docker-compose stop
#docker-compose rm -f
docker-compose up -d
nohup ~/intelliJInstall/bin/idea.sh ~/coding/studium/swlab/backend_studez/studez_backend &
docker-compose up -d
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
cd ~/coding/studium/swlab/frontend_studez/studez_frontend/src || exit
kitty @ launch --keep-focus --type=tab --cwd "$HOME/coding/studium/swlab/frontend_studez/studez_frontend/" npm start
cd "$HOME/coding/studium/swlab/frontend_studez/studez_frontend/src" || exit
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 "