Update 2022-12-27 19:16 OpenBSD/amd64

This commit is contained in:
c0dev0id 2022-12-27 19:16:20 +01:00
parent 5905c2a1b2
commit 6a50e5d8bb
6 changed files with 143 additions and 41 deletions

View File

@ -1,46 +1,103 @@
#!/bin/sh
_imgpath="$(readlink -f "$1" || exit 2)"
_imgpath="$(readlink -f "${*}")"
_imgname="$(basename "$_imgpath")"
_imgnamenoext="${_imgname%%.*}"
cd $HOME/website/site/photos
edit_template() {
[ ! -f "$1" ] \
&& echo "<p></p>" > "$1"
vim "$1"
}
gallerydir="$((echo NEW; find * -mindepth 0 -maxdepth 0 -type d; ) | fzf)"
error_exit() {
echo "$1"
read
exit 1
}
if [ "$gallerydir" == "NEW" ]
if [ -z "${_imgpath}" ]
then
echo "Could not read image path: $1"
read
fi
_names="\
$(exiftool -q -q -p '$modifyDate' -p '$createDate' -p '$dateTimeOriginal' "${_imgpath}" | tr ':' '-' | tr ' ' '_')
$(basename "$(dirname "${_imgpath}")")
${_imgname%%.*}
_custom
$(date +"%Y-%m-%d_%H-%M-%S")"
_name="$( echo "$_names" \
| sort -u \
| fzf --prompt="Filename> " \
|| error_exit "fzf on name selection failed")"
if [ "${_name}" == "_custom" ]
then
echo "$_names"
echo -n "Filename (without extension): "
read -r _name
fi
[ -z "${_name}" ] \
&& error_exit "Filename not set"
cd "${HOME}/website/site/photos"
gallerydir="$((echo NEW; find * -mindepth 0 -maxdepth 0 -type d; ) \
| fzf --prompt "Directory> " \
|| error_exit "Directory not set after fzf")"
if [ "${gallerydir}" == "NEW" ]
then
echo -n "Add new gallery name ($(date +"%Y-%m-%d_")): "
read -r gallerydir
[ -z "$gallerydir" ] && exit 2
mkdir -p "$gallerydir"
[ -z "${gallerydir}" ] \
&& error_exit "New directory requested, but not set"
mkdir -p "${gallerydir}"
echo -n "Add gallery description [y/N]: "
read -r gallerydescr
case $gallerydescr in
[yY]) vim "${gallerydir}/index.txt"; ;;
case "${gallerydescr}" in
[yY]) edit_template "${gallerydir}/index.txt"; ;;
esac
fi
cp "$_imgpath" "$gallerydir/"
[ -z "${gallerydir}" ] \
&& error_exit "Directory not set"
_mime="$(file -ib "${_imgpath}")"
if [ "${_mime}" == "image/jpeg" ]
then
cp "${_imgpath}" "${gallerydir}/${_name}.jpg"
else
convert "${_imgpath}" "${gallerydir}/${_name}.jpg"
fi
jpegoptim -w 12 --all-progressive --strip-all "$gallerydir/${_name}.jpg"
echo -n "Add image description? [y/N]: "
read -r imagedescr
case $imagedescr in
[yY]) vim "${gallerydir}/${_imgnamenoext}.txt"; ;;
case "$imagedescr" in
[yY]) edit_template "${gallerydir}/${_name}.txt"; ;;
esac
echo -n "Regenerate Website? [y/N]: "
read -r regen
case $regen in
[yY]) cd ~/website && make remote; ;;
[yY]) cd ~/website && make; ;;
esac
echo
echo "https://stefanhagen.de/photos/$gallerydir/${_imgnamenoext}.html"
echo "https://stefanhagen.de/photos/${gallerydir}/${_name}.html"
echo
read

View File

