Move stuff around, remove personal functions and add more features to the weather segment

This commit is contained in:
Alex D. 2020-11-03 16:02:33 +01:00
parent 1a2d816528
commit e1ea071bcb
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
29 changed files with 8 additions and 85 deletions

5
.zshrc
View File

@ -1,7 +1,4 @@
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
source "${ZDOTDIR}/preferences.zsh"
source "${ZDOTDIR}/completions.zsh"
source "${ZDOTDIR}/bindings.zsh"
source "${ZDOTDIR}/custom.zsh"
source "${ZDOTDIR}/misc.zsh"

View File

@ -1,7 +0,0 @@
source "${ZDOTDIR}/custom/prependsudo.zsh"
source "${ZDOTDIR}/custom/aliases.zsh"
fpath+=("${ZDOTDIR}/custom/functions" "${ZDOTDIR}/custom/segments")
compdef _files mplay
function {prompt_c_{covid_19,docker_host,mpv,new_mail,todo,weather,newsboat,mumble,sfeed},cprompts:cache:async:{covid,weather,rss},get{gbooru,mangareader,nhentai},gitsubrepo,osutab,prettygitlog,paste,mplay,qff,recordscreen,sendirc}() {
autoload -X
}

View File

@ -1,2 +0,0 @@
alias ytdldown='youtube-dl --no-part --newline -ixcw -R infinite -f bestaudio/best --add-metadata --embed-thumbnail -o "/home/caskd/Media/Music/%(album)s/%(track_number)s - %(track)s.%(ext)s"'
alias ls='ls --color=auto'

View File

@ -1 +0,0 @@
ffmpeg -hwaccel vdpau -i $1 -c:v h264 -crf 30 -movflags +faststart $2

View File

@ -1 +0,0 @@
ffmpeg -ss $2 -to $3 -i $1 -r 60 -pix_fmt bgr8 -vf "mpdecimate,normalize,scale=480:-1:flags=spline,split[s0][s1];[s0]palettegen=stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -loop 0 $4

View File