@ -20,7 +20,7 @@ save_image() {
if [ -z "$SXIVDIR" ]
then
. $HOME/.bin/_config
SXIVDIR="$(find . -type d -maxdepth 1 | dmenu -p "Save" $DMENUOPTS)"
SXIVDIR="$(find * -maxdepth 0 -mindepth 0 -type d | dmenu -p "Save" $DMENUOPTS)"
export SXIVDIR;
fi
printf '%s\n' "Saving $1 to $SXIVDIR/"
@ -41,17 +41,17 @@ edit_image() {
printf "Trying %s.%s\n" "${base}" "${type}"
if [ -f "${base}.${type}" ]
then
rawtherapee "${base}.${type}"
break
rawtherapee "${base}.${type}" &
exit 0
fi
done
for type in tif TIF
for type in tif TIF jpg JPG jpeg JPEG png PNG
do
printf "Trying %s.%s\n" "${base}" "${type}"
if [ -f "${base}.${type}" ]
then
gimp "${base}.${type}"
break
gimp "${base}.${type}" &
exit 0
fi
done
}
@ -68,20 +68,36 @@ rotate_ccw() {
show_details() {
echo "$1"
exiftool "$1" | grep Date | tr ':' '-'
exiftool "$1" | grep Date | tr ':' '-' | sed -E 's/ ([^ ]*)$/_\1/' | cut -d"+" -f1
}
help() {
set +x
echo " x-Left - rotate image counter clockwise"
echo " x-Right - rotate image clockwise"
echo " x-c - copy image path to clipboard"
echo " x-d - delete image"
echo " x-e - find raw image and edit (cr2,orf,dng,tif)"
echo " x-h - show this help message"
echo " x-i - show image date information"
echo " x-p - print image path"
echo " x-s - save image (via dmenu directory selector)"
echo " x-x - upload to website"
set -x
}
while read file
do
case "$1" in
"e") edit_image "$file" ;;
"c") copy_to_clipboard "$file" ;;
"p") echo "$(readlink -f "$file")" ;;
"u") upload_to_paste "$file" ;;
"x") save_image "$file" ;;
"s") show_details "$file" ;;
"w") texec "website-add-image-to-gallery $file" ;;
"Right") rotate_cw "$file" ;;
"Left") rotate_ccw "$file" ;;
"Right") rotate_cw "$file" ;;
"c") copy_to_clipboard "$file" ;;
"d") rm -f "$file" ;;
"e") edit_image "$file" ;;
"h") help ;;
"i") show_details "$file" ;;
"p") echo "$(readlink -f "$file")" ;;
"s") save_image "$file" ;;
"x") texec "website-add-image-to-gallery \"$file\"" ;;
esac
done

View File

@ -33,6 +33,7 @@ stack_mark_max = ''
# Custom Quirks
quirk[IPMIView20-IPMIView20:IPMIView20-IPMIView20] = FLOAT + ANYWHERE
quirk[scratchpad] = FLOAT + ANYWHERE
quirk[Nsxiv:tabbed] = NOFOCUSONMAP + FOCUSPREV
# Window Manager Keys
keyboard_mapping = ~/.config/spectrwm/spectrwm_map.conf

3
.kshrc
View File

@ -21,6 +21,7 @@ PATH=\
JAVA_HOME=/usr/local/jdk-11/bin
PATH=${PATH}:${JAVA_HOME}
PATH=${PATH}:/opt/zodiac/bin
PATH=${PATH}:/opt/stagit/bin
export PATH
@ -76,7 +77,7 @@ export EDITOR VISUAL BROWSER TUIR_BROWSER PAGER
NNN_OPTS="cErxAJBR"
NNN_OPENER="nnn.sh"
NNN_FIFO=/tmp/nnn.fifo
NNN_PLUG='o:-!mpv "$nnn";x:-!sh -x "$nnn";i:imgview;p:-!pdfarranger "$nnn" > /dev/null 2>&1 &'
NNN_PLUG='o:-!mpv "$nnn";x:!imagesort;p:!pdfarranger "$nnn" > /dev/null 2>&1 &'
NNN_ARCHIVE="\\.(7z|bz2|gz|tar|tgz|zip)$"
NNN_SSHFS='doas sshfs -d -o reconnect -o uid=1000 -o gid=1000'
NNN_COLORS='#0a1b2c3d;1234'

25
.reminders/uugrn.rem Normal file
View File

@ -0,0 +1,25 @@
## 2022
REM 7 Oct 2022 MSG UUGRN Fixme
OMIT 4 Nov 2022 # Dezernat 16 nicht verfügbar
REM 11 Nov 2022 MSG UUGRN Fixme (statt 4.Nov)
REM 2 Dec 2022 MSG UUGRN Fixme
## 2023
OMIT 6 Jan 2023 # Dezernat 16 nicht verfügbar + Feiertag
REM 13 Jan 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme (statt 6.Jan)
REM 3 Feb 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme
REM 3 Mar 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme
OMIT 7 Apr 2023 # Dezernat 16 nicht verfügbar
REM 14 Apr 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme (statt 7.Apr)
REM 5 May 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme
REM 2 Jun 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme
REM 7 Jul 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme
REM 4 Aug 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme
REM 1 Sep 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme
REM 6 Oct 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme
REM 3 Nov 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme
REM 1 Dec 2023 AT 18:00 DURATION 4:00 MSG UUGRN Fixme
# GENERAL RULE
REM Third Monday AT 18:00 DURATION 4:00 SKIP MSG UUGRN Stammtisch
REM First Friday AT 19:00 DURATION 5:00 SKIP MSG UUGRN FIXME

View File

@ -24,7 +24,6 @@ set spelllang=de,en
set re=1
let mapleader = ","
set formatprg=par\ -w80qie
" * and # are only highlighting
" n searches in the direction of * or #
@ -52,6 +51,8 @@ let &softtabstop=&shiftwidth
set expandtab
set smarttab
set textwidth=72
set colorcolumn=72
set formatprg=par\ -w72q
set list
set listchars=tab:»·,trail:•
@ -109,13 +110,12 @@ set t_ut=
set background=dark
let g:is_posix=1
" HIGHLIGHT SPECIAL WORDS
match ErrorMsg '\(TODO:\|FIXME\|XXX\|workaround\|WTF\|: error:.*\|\s\+$\| \+\ze\t\)'
" MY THEME
hi TabLine ctermbg=234 ctermfg=240 cterm=NONE
hi TabLineFill ctermbg=234 ctermfg=240 cterm=NONE
hi TabLineSel ctermbg=234 ctermfg=249 cterm=NONE
hi ColorColumn ctermbg=232 ctermfg=249 cterm=NONE
hi Comment ctermbg=NONE ctermfg=249 cterm=italic
hi Constant ctermbg=NONE ctermfg=251 cterm=italic
hi CursorLine ctermbg=NONE ctermfg=NONE cterm=NONE
@ -129,7 +129,7 @@ hi Identifier ctermbg=NONE ctermfg=NONE cterm=NONE
hi Ignore ctermbg=NONE ctermfg=NONE cterm=NONE
hi IncSearch ctermbg=NONE ctermfg=251 cterm=inverse
hi LineNr ctermbg=NONE ctermfg=240 cterm=NONE
hi MatchParen ctermbg=NONE ctermfg=251 cterm=bold
hi MatchParen ctermbg=NONE ctermfg=202 cterm=bold
hi NonText ctermbg=NONE ctermfg=NONE cterm=NONE
hi Normal ctermbg=NONE ctermfg=NONE cterm=NONE
hi Pmenu ctermbg=NONE ctermfg=251 cterm=inverse
@ -140,10 +140,13 @@ hi SignColumn ctermbg=NONE ctermfg=NONE cterm=NONE
hi Special ctermbg=NONE ctermfg=NONE cterm=NONE
hi SpecialComment ctermbg=NONE ctermfg=NONE cterm=NONE
hi SpecialKey ctermbg=NONE ctermfg=239 cterm=NONE
hi Statement ctermbg=NONE ctermfg=NONE cterm=NONE
hi Statement ctermbg=NONE ctermfg=251 cterm=NONE
hi Statement ctermbg=NONE ctermfg=NONE cterm=NONE
hi String ctermbg=NONE ctermfg=251 cterm=NONE
hi TODO ctermbg=NONE ctermfg=246 cterm=italic
hi TabLine ctermbg=234 ctermfg=240 cterm=NONE
hi TabLineFill ctermbg=234 ctermfg=240 cterm=NONE
hi TabLineSel ctermbg=234 ctermfg=249 cterm=NONE
hi Title ctermbg=NONE ctermfg=246 cterm=bold
hi Type ctermbg=NONE ctermfg=NONE cterm=NONE
hi Underlined ctermbg=NONE ctermfg=251 cterm=underline
@ -152,9 +155,9 @@ hi WarningMsg ctermbg=NONE ctermfg=NONE cterm=NONE
hi Wildmenu ctermbg=NONE ctermfg=NONE cterm=NONE
" VIMDIFF COLORS
hi DiffAdd ctermbg=22 ctermfg=NONE cterm=NONE
hi DiffDelete ctermbg=234 ctermfg=NONE cterm=NONE
hi DiffChange ctermbg=234 ctermfg=NONE cterm=NONE
hi DiffAdd ctermbg=22 ctermfg=NONE cterm=NONE
hi DiffDelete ctermbg=234 ctermfg=NONE cterm=NONE
hi DiffChange ctermbg=234 ctermfg=NONE cterm=NONE
hi DiffText ctermbg=NONE ctermfg=NONE cterm=NONE
" SPLIT AND FOLD COLORS
@ -224,9 +227,8 @@ xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
" Compile Stuff
nnoremap mw :!cd /home/sdk/website && make<CR>
nnoremap mm :call MyMake()<CR>
nnoremap mr :!%:p:r<CR>
nnoremap mr :!clear && %:p:r<CR>
function MyMake()
:silent !clear
if filereadable("Makefile")