@ -1,14 +0,0 @@
local -a urls
local -a fetch
local page=0
while [ ${page} -eq 0 ] || [ ${#fetch} -eq 100 ]; do
<<< "Fetching page $page"
fetch=($(curl -sZSGL "https://gelbooru.com/index.php?q=index&s=post&page=dapi&json=1&pid=$page&tags=${1}" | jq -r ".[].file_url"))
urls+=($fetch)
page=$(($page + 1))
done
if [[ $2 == "mpv" ]]; then
[ ${#urls} -gt 0 ] && mpv --loop $urls
else
[ ${#urls} -gt 0 ] && curl -RL\#C - --remote-name-all $urls
fi

View File

@ -1,14 +0,0 @@
local link=("" "$1")
local IFS=$'/'
local img
local data
while [[ ! -z $link ]]; do
data=$(curl -sS "http://www.mangareader.net/${link[2]}/${link[3]:-1}/${link[4]:-1}" | grep '<div id="imgholder">')
img=$(print $data | grep -oP '(?<=src=").*\.jpg(?=")')
if [[ ! -d "${link[3]:-1}/" ]]; then
mkdir "${link[3]:-1}/"
fi
curl -\#L "$img" -o "${link[3]:-1}/${link[4]:-1}.jpg"
link=($(print $data | grep -oP '(?<=\<a href=").*\/\d*(\/\d*)?(?=")'))
done

View File

@ -1,18 +0,0 @@
local pageinfo=$(print $(curl -sL $1 | grep -oP '(?<=window._gallery = JSON.parse\(").*(?="\);)') | jq '{"pages": .num_pages,"id": .media_id, "types": [.images.pages[].t], "title": .title.pretty}')
local media_id=$(print $pageinfo | jq -r '.id')
local types=($(print $pageinfo | jq -r '.types[]'))
local num_pages=$(print $pageinfo | jq '.pages')
local dir=$(print $pageinfo | jq -r '.title')
local urls=()
[ ! -z $2 ] && mkdir "$dir" && cd "$dir"
for i in {1..$num_pages}; do
local ctoi=$(($i - 1))
[[ ${types[$ctoi]} == p ]] && local type=png || local type=jpg
urls+=("https://i.nhentai.net/galleries/$media_id/$i.$type")
done
curl --retry 10 -\#L --remote-name-all ${urls}
for i in *; do
local sortname="$(printf "%.3i" "${i%%.*}").${i##*.}"
[ $sortname = $i ] || mv $i $sortname
done
[ ! -z $2 ] && cd ..

View File

@ -1 +0,0 @@
find * -maxdepth 1 -mindepth 1 -type d -name ".git" -exec sh -c '(DIR={}; DIR=${DIR%%.git} && cd $DIR && echo $DIR && git status -s)' \;

View File

@ -1,4 +0,0 @@
local REPLY
zsocket ~/.mpvsock 2>/dev/null || return
print -u $REPLY "loadfile $@"
exec {REPLY}>&-

View File

@ -1 +0,0 @@
xinput --set-float-prop 'UGTABLET 6 inch PenTablet Pen (0)' 'Coordinate Transformation Matrix' 3.5 0 -0.5 0 2.9 0 0 0 1

View File

@ -1 +0,0 @@
curl -F'file=@-' $@

View File

@ -1 +0,0 @@
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all

View File

@ -1,9 +0,0 @@
ffmpeg -y \
-f pulse -i 1 \
-vaapi_device /dev/dri/renderD128 \
-video_size 1920x1080 -framerate 60 \
-f x11grab -i :0+1080 \
-vf 'hwupload,scale_vaapi=format=nv12' \
-c:v hevc_vaapi -b:v 15M -qp 18 \
-c:a aac -b:a 64k -ar 24000 -ac 2 \
$1

View File

@ -1,2 +0,0 @@
([ -z $1 ] || [ -z $2 ] || [ -z $3 ]) && return
printf "PRIVMSG %s :%s\r\n" "$2" "${argv[3,-1]}" > ~/IRC/$1/global/in

View File

@ -4,9 +4,9 @@ icons=([c]='' [lc]='' [hc]='' [s]='🌢' [lr]='🌢' [hr]='' [sn]='
colors=([c]="yellow" [lc]="yellow" [hc]="cyan" [s]="yellow" [lr]="cyan" [hr]="blue" [t]="white" [h]="white" [sl]="blue" [sn]="white")
local REPLY
zstyle -s ':custom:prompts:weather' location REPLY
local result=$(curl -sL https://www.metaweather.com/api/location/${REPLY:-1339615}/ | jq -e '.consolidated_weather[0] | {"temp": .the_temp, "icon": .weather_state_abbr}')
local result=$(curl -sL https://www.metaweather.com/api/location/${REPLY:-1339615}/ | jq -e '.consolidated_weather[0] | {"temp": .the_temp, "hum": .humidity, "icon": .weather_state_abbr}')
if [ ! -z $result ]; then
local ico=$(print $result | jq -r '.icon')
typeset -g _cprompts_weather=($(( int(rint($(jq -r '.temp' <<< $result))) )) ${colors[$ico]:-white} ${icons[${ico:-X}]})
typeset -g _cprompts_weather=($(( int(rint($(jq -r '.temp' <<< $result))) )) ${colors[$ico]:-white} ${icons[${ico:-X}]} $(( int(rint($(jq -r '.hum' <<< $result))) )))
print ${_cprompts_weather} > $tmpfile
fi

View File

@ -8,4 +8,4 @@ if [ ${stats[1]:-0} -lt $(($epochtime[1]-3600)) ]; then
else
typeset -g _cprompts_weather=($(< $tmpfile))
fi
[ -v _cprompts_weather ] && p10k segment -b ${_cprompts_weather[2]:-white} -i ${_cprompts_weather[3]:-\?} -t "${_cprompts_weather[1]:-unknown}"
[ -v _cprompts_weather ] && p10k segment -b ${_cprompts_weather[2]:-white} -i ${_cprompts_weather[3]:-\?} -t "${_cprompts_weather[1]:-unknown}°C ${_cprompts_weather[4]:-unk}%%"

View File

@ -1,5 +1,3 @@
typeset -g HISTFILE=~/.histfile
typeset -g CACHEPATH=~/.cache
typeset -g HISTSIZE=1000
typeset -g SAVEHIST=1000
typeset -g ZLE_RPROMPT_INDENT=0
@ -33,6 +31,10 @@ fi
zstyle -s ':custom:preferences' prompt _cur_prompt
if [[ $_cur_prompt == "p9k" ]] && [[ -r "${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme" ]]; then
fpath+=("${ZDOTDIR}/powerlevel-config/segments")
function {prompt_c_{covid_19,docker_host,mpv,new_mail,todo,weather,newsboat,mumble,sfeed},cprompts:cache:async:{covid,weather,rss}}() {
autoload -X
}
source ${ZDOTDIR}/powerlevel-config/all.zsh
source ${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme
else