Update 2024-02-14 07:51 OpenBSD/amd64-x13

This commit is contained in:
c0dev0id
2024-02-14 07:54:31 +01:00
parent b55e6a3616
commit 9624895938
373 changed files with 19074 additions and 3045 deletions

4
.bin/OLD/12color.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
fgbg=90
printf "\\e[${fgbg};5;%sm %3s \\e[0m" $fgbg

22
.bin/OLD/16colors.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/local/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#Background
for clbg in {40..47} {100..107} 49 ; do
#Foreground
for clfg in {30..37} {90..97} 39 ; do
#Formatting
for attr in 0 1 2 4 5 7 ; do
#Print the result
echo -en "\e[${attr};${clbg};${clfg}m ^[${attr};${clbg};${clfg}m \e[0m"
done
echo #Newline
done
done
exit 0

10
.bin/OLD/256color.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
for fgbg in 38 48; do
while [ "${color:=0}" -le 255 ]; do
printf "\\e[${fgbg};5;%sm %3s \\e[0m" $color $color
[ $(((color + 1) % 6)) = 4 ] && printf '\n'
color=$((color+1))
done
printf '\n' && unset color
done
exit 0

View File

@@ -0,0 +1,10 @@
#!/bin/sh
#
DATE="$(date +%F_%H-%M-%S)"
SRC="/"
DST="sdk@192.168.1.20:/tank/BACKUP/"
ROPTS="--archive --human-readable --progress --size-only"
rsync --archive --human-readable --progress --size-only --link-dest $PWD/current source "$PWD/destination"

76
.bin/OLD/KAPUTT/ccc-streams.sh Executable file
View File

@@ -0,0 +1,76 @@
#!/bin/sh
sformat="webm"
squality="sd"
translated="native"
mediaplayer="mpv"
usage() {
printf "Available rooms:\n" >&2
printf " a|ada|1\n" >&2
printf " b|borg|2\n" >&2
printf " c|clarke|3\n" >&2
printf " d|dijkstra|4\n" >&2
printf " e|elize|5\n" >&2
printf " chaoswest|150\n" >&2
printf " openinfrastructure|oio\n" >&2
printf " wiki|151\n\n" >&2
exit 1
}
[ -z $1 ] && usage;
hall="$1"
case "$hall" in
1|2|3|4|5|150|151|oio)
;;
a|ada)
hall="1"
;;
b|borg)
hall="2"
;;
c|clarke)
hall="3"
;;
d|dijkstra)
hall="4"
;;
e|eliza)
hall="5"
;;
chaoswest)
hall="150"
;;
open*)
hall="oio"
;;
wiki*)
hall="151"
;;
*)
usage;
;;
esac
webmbase="http://cdn.c3voc.de/s%s_%s_%s.webm"
hlsbase="http://cdn.c3voc.de/hls/s%s_%s_%s.m3u8"
audiobase="http://cdn.c3voc.de/s%s_%s.%s"
slink=""
case "$sformat" in
webm)
slink="$(printf "$webmbase" "${hall}" "${translated}" "${squality}")"
;;
m3u8|hls)
slink="$(printf "$hlsbase" "${hall}" "${translated}" "${squality}")"
;;
*)
printf "Only the stream formats »webm« and »hls« are available.\n" >&2
exit 1
;;
esac
$mediaplayer "$slink"

2
.bin/OLD/KAPUTT/chrome Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
/usr/local/bin/chrome --enable-unveil --enable-features=WebUIDarkMode --force-dark-mode $@

View File

@@ -0,0 +1,35 @@
#!/bin/sh
# essential
pkg_add rsync wget curl lftp mc ranger vim speedtest-cli autocutsel git ectags
# dwm
pkg_add dmenu jq scrot slop
# pass
pkg_add password-store gnupg pinentry
doas ln -s /usr/local/bin/pinentry /usr/bin/pinentry
# mutt
pkg_add mutt w3m urlview msmtp offlineimap mu par
# irssi
pkg_add irssi
# luakit
pkg_add luafs luajit gmake webkitgtk4
# multimedia
pkg_add ffmpeg ffmpegthumbnailer youtube-dl ImageMagick
# tor
pkg_add tor torsocks
# X11
pkg_add mupdf zathura zathura-pdf-mupdf sxiv seafile-client pidgin telegram-purple
# other
pkg_add nload htop nmap ncdu tig xosd sshfs-fuse
# BIG ones
pkg_add firefox libreoffice gimp smtube fnaify vimb

383
.bin/OLD/KAPUTT/openup Executable file
View File

@@ -0,0 +1,383 @@
#!/bin/sh
#
# Copyright (c) 2013 - 2017 M:tier Ltd.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# Author: Antoine Jacoutot <antoine@mtier.org>
# Maintainer: M:Tier Ltd. <info@mtier.org>
# ChangeLog
# https://gitlab.com/mtier/openup/commits/master
########################################################################
### DO NOT EDIT THIS FILE!!! ###
### User defined variables: overrides are read from /etc/openup.conf ###
########################################################################
# URL to the latest openup version
OPENUP_URL="https://stable.mtier.org/openup"
# signify(1) public key
PKG_PUBKEY_URL="https://stable.mtier.org/mtier-$(uname -r | tr -d '.')-pkg.pub"
# PKG_PATH for currently running OpenBSD release
PKG_PATH_MAIN="https://ftp.fr.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(arch -s)"
# ERRATA_PATH
ERRATA_PATH="https://ftp.fr.openbsd.org/pub/OpenBSD/patches/$(uname -r)/common"
# PKG_PATH for the corresponding release stable service
PKG_PATH_UPDATE="https://stable.mtier.org/updates/$(uname -r)/$(arch -s)"
# PKG_PATH addition for the corresponding LTS release stable service
#PKG_PATH_UPDATE_LTS="https://user%domain.tld:password@stable.mtier.org/updates-lts/$(uname -r)/$(arch -s)"
# URL to the latest vuxml (vulnerabilities database)
VUXML_URL="https://stable.mtier.org/vuxml/$(uname -r | tr -d '.').xml"
# fetch command (must behave like "ftp -o"); e.g. "wget -qO"
FETCH="ftp -MVo"
# exclusion list: pkg names without version/flavor, separated by space
EXCLUDE_PKG=""
########################################################################
### End of user defined variables ###
########################################################################
usage() {
echo
echo "Usage: ${0##*/} [-K][-Se|c]" >&2
echo
echo "Options:"
echo " -K do not check for kernel binpatches (when running non GENERIC)"
echo " -N do not check for syspatches"
echo " -S ignore binpatch/package signatures"
echo " -c check/cron mode, report only (cannot be used with -S)"
echo " -e echo the PKG_PATH that ${0##*/} would use"
echo
exit 1
}
pr_err() {
echo "!!! ${@}"
}
bye_bye() {
rm -rf ${_TMPDIR} ${_PID}
exit 1
}
pr() {
if [ -z "${checkrun}" ]; then
echo "===> ${@}"
fi
}
get_key() {
[ -r /etc/signify/mtier-${_REL_INT}-pkg.pub ] && return
pr "Downloading and installing public key"
${FETCH} ${_TMPKEY} ${PKG_PUBKEY_URL} || bye_bye
install -m0644 ${_TMPKEY} /etc/signify/mtier-${_REL_INT}-pkg.pub || bye_bye
}
show_env() {
echo PKG_PATH=${PKG_PATH_UPDATE_LTS}:${PKG_PATH_UPDATE}:${PKG_PATH_MAIN}
exit 0
}
check_openupd() {
local _U
pr "Checking for openup update"
_U="${FETCH} - ${OPENUP_URL} | awk -F '=' '/^_OPENUP_VERSION/ { print \$2 }'"
_U=$(eval $_U)
if [ -z "${_U}" ]; then
pr_err "Cannot retrieve ${OPENUP_URL}"
pr_err "Please verify your Internet connection, proxy settings and firewall."
bye_bye
fi
if [ "${_OPENUP_VERSION}" -lt "${_U}" ]; then
pr_err "New openup release (version ${_U}) available; please update with:"
pr_err "${FETCH} $(readlink -f $0) ${OPENUP_URL}"
bye_bye
fi
}
# check that we have no installed binpatches from a previous release and
# if so remove the entries manually (we don't want pkg_delete to
# modify nor error out on installed files from newer release/binpatch)
rm_old_bp() {
local _bp
local _BPDB=$(ls -d /var/db/binpatch/{binpatch-,}[0-9]* 2>/dev/null |grep -v ${_REL})
local _BPPKG=$(ls -d /var/db/pkg/binpatch* 2>/dev/null |grep -v binpatch${_REL_INT})
if [ -n "${_BPPKG}" -o -n "${_BPDB}" ]; then
pr "Removing old release binpatch entries"
fi
for _bp in ${_BPPKG} ${_BPDB}; do
rm -rf ${_bp}
done
}
update_syspatches() {
pr "Installing/updating syspatches"
syspatch
if [ $? -gt 0 ]; then
pr_err "syspatch failed; please run syspatch manually"
bye_bye
fi
}
update_binpatches() {
local _BP _b _e
# binpatches can only be found in PKG_PATH_UPDATE{,_LTS) and we
# want to make sure we search in all paths and don't stop at the
# first match we find
for i in ${PKG_PATH_UPDATE_LTS} ${PKG_PATH_UPDATE}; do
_BP="$(pkg_info -Q binpatch${_REL_INT}-${_ARCH} | sed 's/.[^-]*$//' | sort -u)${_BP:+ ${_BP}}"
done
if [ -n "${_BP}" ]; then
for _e in ${EXCLUDE_PKG}; do
set -A _BP -- ${_BP}
_BP="$(for _b in ${_BP[@]}; do echo ${_b} | grep -v "^${_e}$"; done)"
done
_BP=$(echo "${_BP}" | tr '\n' ' ')
pr "Installing/updating binpatch(es)"
pkg_add ${pkgopt} ${_BP} || bye_bye
fi
}
update_pkg() {
local _PKG _e _p
_PKG=$(pkg_info -q | grep -v binpatch${_REL_INT}-${_ARCH})
if [ -n "${_PKG}" ]; then
for _e in ${EXCLUDE_PKG}; do
set -A _PKG -- ${_PKG}
_PKG="$(for _p in ${_PKG[@]}; do echo ${_p} | grep -v "^${_e}-.*"; done)"
done
_PKG=$(echo "${_PKG}" | tr '\n' ' ')
pr "Updating package(s)"
pkg_add -quz ${pkgopt} ${_PKG} || bye_bye
fi
}
# this only outputs the missing syspatches on the system
check_syspatches() {
_SYSPATCHES=$(syspatch -c)
for _p in ${_SYSPATCHES}; do
${FETCH} ${_TMPERRATA} ${ERRATA_PATH}/${_p}.patch.sig
[ -e ${_TMPERRATA} ] || continue
echo "--- ${_p} ---"
echo -n "Available errata: "
awk '/OpenBSD/{f=1;next} /Apply/{f=0;next} f' ${_TMPERRATA} | grep -ve '^$'
done
}
# this only outputs the most recent vulnerability for each matching pkg
check_vuxml() {
local _BP_MATCH _OUTDATED _PKG_MATCH _b _e _p
${FETCH} ${_TMPVUXML} ${VUXML_URL} || bye_bye
perl -pi -e 's,\$ARCH,'"${_ARCH}"',g' ${_TMPVUXML}
if [ "${_REL_INT}" -lt 61 ]; then
_BP_MATCH="$(grep binpatch ${_TMPVUXML} | sed -e 's,<name>,,g;s,</name>,,g;s,\$ARCH,'"${_ARCH}"',g' | sort -u)"
for _e in ${EXCLUDE_PKG}; do
set -A _BP_MATCH -- ${_BP_MATCH}
_BP_MATCH="$(for _b in ${_BP_MATCH[@]}; do echo ${_b} | grep -v "^${_e}$"; done)"
done
fi
_PKG_MATCH=$(pkg_info -q | grep -v binpatch${_REL_INT}-${_ARCH})
for _e in ${EXCLUDE_PKG}; do
set -A _PKG_MATCH -- ${_PKG_MATCH}
_PKG_MATCH="$(for _p in ${_PKG_MATCH[@]}; do echo ${_p} | grep -v "^${_e}-.*"; done)"
done
if [ "${_REL_INT}" -lt 61 ]; then
# set to "quirks" if empty to prevent running pkg_add against an empty pkg list
_OUTDATED=$((pkg_add -Iqn -Dnosig -Dunsigned ${_BP_MATCH:=quirks}; pkg_add -Iqnuz -Dnosig -Dunsigned ${_PKG_MATCH:=quirks}) 2>&1 | \
grep '^NOT CHECKING DIGITAL SIGNATURE FOR ' | \
sed -e 's,^NOT CHECKING DIGITAL SIGNATURE FOR ,,g' | \
grep -v '^quirks-' | \
perl -ne '/^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/ && print "$1\n"' | \
sort -u)
else
# set to "quirks" if empty to prevent running pkg_add against an empty pkg list
_OUTDATED=$((pkg_add -Inuvz -Dnosig -Dunsigned ${_PKG_MATCH:=quirks}) 2>&1 | \
grep '^Adding.*(pretending)' | sort -u | sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \
grep -v '^quirks-' | \
perl -ne '/^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/ && print "$1\n"' | \
sort -u)
fi
for p in ${_OUTDATED}
do
echo "--- ${p} ---\n"
echo "Available update(s): "
# XXX how do we print only the 1st matching range in awk?
awk "/<name>${p}<\/name>/,/<\/vuln>/" ${_TMPVUXML} | \
sed '/<\/vuln>/,$d' | \
sed -n -e 's/.*<range><lt>\(.*\)<\/lt><\/range>.*/\1/p' \
-e 's/.*<p>\(.*\)<\/p>.*/\1/p' | uniq | \
while read l; do echo -n "${l} "; done
echo "\n"
done | fmt | sed '/^$/d'
}
do_i_need_to_reboot() {
# XXX hardcoded PKG_DBDIR
local osversion=$(sysctl -n kern.osversion)
local kern_version=$(sysctl -n kern.version | head -1)
local booted_version=$(what -s /bsd | tail -1 | tr -d '\t')
local booted_time=$(sysctl -n kern.boottime)
local kern_time=$(stat -qf "%Um" /bsd)
local warn=0
# Check /bsd.booted first if available due to kernel relinking
if [ -e /bsd.booted ]; then
[ X"${kern_version}" != X"${booted_version}" ] && warn=1
else
[ "${booted_time}" -lt "${kern_time}" ] && warn=1
fi
if [ ${warn} -gt 0 ]; then
pr_err
pr_err "System must be rebooted after the last kernel update"
pr_err
fi
}
patch_syspatch() {
pr_err
pr_err "Patching syspatch(8) to use syspatches signed by MTier."
pr_err
cp /usr/sbin/syspatch /usr/sbin/syspatch.pre-mtier
sed -i \
"s,openbsd-\${_OSrev}-syspatch.pub,mtier-\${_OSrev}-pkg.pub,g; \
s,/etc/installurl,/etc/installurl-mtier,g" \
/usr/sbin/syspatch
[ -e /etc/installurl-mtier ] || echo https://stable.mtier.org > /etc/installurl-mtier
}
trap "bye_bye" 1 2 3 13 15
if [ -f /etc/openup.conf ]; then
if [ $(stat -f "%SMp%SLp" /etc/openup.conf) != "------" ]; then
pr_err "Unsecure permissions on /etc/openup.conf; please run:"
pr_err "chmod 0600 /etc/openup.conf"
exit 1
fi
. /etc/openup.conf
fi
# regex taken from fw_update(1)
set -A _REL -- $(sysctl -n kern.version | sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q')
_REL_INT="$(echo ${_REL[0]} | tr -d '.')"
_OPENUP_MINREL=60
_OPENUP_VERSION=33
if [ -n "${_REL[1]}" -a "${_REL[1]}" != "-stable" ]; then _badrel=1; fi
if [ "${_REL_INT}" -lt "${_OPENUP_MINREL}" ]; then _badrel=1; fi
if [ -n "${_badrel}" ]; then
pr_err "${_REL[0]}${_REL[1]} is not a supported release"
exit 1
fi
while getopts 'KNSce' arg; do
case ${arg} in
K) if [ "${_REL_INT}" -lt 61 ]; then nokrn=1; fi ;;
N) nosyspatch=1 ;;
S) nosig=1; pkgopt="${pkgopt} -Dnosig -Dunsigned" ;;
c) checkrun=1 ;;
e) showenv=1 ;;
*) usage ;;
esac
done
[ $# = $(($OPTIND-1)) ] || usage
[ -n "${showenv}" ] && show_env
if [ "$(id -u)" -ne 0 ]; then
pr_err "Need root privileges to run this script"
usage
fi
[ -n "${checkrun}" -a -n "${nosig}" -a -n "${showenv}" ] && usage
_ARCH=$(arch -s)
_PID="/var/run/${0##*/}.pid"
_TMP="${TMPDIR:=/tmp}"
_TMPDIR=$(mktemp -dp ${_TMP} .openup-XXXXXXXXXX) || exit 1
_TMPKEY="${_TMPDIR}/key"
_TMPVUXML="${_TMPDIR}/vuxml"
_TMPERRATA="${_TMPDIR}/errata"
export PKG_PATH=${PKG_PATH_UPDATE_LTS}:${PKG_PATH_UPDATE}:${PKG_PATH_MAIN}
if [ -f ${_PID} ]; then
pr_err "openup is already running ($(cat ${_PID})):"
pr_err "${_PID}"
exit 1
fi
echo $$ >${_PID}
if [ -n "${nokrn}" ]; then
EXCLUDE_PKG="binpatch${_REL_INT}-${_ARCH}-kernel ${EXCLUDE_PKG}"
fi
if [ -n "${EXCLUDE_PKG}" ]; then
pr "Excluded package(s)/binpatch(es): ${EXCLUDE_PKG}"
fi
check_openupd
if [ -z "${nosyspatch}" -a -e /usr/sbin/syspatch ]; then
_sum=$(sha256 -q /usr/sbin/syspatch)
case "${_sum}"
in
# 6.1 syspatch
b8b9c4bec128884498b5c3e77a350f42079f7987ef862a1ec452f489403dfbe6)
patch_syspatch
;;
esac
fi
if [ "${checkrun}" ]; then
if [ "${_REL_INT}" -ge 61 -a -z "${nosyspatch}" ]; then
check_syspatches
fi
check_vuxml
else
[ -z "${nosig}" ] && get_key
rm_old_bp
if [ "${_REL_INT}" -lt 61 -a -z "${nosyspatch}" ]; then
update_binpatches
else
[ -z "${nosyspatch}" ] && update_syspatches
fi
update_pkg
fi
do_i_need_to_reboot
rm -rf ${_TMPDIR}
rm ${_PID}

2
.bin/OLD/KAPUTT/osd_pipe.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
osd_cat -l1 -p top -o 1 -A right -O 1 -s 1 -o 40 -w -d4 -i 20 -c "#eeeeee" -f "-xos4-terminus-medium-r-normal--16-160-72-72-c-80-iso8859-15" -

15
.bin/OLD/KAPUTT/rec_encode Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
_vidfile="/home/sdk/work/rec-screen.mkv"
_micfile="/home/sdk/work/rec-mic-clean.wav"
_outfile="${_vidfile%%.*}-$(date "+%Y%m%d_%H%M%S").mp4"
ffmpeg -y -i $_vidfile \
-i $_micfile \
-c:v libx265 \
-c:a aac -shortest \
-crf 21 -s 1920x1080 \
-preset medium -movflags faststart \
-threads $(sysctl -n hw.ncpuonline) \
$_outfile \
&& echo "Done encoding $(readlink -f $_outfile)"

View File

@@ -0,0 +1,13 @@
#!/bin/sh
_vidfile="/home/sdk/work/rec-screen.mkv"
_outfile="${_vidfile%%.*}-$(date "+%Y%m%d_%H%M%S").mp4"
ffmpeg -y -i $_vidfile \
-c:v libx265 \
-c:a aac -shortest \
-crf 21 -s 1920x1080 \
-preset medium -movflags faststart \
-threads $(sysctl -n hw.ncpuonline) \
$_outfile \
&& echo "Done encoding $(readlink -f $_outfile)"

79
.bin/OLD/KAPUTT/rec_scr Executable file
View File

@@ -0,0 +1,79 @@
#!/bin/sh
screen=0
microphone=0
system_audio=0
select _sel in \
"Record screen" \
"Record microphone" \
"Record system audio" \
"Start recording" \
"Quit"
do
case "$_sel" in
"Record screen") screen=1; ;;
"Record microphone") microphone=1; ;;
"Record system audio") system_audio=1; ;;
"Start recording") break; ;;
"Quit") exit 0; ;;
esac
[ screen -eq 1 ] && echo "Screen recording: enabled" \
|| echo "Screen recodding: disabled"
[ microphone -eq 1 ] && echo "Microphone recording: enabled" \
|| echo "Microphone recodding: disabled"
done
clear
set -x
AUDIOMONDEVICE=snd/0.mon
AUDIOPLAYDEVICE=snd/0.default
AUDIORECDEVICE=snd/0.rec
AUDIOMONPID=X
AUDIORECPID=X
trap rec_stop 0 1 2 3 6
rec_stop() {
kill $AUDIORECPID $AUDIOMONPID
}
rec_mon() {
aucat -f $AUDIOMONDEVICE -o $HOME/work/rec-mon.wav &
AUDIOMONPID=$!
}
rec_mic() {
aucat -o $HOME/work/rec-mic.wav &
AUDIORECPID=$!
}
rec_screen() {
echo 'Press q to stop.'
ffmpeg -y -loglevel warning -hide_banner \
-fflags genpts \
-flags low_delay \
-thread_queue_size 256 \
-framerate 30 \
-f x11grab \
-probesize 16M \
-i :0.0 \
-c:v libx264rgb \
-crf 0 \
-qp 0 -framerate 30 \
-sws_flags neighbor \
-preset ultrafast \
-tune zerolatency \
$HOME/work/rec-screen.mkv
}
rec_mon
rec_mic
rec_screen
rec_stop
shotcut --noupgrade --fullscreen --clear-recent $HOME/work/rec-screen.mkv $HOME/work/rec-*.wav

83
.bin/OLD/KAPUTT/rec_screen Executable file
View File

@@ -0,0 +1,83 @@
#!/bin/sh
audio() {
# set mixer controls
print configuring microphone
mixerctl -q record.adc-0:1_source=mic2
mixerctl -q record.adc-2:3_source=mic2
mixerctl -q inputs.mix_source=mic2
}
webcam() {
printf 'start webcam\n'
doas mpv --quiet \
--panscan=1 \
--framedrop=vo \
--ontop av://v4l2:/dev/video0 \
--profile=low-latency \
--untimed \
--vf=hflip \
--geometry=220x180 2>&1 > /dev/null &
print move the picture to the right place and press any key
read
}
capture() {
printf 'starting recording... press q to stop\n'
RES=$(xwininfo -root | grep 'geometry' | awk '{print $2;}' |cut -d"+" -f1)
ffmpeg -y -loglevel warning \
-thread_queue_size 256 \
-probesize 10000000 \
-hide_banner \
-f sndio \
-i default \
-c:a flac \
-f x11grab \
-s $RES \
-i :0.0 \
-r 25 \
-c:v libx265 \
-crf 0 \
-qp 0 \
-preset ultrafast \
-g 50 \
-keyint_min 25 \
$HOME/work/rec_screen.mkv
}
encode() {
printf 'encoding video\n'
ffmpeg -y \
-i $HOME/work/rec_screen.mkv \
-c:v libx265 \
-crf 21 \
-s 1920x1080 \
-preset medium \
$HOME/work/rec_screen.mp4
}
printf '
(1) desktop only (works on linux)
(2) desktop + audio
(3) desktop + webcam + audio
'
printf ": "
read sel
case $sel in
1) capture;
encode;
;;
2) audio;
capture;
encode;
;;
3) audio;
webcam;
capture;
encode;
;;
esac

71
.bin/OLD/KAPUTT/recscr Executable file
View File

@@ -0,0 +1,71 @@
#!/bin/sh -xe
clear
AUDIOPLAYDEVICE=snd/0.default
AUDIORECDEVICE=snd/0.rec
AUDIOMONDEVICE=snd/0.mon
AUDIOMONPID=X
AUDIORECPID=X
trap rec_stop 1 2 3 6
rec_stop() {
kill $AUDIORECPID $AUDIOMONPID
}
rec_mon() {
aucat -f $AUDIOMONDEVICE -o $HOME/work/rec-mon.wav &
AUDIOMONPID=$!
}
rec_mic() {
aucat -j on -c 0:0 -o $HOME/work/rec-mic.wav &
AUDIORECPID=$!
}
rec_screen() {
echo 'Press q to stop.'
#ffmpeg -y \
# -loglevel warning \
# -hide_banner \
# -fflags genpts \
# -flags low_delay \
# -thread_queue_size 256 \
# -framerate 30 \
# -f x11grab \
# -probesize 16M \
# -i :0.0 \
# -c:v libx264rgb \
# -crf 0 \
# -qp 0 -framerate 30 \
# -sws_flags neighbor \
# -preset ultrafast \
# -tune zerolatency \
# $HOME/work/rec-screen.mkv
ffmpeg -y -loglevel warning -hide_banner \
-f x11grab -i :0.0 -c:v libx264rgb -crf 0 -qp 0 -framerate 30 -sws_flags neighbor -preset ultrafast -tune zerolatency $HOME/work/rec-screen.mkv \
-f sndio -i $AUDIORECDEVICE -c:a copy $HOME/work/rec-mic.wav \
-f sndio -i $AUDIOMONDEVICE -c:a copy $HOME/work/rec-mon.wav
}
#rec_mon
#rec_mic
rec_screen
#rec_stop
sleep 0.5
sox $HOME/work/rec-mic.wav -n trim 0 5 noiseprof \
| sox $HOME/work/rec-mic.wav $HOME/work/rec-mic-clean.wav \
noisered - 0.2 bass 5 contrast
#sox $HOME/work/rec-mic.wav $HOME/work/rec-mic-clean.wav bass 5 contrast
printf "[A]utoencode or [S]hotcut: "
read S
case $S in
[aA]) rec_encode; ;;
[sS]) shotcut --noupgrade --fullscreen --clear-recent $HOME/work/rec-screen.mkv $HOME/work/rec-*.wav; ;;
*) ;;
esac

2
.bin/OLD/KAPUTT/screen-make Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
ssh ld7078 "screen -S make -p 0 -X stuff \"./mymake.sh -p krn/ms prg;`echo '\015'`\""

4
.bin/OLD/KAPUTT/sdedit Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=gasp -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dawt.useSystemAAFontSettings=on'
export _JAVA_AWT_WM_NONREPARENTING=1
java -jar $HOME/.bin/sdedit-*.jar

BIN
.bin/OLD/KAPUTT/sdedit-4.2.1.jar Executable file

Binary file not shown.

2
.bin/OLD/KAPUTT/select_audio Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh

View File

@@ -0,0 +1,15 @@
#!/bin/sh
while true;
do
FILES=$(ls -1 | grep -v shotwell | grep -vi xmp | grep -vi jpg | wc -l | awk '{ print $1 }')
THUMBS=$(ls -1 | grep shotwell | grep -vi "xmp\|jpg\|jpeg" | wc -l | awk '{ print $1 }')
OUT="T: $THUMBS | F: $FILES"
printf "$OUT\n"
if [ "$FILES" == "$THUMBS" ];
then notify-send "Shotwell Import Finished: ${PWD##*/} $OUT"
printf "${PWD##*/}" | xclip -r
exit 0
fi
sleep 5
done

28
.bin/OLD/KAPUTT/subfzf Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
subsonic() {
subsonic-cli -c /home/sdk/.subsonic-cli.conf $@
}
next=1
offset=0
until [ $next -eq 0 ]
do
_someAlbums=$(subsonic \
-p type alphabeticalByArtist \
-p size 500 -p offset $offset getAlbumList2 \
| jq .albumList2.album[])
offset=$(( offset + 500 ))
_fullAlbums="\
$_fullAlbums
$_someAlbums
"
if [ -z "$_someAlbums" ]
then
next=0
fi
done
echo $_fullAlbums | jq

View File

@@ -0,0 +1,3 @@
#!/bin/sh
doas curl "https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling/hosts" -o /etc/hosts
#doas curl "https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-social/hosts" -o /etc/hosts

6
.bin/OLD/KAPUTT/vidoas Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/ksh
TMP=$(mktemp)
cp /etc/doas.conf $TMP
$EDITOR $TMP
doas -C $TMP && mv $TMP /etc/doas.conf;
rm -f $TMP

View File

@@ -0,0 +1,28 @@
LOCATION FIXME: Dezernat 16, Heidelberg
LOCATION STAMMTISCH: Metropolis, Walldorf
FIXME 07.10.2022 19:00
FIXME 11.11.2022 19:00 statt 04.11, Grund: Raumsituation
FIXME 02.12.2022 19:00
FIXME 13.01.2023 19:00 statt 06.01.2023, Grund: Raumsituation
FIXME 03.02.2023 19:00
FIXME 03.03.2023 19:00
FIXME 14.04.2023 19:00 statt 07.04.2023, Grund: Raumsituation
FIXME 05.05.2023 19:00
FIXME 02.06.2023 19:00
FIXME 07.07.2023 19:00
FIXME 04.08.2023 19:00
FIXME 01.09.2023 19:00
FIXME 06.10.2023 19:00
FIXME 03.11.2023 19:00
FIXME 01.12.2023 19:00
STAMMTISCH 19.12.2022 18:00
STAMMTISCH 17.01.2023 18:00
STAMMTISCH 20.02.2023 18:00
STAMMTISCH 20.03.2023 18:00
STAMMTISCH 17.04.2023 18:00
STAMMTISCH 15.05.2023 18:00
STAMMTISCH 19.06.2023 18:00

70
.bin/OLD/_config Normal file
View File

@@ -0,0 +1,70 @@
#!/bin/sh
#
# PIM / DOCUMENT DIRECTORY
#
PIMDIR="${HOME}/Documents"
#
# COLORS
#
BACKGROUND="#002020"
COLOR_NB="#002020"
COLOR_NF="#008080"
COLOR_SB="#004040"
COLOR_SF="#EEEEEE"
#
# TERMINALS
#
STERM="st -f Terminus:pixelsize=18"
BTERM="st -f Terminus:pixelsize=26"
HTERM="st -f spleen:pixelsize=32"
#
# DMENU
#
DMENUOPTS="-fn Terminus:pixelsize=20 \
-nb $COLOR_NB \
-nf $COLOR_NF \
-sf $COLOR_SF \
-sb $COLOR_SB \
-i \
-f"
DMENU_CMD="dmenu $DMENUOPTS"
#DMENU_CMD="rofi -dmenu"
DMENURUN_CMD="dmenu_run $DMENUOPTS"
#DMENURUN_CMD="rofi -show run"
#
# NOTIFY
#
NOTIFY_CMD() {
twmnc -i "${VAR##*/}" \
-d 5000 \
-t "$(date +%H:%M)" \
-c "$@"
}
#
# FUNCTIONS
#
needs() {
pkg_info -az | grep -q ^$1$ \
|| doas pkg_add $1
}
#
# CONNECT TO GPG-AGENT
#
[ -f ~/.ksh/gnupg.ksh ] \
&& . ~/.ksh/gnupg.ksh

BIN
.bin/OLD/a.out Executable file

Binary file not shown.

440
.bin/OLD/amused-monitor Executable file
View File

@@ -0,0 +1,440 @@
#!/usr/bin/env perl
#
# Copyright (c) 2022 Omar Polo <op@omarpolo.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
use strict;
use warnings;
use v5.12;
use open ":std", ":encoding(UTF-8)";
use utf8;
use Curses;
use POSIX qw(:sys_wait_h setlocale LC_ALL);
use Text::CharWidth qw(mbswidth);
use IO::Poll qw(POLLIN);
use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
use Getopt::Long qw(:config bundling);
use Pod::Usage;
my $run = 1;
my $pfile;
my $trim = "";
my $pair_n = 1;
my @songs;
my $current_song;
my $playlist_cur;
my $playlist_max;
my $time_cur;
my $time_dur;
my $status;
my $mode;
my $last_lines;
sub round {
return int(0.5 + shift);
}
sub max {
my ($a, $b) = @_;
return $a > $b ? $a : $b;
}
sub excerpt {
my $lines = shift;
my @tmp;
my ($n, $idx, $cur) = (0, 0, -1);
open (my $fh, "-|", "amused", "show", "-p");
while (<$fh>) {
chomp;
s,$trim,,;
$tmp[$idx] = $_;
if (m/^>/) {
$cur = $n;
$current_song = s/^> //r;
}
$n++;
$idx = ++$idx % $lines;
last if $cur != -1 && $n - $cur > int($lines/2) &&
$#tmp == $lines-1;
}
close($fh);
return ("Empty playlist.") unless @tmp;
# reorder the entries
my @r;
my $len = $#tmp + 1;
$idx = $idx % $len;
for (1..$len) {
push @r, $tmp[$idx];
$idx = ++$idx % $len;
}
return @r;
}
sub playlist_numbers {
my ($cur, $tot, $found) = (0, 0, 0);
open (my $fh, "-|", "amused", "show", "-p");
while (<$fh>) {
$tot++;
$cur++ unless $found;
$found = 1 if m/^>/;
}
close($fh);
return ($cur, $tot);
}
sub status {
my ($pos, $dur, $mode);
open (my $fh, "-|", "amused", "status", "-f",
"status,time:raw,mode:oneline");
<$fh> =~ m/([a-z]+) (.*)/;
my ($status, $current_song) = ($1, $2);
while (<$fh>) {
chomp;
$pos = s/position //r if m/^position /;
$dur = s/duration //r if m/^duration /;
$mode = $_ if m/^repeat/;
}
close($fh);
return ($status, $current_song, $pos, $dur, $mode);
}
sub showtime {
my $seconds = shift;
my $str = "";
if ($seconds > 3600) {
my $hours = int($seconds / 3600);
$seconds -= $hours * 3600;
$str = sprintf("%02d:", $hours);
}
my $minutes = int($seconds / 60);
$seconds -= $minutes * 60;
$str .= sprintf "%02d:%02d", $minutes, $seconds;
return $str;
}
sub center {
my ($str, $pstr) = @_;
my $width = mbswidth($str);
return $str if $width > $COLS;
my $pre = round(($COLS - $width) / 2);
my $lpad = $pstr x $pre;
my $rpad = $pstr x ($COLS - $width - $pre);
return ($lpad, $str, $rpad);
}
sub offsets {
my ($y, $x, $cur, $max) = @_;
my ($pre, $c, $post) = center(" $cur / $max ", '-');
addstring $y, $x, "";
my $p = COLOR_PAIR($pair_n);
attron $p;
addstring $pre;
attroff $p;
addstring $c;
attron $p;
addstring $post;
attroff $p;
}
sub progress {
my ($y, $x, $pos, $dur) = @_;
my $pstr = showtime $pos;
my $dstr = showtime $dur;
my $len = $COLS - length($pstr) - length($dstr) - 4;
return if $len <= 0 or $dur <= 0;
my $filled = round($pos * $len / $dur);
addstring $y, $x, "$pstr [";
addstring "#" x $filled;
addstring " " x max($len - $filled, 0);
addstring "] $dstr";
}
sub show_status {
my ($y, $x, $status) = @_;
my ($pre, $c, $post) = center($status, ' ');
addstring $y, $x, $pre;
addstring $c;
addstring $post;
}
sub show_mode {
my ($y, $x, $mode) = @_;
my ($pre, $c, $post) = center($mode, ' ');
addstring $y, $x, $pre;
addstring $c;
addstring $post;
}
sub render {
erase;
if ($LINES < 4 || $COLS < 20) {
addstring "window too small";
refresh;
return;
}
my $song_pad = "";
my $longest = 0;
$longest = max $longest, length($_) foreach @songs;
if ($longest < $COLS) {
$song_pad = " " x (($COLS - $longest)/2);
}
my $line = 0;
map {
attron(A_BOLD) if m/^>/;
addstring $line++, 0, $song_pad . $_;
standend;
} @songs;
offsets $LINES - 4, 0, $playlist_cur, $playlist_max;
progress $LINES - 3, 0, $time_cur, $time_dur;
show_status $LINES - 2, 0, "$status $current_song";
show_mode $LINES - 1, 0, $mode;
refresh;
}
sub getsongs {
$last_lines = $LINES;
@songs = excerpt $LINES - 4;
}
sub getnums {
($playlist_cur, $playlist_max) = playlist_numbers;
}
sub save {
return unless defined $pfile;
open(my $fh, ">", $pfile);
open(my $ph, "-|", "amused", "show", "-p");
print $fh $_ while (<$ph>);
}
sub hevent {
my $fh = shift;
my $l = <$fh>;
die "monitor quit" unless defined($l);
$status = "playing" if $l =~ m/^play/;
$status = "paused" if $l =~ m/^pause/;
$status = "stopped" if $l =~ m/^stop/;
($time_cur, $time_dur) = ($1, $2) if $l =~ m/^seek (\d+) (\d+)/;
$mode = $1 if $l =~ m/^mode (.*)/;
getnums if $l =~ m/load|jump|next|prev/;
getsongs if $l =~ m/load|jump|next|prev/;
}
sub hinput {
my ($ch, $key) = getchar;
if (defined $key) {
if ($key == KEY_BACKSPACE) {
system "amused", "seek", "0";
}
} elsif (defined $ch) {
if ($ch eq " ") {
system "amused", "toggle";
} elsif ($ch eq "<" or $ch eq "p") {
system "amused", "prev";
} elsif ($ch eq ">" or $ch eq "n") {
system "amused", "next";
} elsif ($ch eq ",") {
system "amused", "seek", "-5";
} elsif ($ch eq ".") {
system "amused", "seek", "+5";
} elsif ($ch eq "S") {
system "amused show | sort -u | amused load";
} elsif ($ch eq "R") {
system "amused show | sort -R | amused load";
} elsif ($ch eq "s") {
save;
} elsif ($ch eq "q") {
$run = 0;
} elsif ($ch eq "\cH") {
system "amused", "seek", "0"
}
}
}
GetOptions(
"p:s" => \$pfile,
"t:s" => \$trim,
) or pod2usage(1);
my $mpid = open(my $monitor, "-|", "amused", "monitor")
or die "can't spawn amused monitor";
setlocale(LC_ALL, "");
initscr;
start_color;
use_default_colors;
init_pair $pair_n, 250, -1;
timeout 1000;
scrollok 0;
curs_set 0;
keypad 1;
my $poll = IO::Poll->new();
$poll->mask(\*STDIN => POLLIN);
$poll->mask($monitor => POLLIN);
if (`uname` =~ "OpenBSD") {
use OpenBSD::Pledge;
use OpenBSD::Unveil;
my $prog = `which amused`;
chomp $prog;
unveil($prog, 'rx') or die "unveil $prog: $!";
if (defined($pfile)) {
unveil($pfile, 'wc') or die "unveil $pfile: $!";
pledge qw(stdio wpath cpath tty proc exec) or die "pledge: $!";
} else {
pledge qw(stdio tty proc exec) or die "pledge: $!";
}
}
getsongs;
getnums;
($status, $current_song, $time_cur, $time_dur, $mode) = status;
render;
while ($run) {
$poll->poll();
hinput if $poll->events(\*STDIN) & POLLIN;
hevent $monitor if $poll->events($monitor) & POLLIN;
getsongs if $LINES != $last_lines;
render;
}
endwin;
save;
kill 'INT', $mpid;
wait;
__END__
=pod
=head1 NAME
amused-monitor - curses interface for amused(1)
=head1 SYNOPSIS
B<amused-monitor> [B<-p> I<playlist>] [B<-t> I<string>]
=head1 DESCRIPTION
amused-monitor is a simple curses interface for amused(1).
The following options are available:
=over 12
=item B<-p> I<playlist>
Save the current playling queue to the file I<playlist> upon exit or
I<s> key.
=item B<-t> I<string>
Trim out the given I<string> from every song in the playlist view.
=back
The following key-bindings are available:
=over 8
=item backspace or C-h
Seek back to the beginning of the track.
=item space
Toggle play/pause.
=item < or p
Play previous song.
=item > or n
Play next song.
=item ,
Seek backward by five seconds.
=item .
Seek forward by five seconds.
=item R
Randomize the playlist.
=item S
Sort the playlist.
=item s
Save the status to the file given with the B<-p> flag.
=item q
Quit.
=back
=head1 SEE ALSO
amused(1)
=cut

27
.bin/OLD/aplay Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/sh
. ~/.bin/_config
needs amused--
if [ -z "$1" ]
then
DIR="$PWD"
echo "No parameter supplied, scraping current dir: $PWD"
else
DIR="$1"
fi
amused stop
find "$DIR" -type f -iname "*.flac" \
-o -iname "*.mp3" \
-o -iname "*.ogg" \
-o -iname "*.m4a" \
-o -iname "*.aac" \
-o -iname "*.wav" \
-o -iname "*.aiff" \
| amused load
amused play

59
.bin/OLD/ascii Executable file
View File

@@ -0,0 +1,59 @@
#!/bin/cat
OCT:
| 000 nul | 001 soh | 002 stx | 003 etx | 004 eot | 005 enq | 006 ack | 007 bel
| 010 bs | 011 ht | 012 lf | 013 vt | 014 ff | 015 cr | 016 so | 017 si
| 020 dle | 021 dc1 | 022 dc2 | 023 dc3 | 024 dc4 | 025 nak | 026 syn | 027 etb
| 030 can | 031 em | 032 sub | 033 esc | 034 fs | 035 gs | 036 rs | 037 us
| 040 sp | 041 ! | 042 " | 043 # | 044 $ | 045 % | 046 & | 047 '
| 050 ( | 051 ) | 052 * | 053 + | 054 , | 055 - | 056 . | 057 /
| 060 0 | 061 1 | 062 2 | 063 3 | 064 4 | 065 5 | 066 6 | 067 7
| 070 8 | 071 9 | 072 : | 073 ; | 074 < | 075 = | 076 > | 077 ?
| 100 @ | 101 A | 102 B | 103 C | 104 D | 105 E | 106 F | 107 G
| 110 H | 111 I | 112 J | 113 K | 114 L | 115 M | 116 N | 117 O
| 120 P | 121 Q | 122 R | 123 S | 124 T | 125 U | 126 V | 127 W
| 130 X | 131 Y | 132 Z | 133 [ | 134 \ | 135 ] | 136 ^ | 137 _
| 140 ` | 141 a | 142 b | 143 c | 144 d | 145 e | 146 f | 147 g
| 150 h | 151 i | 152 j | 153 k | 154 l | 155 m | 156 n | 157 o
| 160 p | 161 q | 162 r | 163 s | 164 t | 165 u | 166 v | 167 w
| 170 x | 171 y | 172 z | 173 { | 174 | | 175 } | 176 ~ | 177 del
HEX:
| 00 nul | 01 soh | 02 stx | 03 etx | 04 eot | 05 enq | 06 ack | 07 bel
| 08 bs | 09 ht | 0a lf | 0b vt | 0c ff | 0d cr | 0e so | 0f si
| 10 dle | 11 dc1 | 12 dc2 | 13 dc3 | 14 dc4 | 15 nak | 16 syn | 17 etb
| 18 can | 19 em | 1a sub | 1b esc | 1c fs | 1d gs | 1e rs | 1f us
| 20 sp | 21 ! | 22 " | 23 # | 24 $ | 25 % | 26 & | 27 '
| 28 ( | 29 ) | 2a * | 2b + | 2c , | 2d - | 2e . | 2f /
| 30 0 | 31 1 | 32 2 | 33 3 | 34 4 | 35 5 | 36 6 | 37 7
| 38 8 | 39 9 | 3a : | 3b ; | 3c < | 3d = | 3e > | 3f ?
| 40 @ | 41 A | 42 B | 43 C | 44 D | 45 E | 46 F | 47 G
| 48 H | 49 I | 4a J | 4b K | 4c L | 4d M | 4e N | 4f O
| 50 P | 51 Q | 52 R | 53 S | 54 T | 55 U | 56 V | 57 W
| 58 X | 59 Y | 5a Z | 5b [ | 5c \ | 5d ] | 5e ^ | 5f _
| 60 ` | 61 a | 62 b | 63 c | 64 d | 65 e | 66 f | 67 g
| 68 h | 69 i | 6a j | 6b k | 6c l | 6d m | 6e n | 6f o
| 70 p | 71 q | 72 r | 73 s | 74 t | 75 u | 76 v | 77 w
| 78 x | 79 y | 7a z | 7b { | 7c | | 7d } | 7e ~ | 7f del
DEC:
| 0 nul | 1 soh | 2 stx | 3 etx | 4 eot | 5 enq | 6 ack | 7 bel
| 8 bs | 9 ht | 10 lf | 11 vt | 12 ff | 13 cr | 14 so | 15 si
| 16 dle | 17 dc1 | 18 dc2 | 19 dc3 | 20 dc4 | 21 nak | 22 syn | 23 etb
| 24 can | 25 em | 26 sub | 27 esc | 28 fs | 29 gs | 30 rs | 31 us
| 32 sp | 33 ! | 34 " | 35 # | 36 $ | 37 % | 38 & | 39 '
| 40 ( | 41 ) | 42 * | 43 + | 44 , | 45 - | 46 . | 47 /
| 48 0 | 49 1 | 50 2 | 51 3 | 52 4 | 53 5 | 54 6 | 55 7
| 56 8 | 57 9 | 58 : | 59 ; | 60 < | 61 = | 62 > | 63 ?
| 64 @ | 65 A | 66 B | 67 C | 68 D | 69 E | 70 F | 71 G
| 72 H | 73 I | 74 J | 75 K | 76 L | 77 M | 78 N | 79 O
| 80 P | 81 Q | 82 R | 83 S | 84 T | 85 U | 86 V | 87 W
| 88 X | 89 Y | 90 Z | 91 [ | 92 \ | 93 ] | 94 ^ | 95 _
| 96 ` | 97 a | 98 b | 99 c | 100 d | 101 e | 102 f | 103 g
| 104 h | 105 i | 106 j | 107 k | 108 l | 109 m | 110 n | 111 o
| 112 p | 113 q | 114 r | 115 s | 116 t | 117 u | 118 v | 119 w
| 120 x | 121 y | 122 z | 123 { | 124 | | 125 } | 126 ~ | 127 del

17
.bin/OLD/audiotest Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh -x
_dir="$PWD/audiotest"
mkdir "$_dir"
for i in *.flac;
do
_tmp="$_dir/${i%%.flac}"
# create reference wav
flac -df "$i" -o "${_tmp}.wav"
# encode to 128kbit mp3
lame --cbr -b 128 "${_tmp}.wav" "${_tmp}-128.mp3"
# encode to 320kbit mp3
lame --cbr -b 320 "${_tmp}.wav" "${_tmp}-320.mp3"
# encode to VBR(new) Quaity 5 mp3
lame --vbr-new -b 96 -B 320 "${_tmp}.wav" "${_tmp}-VBR96.mp3"
done

45
.bin/OLD/autoencode.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
# This script takes not arguments
### CONF ###
INDIR="/encode/IN"
OUTDIR="/encode/OUT"
LOG="/encode/autoencode.log"
# FileNameConvention:
# [<audio channel>,<language>,resolution] - <title>.ext
# [1,DE,1080] - 23 - Nichts ist wie es scheint.mp4
log() {
printf '%s: %s\n' "$(date +%Y%m%y.%H%M%S)" "$1" # >> $LOG
}
find "$INDIR" -type f | while read file;
do
_base="$(basename "$file")"
_track="$(printf '%s' "$_base" | sed 's/^\[\(.[^,]*\),.*\] - .*/\1/g')"
_lang="$(printf '%s' "$_base" | sed 's/^\[.*,\(.*\),.*\] - .*/\1/g')"
_size="$(printf '%s' "$_base" | sed 's/^\[.*,.*,\(.*\)] - .*/\1/g')"
_title="$(printf '%s' "$_base" | sed 's/^\[.*,.*,.*\] - \(.*\)\..*/\1/g')"
_out="$_title [${_lang}][${_size}p].mkv"
log "File $_base"
log "Track: $_track"
log "Language: $_lang"
log "Resolution: $_size"
log "Title: $_title"
log "Outfile: $_out"
ffmpeg -loglevel error \
-i "$file" \
-c:a copy \
-map 0:$_track \
-c:v libx264 \
-vf "scale=-2:$_size" \
-crf 21 \
-preset veryslow \
-tune zerolatency \
"$OUTDIR/$_out"
done

7
.bin/OLD/autorandr-c Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
export DISPLAY=:0
export HOME=/home/sdk
/usr/local/bin/autorandr -c
/usr/bin/pgrep -q herbstluftwm \
&& doas -u sdk /usr/local/bin/herbstclient detect_monitors

81
.bin/OLD/autosort Executable file
View File

@@ -0,0 +1,81 @@
#!/bin/sh
# This script takes an input directory and processes all files.
# It creates a directory structure in the output directory based
# on metadata of the file. The filename will also be created out
# of metadata, or replaced with the sha1 hash of itself in order
# to avoid duplicates.
usage() {
print "Usage: autosort <input directory> <output directory>";
exit 2
}
# check input
test -d "$1" || usage
test -d "$2" || usage
# normalize relative paths
_indir="$(readlink -f "$1")"
_outdir="$(readlink -f "$2")"
####################
# MAIN PROGRAM #
####################
start(){
# trigger main loop
find "$_indir" -type f | while read _file;
do
# extract mime type
local _mime="$(file -bi "$_file")"
local _category=${_mime%%/*}
local _type=${_mime##*/}
case "$_category" in
image) process_image "$_file" "$_type"; ;;
*) printf 'Unhandled Category: %s in %s\n' "$_category" "$_file"; ;;
esac
done
}
#################
# FUNCTIONS #
#################
process_image() {
# $1 = file
# $2 = mime type
case $2 in
jpeg) handle_jpeg "$1"; ;;
png) handle_jpeg "$1"; ;;
gif) handle_copy "$1" "image" "$2"; ;;
*) printf 'Unhandled Type: %s in %s\n' "$2" "$1"; ;;
esac
}
handle_jpeg() {
# $1 = file
local _exif="$(exifprint "$1")"
local _make="$(printf '%s' "$_exif" | grep '0x010f' | awk '{for(i=5;i<=NF;++i)print $i}')"
local _model="$(printf '%s' "$_exif" | grep '0x0110' | awk '{for(i=5;i<=NF;++i)print $i}')"
local _datetime="$(printf '%s' "$_exif" | grep '0x9003' | awk '{for(i=5;i<=NF;++i)print $i}')"
test -z "$_make" && local _make=unknown
test -z "$_model" && local _model=unknown
test -z "$_datetime" && local _datetime="$(sha1 -q "$1")"
local _out="$(printf '%s %s/%s' "$_make" "$_model" "$_datetime" | tr '\n' ' ' | tr ':' '-')"
install -bDm 0666 "$1" "$_outdir/${_out}.jpg" && rm -f "$1"
}
handle_copy() {
# $1 = file
# $2 = category
# $3 = type
install -bDm 0666 "$1" "$_outdir/$2/$3/${1##*/}" && rm -f "$1"
}
start

3
.bin/OLD/avalon Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
config="$(basename $0).tin"
tt++ ~/.bin/mud/$config

BIN
.bin/OLD/avg Executable file

Binary file not shown.

18
.bin/OLD/avg.c Normal file
View File

@@ -0,0 +1,18 @@
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
int main(int argc, const char *argv[])
{
unsigned long long no = 0;
for (int i=1; i<argc; i++) {
no += strtoull(argv[i], NULL, 10);
}
if (argc < 2)
printf("%lld\n", no);
if (argc > 1)
printf("%.0lld\n", no / (argc - 1) / 1000000);
return 0;
}

5
.bin/OLD/bbs-tunnel Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/ksh
#pkill -f "2323:localhost:2323 surfen@65.21.154.173"
#sleep 1
ssh -fN -o ServerAliveInterval=15 -L 2323:localhost:2323 surfen@65.21.154.173
#autossh -M 0 -f -T -N -o ServerAliveInterval=15 -o ServerAliveCountMax=3 -L 2323:localhost:2323 surfen@65.21.154.173

15
.bin/OLD/bitshift Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/cat
+-----+-----+-----+-----+-----+
| x | y | x&y | x|y | x^y |
+-----+-----+-----+-----+-----+
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
+-----+-----+-----+-----+-----+
x&y = 1 when: both need to be 1
x|y = 1 when: one or both needs to be 1
x^y = 1 when: x and y are different

96
.bin/OLD/blog Executable file
View File

@@ -0,0 +1,96 @@
#!/bin/sh
USER=sdk
DOMAIN=home.codevoid.de
RPATH=~/make-web/src
usage() {
printf 'Usage: %s <option> <file.ext>\n' "$TYPE";
printf 'Options: new - create new %s file\n' "$TYPE"
printf ' ls - list %ss\n' "$TYPE"
printf ' edit - edit %s file\n' "$TYPE"
printf ' rm - delete %s file\n' "$TYPE"
}
chkfile() {
[ ! -z "$2" ] \
&& usage \
&& exit 2
}
new() {
chkfile
printf "New Entry:\n"
printf "$1\n" | tr '_' ' ' > "/tmp/tmp-$date-$1" && \
vim "/tmp/tmp-$date-$1" \
&& scp "/tmp/tmp-$date-$1" \
$USER@$DOMAIN:"$RPATH/posts/$date-$1"
makeblog
}
delete() {
chkfile
printf "Delete Entry: $1\n"
ssh $USER@$DOMAIN "rm -vf $RPATH/posts/$1"
makeblog
}
list() {
printf "Blog Index:\n"
ssh $USER@$DOMAIN "find $RPATH/posts -type f -maxdepth 1 \
-exec printf '{}|' \; -exec head -1 '{}' \; \
| sed 's,.*/,,'| sort | column -s'|' -t "
}
edit() {
chkfile
printf "Edit Entry:\n"
[ -z $1 ] && printf "Usage: editblog <file.ext>\n" && return
printf "Opening $1\n"
local date=$(date +"%Y-%m-%d")
scp -q $USER@$DOMAIN:"$RPATH/posts/$1" "/tmp/tmp-$1" && \
vim "/tmp/tmp-$1" && \
scp -q "/tmp/tmp-$1" $USER@$DOMAIN:"$RPATH/posts/$1" && \
rm "/tmp/tmp-$1" && \
printf "Saved $1\n"
makeblog
}
makeblog() {
ssh $USER@$DOMAIN "cd ~/make-web && make install"
}
date=$(date +"%Y-%m-%d")
dash="------------------------------------------------------------------------"
### MAIN PROGRAM ###
# the filename is used as type
case $0 in
*blog) TYPE=blog;
;;
*journal) TYPE=journal;
;;
*) printf 'Filename must be "blog" or "journal"\n'; exit 1;
;;
esac
# where should the files go?
[ "$TYPE" == "blog" ] \
&& DIR=posts
[ "$TYPE" == "journal" ] \
&& DIR=journal
case $1 in
new) new $2;
;;
edit) edit $2;
;;
ls) list;
;;
rm) delete $2;
;;
*) usage;
exit 2;
;;
esac

32
.bin/OLD/bm Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
# this is work in progress
# bookmark file format descrition
#
# date | uri | tags | title
# 2021-01-06 | http://example.com | tech, whatever | Title
add() {
_date="$(date +"%Y-%m-%d")"
_url="$1"
shift
_desc0="$@"
_desc1="$(curl -sL $_url | hxclean | hxselect -ic 'title' 2>/dev/null)"
printf '%s | %s | %s | %s\n' "$_date" "$_url" "$_desc0" "$_desc1"
}
case $1 in
add) shift; add $@;
;;
rm)
;;
list)
;;
*) printf '%s\n%s\n%s\n' \
"bm add <url> [descr] - Add new entry to bookmark file" \
" del <url> - Delete entry from bookmark file" \
" list [filter] - Show bookmark file";
;;
esac

15
.bin/OLD/bookmarks Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
clean() {
cat ~/.browser_history \
| sort -k 3 \
| uniq -f2 \
| sort \
> /tmp/browser_history \
&& mv /tmp/browser_history ~/.browser_history
echo done.
}
case "$1" in
clean) clean; ;;
*) vim ~/.browser_history; ;;
esac

36
.bin/OLD/bpm-rename Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/sh -x
# rename files so the filename includes the BPM
usage() {
printf "Usage: $0 <srcfolder> <dstfolder>\n"
exit 2
}
test -z "$1" && usage
test -z "$2" && usage
_src="$(readlink -f "$1")"
_dst="$(readlink -f "$2")"
myread() {
read p
}
find "$_src" -type f \
| while read _file
do
printf 'Playing file %s...\n' "$(basename "$_file")"
mpv --really-quiet --no-video "$_file" &
_pid="$!"
bpm-tag -m $(($v - 20)) -x $(($v + 20)) -n -f "$_file"
case $d in
"[yY]") echo rename; ;;
*) ;;
esac
kill $_pid
done

12
.bin/OLD/bsdver Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
if [ -z $1 ]
then
doas what /bsd | tail -1
else
for h in $@
do
echo -n "$h: "
ssh $h "doas what /bsd | tail -1"
done
fi

72
.bin/OLD/bspswallow Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/sh -x
# Get class of a wid
get_class() {
set -x
[ ! -z "$1" ] \
&& xprop -id "$1" -notype WM_CLASS | cut -d'"' -f2
}
get_pid() {
set -x
[ ! -z "$1" ] \
&& xprop -id "$1" -notype _NET_WM_PID | cut -d'=' -f2
}
get_parentpid() {
ps -o "ppid=" -f -p $1
}
get_command() {
ps -o comm= -p $1
}
swallow() {
set -x
addedtodesktop=$2
lasttermdesktop=$(bspc query -D -n last)
swallowerid=$1
swallowingid=$(bspc query -N -n last)
if [ "$addedtodesktop" == "$lasttermdesktop" ]; then
grep "^$(get_class "$swallowerid")$" ~/.config/bspwm/swallow || return
grep "^$(get_class "$swallowingid")$" ~/.config/bspwm/terminals || return
echo "$swallowerid $swallowingid" >> /tmp/swallowids
bspc node "$swallowingid" --flag hidden=on
fi
}
spit() {
spitterid=$1
spitterdesktop=$2
grep "^$spitterid" /tmp/swallowids \
|| return
spittingid=$(grep "^$spitterid" /tmp/swallowids | head -n1 | awk '{ print $2 }')
bspc node "$spittingid" --flag hidden=off
termdesktop=$(bspc query -D -n "$spittingid")
[ "$termdesktop" == "$spitterdesktop" ] \
|| bspc node "$spittingid" -d "$spitterdesktop"
bspc node "$spittingid" -f
sed -i "/^$spitterid/d" /tmp/swallowids
}
bspc subscribe node_add node_remove | while read -r event
do
case $(echo "$event" | awk '{ print $1 }') in
node_add)
swallow $(echo "$event" | awk '{ print $5 " " $3}')
;;
node_remove)
spit $(echo "$event" | awk '{ print $4 " " $3}')
;;
esac
done

2
.bin/OLD/bspswallow-addwindow Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
xprop |grep ^WM_CLASS | awk -F'"' '{ print $2 }' >> /home/sdk/.config/bspwm/swallow

5
.bin/OLD/bspwm-keys Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
. ~/.bin/_config
awk '/^[a-z]/ && last {print $0,"|",last} {last=""} /^#/{last=$0}' ~/.config/bspwm/sxhkdrc \
| column -t -s '|' \
| $DMENU_CMD -p "bspwm keys:" -l 30

44
.bin/OLD/c Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
if [ -f ~/.c.query ]
then
echo -n "Open $(< ~/.c.query) again (Y/n)? "
read
case $REPLY in
[Nn]) rm -f ~/.c.query; ;;
esac
fi
[ -f ~/.c.query ] \
&& EXTRA="--query $(<~/.c.query)"
[ ! -z "$@" ] \
&& EXTRA="--query $@"
FZF_DEFAULT_COMMAND='find \
$HOME/.config/* \
$HOME/.* \
-maxdepth 1 \
-type f \
\( -name "*.cfg" \
-o -name "*.conf" \
-o -name "*.lua" \
-o -name "*.sh" \
-o -name "*.toml" \
-o -name "*.xsession*" \
-o -name "*rc" \
-o -name ".Xresources" \
-o -name ".Xdefaults" \
-o -name ".ini" \
-o -name "config" \
\)'
export FZF_DEFAULT_COMMAND
F=$(fzf -1 -e +s $EXTRA --preview='cat {}')
[ -z "$F" ] \
|| vim "$F" && echo "$F" > ~/.c.query;
[ -z "$F" ] \
&& rm -f ~/.c.query

11
.bin/OLD/cdrip2flac Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
set -xe
alias flac_encode="flac -e --best --delete-input-file"
doas chown sdk /dev/rcd0* /dev/cd0*
cdio cdrip
for i in *.wav;
do
flac_encode "$i" -o "${i%%.wav}.flac";
done
picard *.flac
cdio eject

2
.bin/OLD/chargefull Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
doas sysctl hw.battery.chargestart=1 hw.battery.chargestop=100

19
.bin/OLD/chrome-debug Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
/usr/local/bin/chrome \
--high-dpi-support=1 \
--force-device-scale-factor=2 \
--disk-cache-dir=/tmp \
--password-store=basic \
--no-proxy-server \
--enable-features=WebUIDarkMode \
--force-dark-mode \
--disable-unveil \
--no-sandbox \
--ignore-gpu-blacklist \
--use-gl=egl \
--new-window \
"$@"
#--no-sandbox \

13
.bin/OLD/chrome-small Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
/usr/local/bin/chrome \
--high-dpi-support=0 \
--force-device-scale-factor=0.8 \
--password-store=basic \
--no-proxy-server \
--enable-features=WebUIDarkMode \
--force-dark-mode \
--ignore-gpu-blocklist \
--use-gl=desktop \
--wm-window-animations-disabled \
--webrtc-max-cpu-consumption-percentage=10 \
--new-window "$@"

10
.bin/OLD/clipdl Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
mkdir -p ~/clipdl
cd ~/clipdl
tmux new-session -s clipdl -d > /dev/null 2>&1
tmux new-window -t clipdl
tmux send-keys -t clipdl "yt-dlp \"$(xclip -r -o)\" && exit" Enter

2
.bin/OLD/clog Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh -x
cvs log -N -rHEAD . | less

7
.bin/OLD/clone Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
_thing="$(readlink -f $1)"
_remote="$2"
rsync -arvP $_think $_remote:$_thing

11
.bin/OLD/codechecker-script Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
if [ -z "$1" ]
then
echo "usage: codechecker <build command>"
exit 2
fi
_tmp=$(mktemp -d)
codechecker check --ctu --jobs 6 -b "$@" -o $_tmp --clean --enable sensitive
codechecker parse --export html --output ${_tmp}_web $_tmp

22
.bin/OLD/codi-convert.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/sh
CATCH=\
"
SIGNAL IDUNA Krankenversic Signal Iduna Krankenversicherung
Apple Servi Apple Services
Baloise Sachversicherung Aktiengesellschaft Baloise Unfallversicherung
"
cat $1 | sed 's/\(..\)\.\(..\)\.\(....\)/\3-\2-\1/g' | sort | while read -r line
do
DATE="$(echo "$line" | cut -d";" -f1 | tr -d '"')"
ENTRY="$(echo "$line" | cut -d";" -f4 | sed 's/Auftraggeber: //g;s/Buchungstext: //g')"
AMOUNT="$(echo "$line" | cut -d";" -f5)"
if [ ! -z "$AMOUNT" ]
then
echo -e "\n$DATE $ENTRY\n Expenses: $AMOUNT EUR" | tr -d '"'
fi
done

45
.bin/OLD/codi-fetch Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
echo "Logging In..."
passdata="$(pass Internet/comdirect.com)"
client_id=$(echo "$passdata" | grep ^client_id | awk '{ print $2 }')
client_secret=$(echo "$passdata" | grep ^client_secret | awk '{ print $2 }')
username=$(echo "$passdata" | grep ^user | awk '{ print $2 }')
password=$(echo "$passdata" | head -1)
### FUNCTIONS
get_token() {
token=$(curl -s \
-X POST \
-H "Accept:application/json" \
-H "Content-Type:application/x-www-form-urlencoded" \
--data-urlencode "client_id=$client_id" \
--data-urlencode "client_secret=$client_secret" \
--data-urlencode "username=$username" \
--data-urlencode "password=$password" \
--data-urlencode "grant_type=password" \
https://api.comdirect.de/oauth/token \
| jq -r .access_token)
echo "$token"
}
# $1 token
get_session() {
transactions=$(curl -s \
-X POST \
-H "Accept:application/json" \
-H "Content-Type:application/x-www-form-urlencoded" \
--data-urlencode "client_id=$client_id" \
--data-urlencode "client_secret=$client_secret" \
--data-urlencode "username=$username" \
--data-urlencode "password=$password" \
--data-urlencode "grant_type=password" \
https://api.comdirect.de/ \
| jq -r .access_token)
echo "$transactions"
}
### MAIN PROGRAM
TOKEN=$(get_token)
echo "Got token: $TOKEN"

10
.bin/OLD/codi2ledger Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV qw( csv );
my $filename = $ARGV[0] or die "Parameter missing";
print $filename;

42
.bin/OLD/compress_maildir.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/ksh
set -e # fail on error
# mail permission
UID=sdk
GID=sdk
MODE=600
BACKUP=0 # if 1, bak directory will be created within maildir
[[ -z $1 ]] && \
print "$0 <maildir>" && exit 2
# conditions:
# - filename as size S=
# - filename does not end in Z (already compressed)
# - file must not return gzip compressed data (already compressed)
# filename is cut from the file(1) output
FILES=$(cd "$1/cur/" \
&& find . -iname '*,S=*[^Z]' -exec file {} \; \
| grep -v 'gzip compressed data' \
| sed 's/: /!/' \
| cut -d '!' -f 1)
[[ $BACKUP != 0 ]] && mkdir "$1/bak"
# loop through mail and compress appending Z
# sync mtime with original file
# set used,group,permissions
# remove original mail (or backup)
for MAIL in $FILES; do
print "gzipping $1/cur/$MAIL to $1/cur/${MAIL}Z"
gzip -8 -S Z "$1/cur/$MAIL" -c > "$1/cur/${MAIL}Z"
touch -r "$1/cur/$MAIL" "$1/cur/${MAIL}Z"
chown $UID:$GID "$1/cur/${MAIL}Z"
chmod $MODE "$1/cur/${MAIL}Z"
if [[ $BACKUP != 0 ]]; then
mv "$1/cur/$MAIL" "$1/bak/$MAIL"
else
rm -f "$1/cur/$MAIL"
fi
done

7
.bin/OLD/contactsearch Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
. $HOME/.bin/_config
for file in $(ls -1p $PIMDIR/contacts);
do
printf "%s %s\n" "$file" "$(cut -d":" -f2- $PIMDIR/contacts/$file | tr '\n' ',')"
done

15
.bin/OLD/copyto Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
[ -z "$1" ] && exit 1
DEST=/tank/pub
DIRS=Video_{Movies,Music,Series,Education,P0rn}
PS3="Move \"$1\" to: "
select dir in $DIRS ${DIRS}_Unsorted
do
echo mv -iv "$1" $DEST/$dir/
mv -iv "$1" $DEST/$dir/
exit 0
done

39
.bin/OLD/cr2-preview Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/sh
find . -type f \
-maxdepth 1 \
\( -iname "*.cr2" -o -iname "*.orf" -o -iname "*.dng" \) \
-exec basename "{}" \; \
| while read raw
do
jpg="${raw%.*}.jpg"
thm="${raw%.*}.thumb.jpg"
if [ ! -f "${jpg}" ]
then
printf 'Extracting Preview: %s\n' "${raw}"
dcraw -e "${raw}"
mv "${thm}" "${jpg}"
else
printf 'Skipping (existing): %s\n' "${jpg}"
fi
done
find . -type f \
-maxdepth 1 \
-iname "*.tif" \
-exec basename "{}" \; \
| while read raw
do
jpg="${raw%.*}.jpg"
thm="${raw%.*}.thumb.jpg"
if [ ! -f "${jpg}" ]
then
printf 'Extracting Preview: %s\n' "${raw}"
convert -scale 1600x1600 "${raw}" "${thm}"
mv "${thm}" "${jpg}"
else
printf 'Skipping (existing): %s\n' "${jpg}"
fi
done

87
.bin/OLD/cr2-rename Executable file
View File

@@ -0,0 +1,87 @@
#!/bin/sh
# main loop
find . -type f \
-maxdepth 1 \
\( -iname "*.cr2" \
-o -iname "*.dng" \
-o -iname "*.tif" \
-o -iname "*.orf" \) \
-exec basename "{}" \; | sort | \
while read file
do
ext=${file##*.}
printf "%s [" "${file}"
# try some exif values to gather date/time
EXIF="$(exiftool -createdate -d %Y-%m-%d_%H-%M-%S -T "${file}")"
# handle invalid dates
if [ "$EXIF" = "0000:00:00 00:00:00" ]
then
EXIF="$(exiftool -datetimeoriginal -d %Y-%m-%d_%H-%M-%S -T "${file}")"
fi
if [ "$EXIF" = "0000:00:00 00:00:00" ]
then
EXIF="$(exiftool -datetimeutc -d %Y-%m-%d_%H-%M-%S -T "${file}")"
if [ "$EXIF" != "0000:00:00 00:00:00" ]
then
EXIF=$(date -f %s -j "$(( $(date -f "%Y-%m-%d_%H-%M-%S" -j "$EXIF" +%s) + 3600 ))" +"%Y-%m-%d_%H-%M-%S")
fi
fi
# skip if there is no (proper) exif data
if [ -z "$EXIF" ] || [ "$EXIF" = "0000:00:00 00:00:00" ]
then
printf " no exif data ]\n"
continue
fi
for variant in a b c d e f g h i j k l m n o p q r s t u v w x y z
do
# same file? then we've converted it already.
if [ "${file}" = "${EXIF}-${variant}.$ext" ]
then
printf " %s->found" "$variant"
break
fi
# variant is is already existing - try next one
if [ -f "${EXIF}-${variant}.$ext" ]
then
continue
fi
# rename file
printf " %s->rename" "$variant"
mv "${file}" "${EXIF}-${variant}.$ext"
# check for matching jpg files
for type in jpeg JPEG jpg JPG xmp XMP psd PSD
do
if [ -f "${file%.*}.$type" ]
then
printf " + $type"
mv "${file%.*}.$type" "${EXIF}-${variant}.$type"
elif [ -f "${file}.$type" ]
then
printf " + $type"
mv "${file}.$type" "${EXIF}-${variant}.$type"
fi
case $type in
[xX][mM][pP])
if [ -f "${EXIF}-${variant}.$type" ]
then
sed -i "s,\(crs:RawFileName=\"\).*[^\"]\",\1${EXIF}-${variant}.$ext\",g" "${EXIF}-${variant}.$type";
sed -i "s,\(xmpMM:DerivedFrom=\"\).*[^\"]\",\1${EXIF}-${variant}.$ext\",g" "${EXIF}-${variant}.$type";
fi
;;
esac
done
# we're done here
break
done
printf " ]\n"
done

12
.bin/OLD/cscope-update Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
. ~/.bin/_config
set -ex
find "${DEVDIR}" -type f \
\( -name "*.c" \
-o -name "*.cc" \
-o -name "*.cpp" \
-o -name "*.c" \
-o -name "*.hh" \
-o -name "*.hpp" \
\) > /home/sdk/cscope.files
cscope -qbkCRvf /home/sdk/cscope.out -i/home/sdk/cscope.files

24
.bin/OLD/cv_motd Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
OS=$(uname -s)
OSVER=$(uname -r)
OSARCH=$(uname -m)
CPUS=$(sysctl -n hw.ncpufound)
CPUMODEL=$(sysctl -n hw.model)
MEM=$(printf "$(sysctl -n hw.physmem)/1024/1024\n" | bc)
printf '%s\n' \
' ___ _____ ____ ____ _ _ _____ ____ ____
/ __)( _ )( _ \( ___)( \/ )( _ )(_ _)( _ \
( (__ )(_)( )(_) ))__) \ / )(_)( _)(_ )(_) )
\___)(_____)(____/(____) \/ (_____)(____)(____/
'
printf " OS: %s" "$OS"
printf " Version: %s" "$OSVER"
printf " Architecture: %s\n" "$OSARCH"
printf " CPU: %s\n" "${CPUS}x $CPUMODEL"
printf " RAM: %s\n\n" "${MEM}MB"

6
.bin/OLD/cvs-log Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
cd /usr/ports/$1
cvs log -Nl -rHEAD 2>&1
tree

28
.bin/OLD/cycle Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
LAST_KNOWN_ESP_S=2013-11-08
LAST_KNOWN_ESP_J=2013-11-10
LEN_S=28
LEN_J=28
add_days() {
date=$1
days=$2
ts_in=$(date -jf %Y-%m-%d +%s $date)
sec=$(( days * 24 * 60 * 60 ))
ts_out=$(( ts_in + sec ))
echo " $(date -jf %s +%d.%m.%Y $ts_out)"
}
echo "Next ESP S: "
for i in 1 2 3 4 5 6
do
add_days $LAST_KNOWN_ESP_S $(( LEN_S * i ))
done
echo "Next ESP J: "
for i in 1 2 3 4 5 6
do
add_days $LAST_KNOWN_ESP_J $(( LEN_J * i ))
done

4
.bin/OLD/ddev Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. $HOME/.bin/_config
S=$(cd $HOME/.bin && ls -1 dev-* | $DMENU_CMD -p Script)
[ ! -z "$S" ] && sterm "ksh -ic $S"

29
.bin/OLD/dev-portfiles Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
cd /usr/ports
F=$(find * \
-type f \
\( -name "Makefile" \
-o -name "PLIST*" \
-o -name "DESCR" \
-o -name "distinfo" \
-o -name "patch-*" \
-o -name "README*" \
-o -name "Makefile" \
\) \
-not -path "pobj/*" \
-not -path "infrastructure/*" \
-not -path "packages/*" \
-not -path "plist/*" \
-not -path "logs/*" \
-not -path "CVS/*" \
| fzf \
--exact \
--no-sort \
--preview-window=right:65% \
--preview='highlight -O ansi -O xterm256 --force {}' \
);
test -z "$F" \
|| vim "$F";

7
.bin/OLD/dev-search-ports-all Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
ugrep --exclude-dir="CVS" \
--exclude-dir="pobj" \
--exclude-dir="distfiles" \
--recursive \
"$@" \
/usr/ports/

View File

@@ -0,0 +1,10 @@
#!/bin/sh
ugrep --exclude-dir="CVS" \
--exclude-dir="pobj" \
--exclude-dir="distfiles" \
--exclude-dir="plist" \
--exclude-dir="packages" \
--include="Makefile" \
--recursive \
"$@" \
/usr/ports/

View File

@@ -0,0 +1,6 @@
#!/bin/sh
ugrep --exclude-dir="CVS" \
--include="patch-*" \
--recursive \
"$@" \
/usr/ports/

View File

@@ -0,0 +1,6 @@
#!/bin/sh
ugrep --exclude-dir="CVS" \
--include="PLIST*" \
--recursive \
"$@" \
/usr/ports/

8
.bin/OLD/dev-showdiff Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
set -ex
for _f in $(find . -name "*.orig")
do
vimdiff $_f ${_f%*.orig}
done

9
.bin/OLD/dev-showdiff-cvs Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
set -ex
for _file in $@
do
_tmp="$(mktemp)"
cvs -nd sdk@cvs.openbsd.org:/cvs update -p $1 > $_tmp
cmp -s $_tmp $_file || vimdiff $_tmp $_file
rm -f $_tmp
done

5
.bin/OLD/dev-showmaintainer Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh -e
cd /usr/ports/$1
echo "$1":
make show=MAINTAINER

11
.bin/OLD/dev-ugrep-sys Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
ugrep --exclude-dir="CVS" \
--include="*.h" \
--include="*.c" \
--include="*.txt" \
--include="*.pl" \
--include="*.pm" \
--include="*.sh" \
--recursive \
"$@" \
/usr/src/sys/

15
.bin/OLD/devs Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
. ~/.bin/_config
set -xe
[ ! -z "$1" ] && EXTRA="-q $1"
F=$(find /usr/src /usr/xenocara /usr/www -type f \
-not -path "*/CVS/*" \
-not -path "*/.git/*" \
-not -name "*.orig" \
-not -name "*.git*" \
-not -name "*.cvs*" \
| fzf -e -1 -0 $EXTRA)
R="$(readlink -f "$F")"
test -z "$R" || vim "$R"
echo "$(dirname "$R")"

170
.bin/OLD/dexec_browser Executable file
View File

@@ -0,0 +1,170 @@
#!/bin/ksh
# dexec_browser
# A multi browser launcher
#
# 1. choose input source
# (filtered-, full history, clipboad, manual entry)
# 2. choose how to handle the input
# (can suggest a matching default)
# 3. choose which browser to use
# (can suggest a matching default)
. ${HOME}/.bin/_config
HISTFILE="${HOME}/.browser_history"
touch "${HISTFILE}"
# show history file
# EXPECTS: $HISTFILE $DMENU_CMD
# PROVIDES: $INPUT
read_input() {
local S=$( { echo "paste_from_clipboard"; tail -r ${HISTFILE}; } \
| awk '!seen[$0]++' \
| ${DMENU_CMD} -p "Bookmarks" -l 20)
case "${S}" in
paste_from_clipboard) S=$(xclip -o | head -n 1); ;;
esac
[ -z "${S}" ] && exit 0
INPUT="${S}"
}
# Decide how to open the thing
# EXPECTS: $INPUT $DMENU_CMD
# PROVIDES: $URI
choose_wrapper() {
local SE="OPEN URL
Amazon
Amazon Order ID
CPAN
Crates.io
DuckDuckGo Web Search
DuckDuckGo Image Search
Startpage Web Search
GLIB Documentation
Github
LibSOUP Documentation
Marc Info MessageID
Marc Info OpenBSD Misc List
Marc Info OpenBSD Ports CVS
Marc Info OpenBSD Ports List
Marc Info OpenBSD Tech List
PDF Viewer
SearX Web Search
SearX Image Search
Torrent Leech
Wikipedia DE
Wikipedia EN
InternetMovieDataBase (IMDB)
OpenStreetMap (OSM)
Grep.app
Google Maps
Youtube
Zalando"
local C="$(printf '%s' "${INPUT}" \
| head -n 1)"
case "${C}" in
*::*) DEFAULT="CPAN (default)"; ;;
http*) DEFAULT="OPEN (default)"; ;;
192.168.*) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
10.20.*) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
???-???????-???????) DEFAULT="Amazon Order ID (default)"; ;;
gopher*) DEFAULT="OPEN (default)"; ;;
g_*) DEFAULT="GLIB Documentation (default)"; ;;
[Ss]oup_*) DEFAULT="LibSOUP Documentation (default)"; ;;
www.*) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
\<*@*\>) DEFAULT="Marc Info Message ID (default)"; ;;
*.com|*.de|*.net|*.org) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
*.at|*.ch|*.social) DEFAULT="OPEN (default)"; C="http://${C}" ;;
*.io|*.sh|*.pw|*.party) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
*.coffee|*.me|*.cloud) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
*.[a-zA-Z]*/*) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
*) DEFAULT="DuckDuckGo Web Search (default)"; ;;
esac
local S="$(printf "%s\n%s" "${DEFAULT}" "${SE}" \
| ${DMENU_CMD} -p "Search Where?" -l 20)"
C=$(echo "$C" | sed 's/ /%20/g')
case "${S}" in
OPEN*) URI="${C}"; ;;
Amazon) URI="https://www.amazon.de/s?k=${C}&rh=p_n_enc-merchantbin%3AA3JWKAKR8XB7XF"; ;;
Amazon*O*) URI="https://www.amazon.de/gp/your-account/order-details/ref=ppx_yo_dt_b_order_details_o00?orderID=${C}"; ;;
CPAN*) URI="https://metacpan.org/search?q=${C}"; ;;
Crate*) URI="https://crates.io/search?q=${C}"; ;;
Grep*) URI="https://grep.app/search?q=${C}"; ;;
GLIB*) URI="https://docs.gtk.org/glib/flags.UriFlags.html?q=${C}"; ;;
LibSOUP*) URI="https://libsoup.org/libsoup-3.0/index.html?q=${C}"; ;;
Github) URI="https://github.com/search?q=${C}"; ;;
D*Web*) URI="https://html.duckduckgo.com/html?q=${C}"; ;;
Startpage*) URI="https://eu.startpage.com/do/search?prfe=00d4bb7f075582be9304aaad813ac6b4dc4bd733a098955c35c0586a99eaddf123ac81f1301f1e4f06fd014082141134ec5e0c5441250cf4c05557bed28fcfbced8de0007d01a0254332962533&query=${C}"; ;;
D*Ima*) URI="https://duckduckgo.com/?q=${C}&iax=images&ia=images"; ;;
S*Web*) URI="https://searx.bar/search?q=${C}&category_general=on"; ;;
S*Ima*) URI="https://searx.bar/search?q=${C}&category_images=on"; ;;
Tor*Lee*) URI="https://www.torrentleech.org/torrents/browse/index/query/${C}"; ;;
W*DE*) URI="https://de.m.wikipedia.org/wiki/Spezial:Suche/${C}"; ;;
W*EN*) URI="https://en.m.wikipedia.org/wiki/Spezial:Search/${C}"; ;;
*IMDB*) URI="https://www.imdb.com/find?q=${C}"; ;;
O*S*M*) URI="https://www.openstreetmap.org/search?query=${C}"; ;;
G*Maps) URI="https://www.google.com/maps/place/${C}"; ;;
You*be) URI="https://m.youtube.com/results?sp=mAEA&search_query=${C}" ;;
M*I*ID*) URI="https://marc.info/?i=$(printf '%s' "${C}" | tr -d '<>')"; ;;
M*I*P*List) URI="https://marc.info/?l=openbsd-ports&s=${C}&q=b"; ;;
M*I*T*List) URI="https://marc.info/?l=openbsd-tech&s=${C}&q=b"; ;;
M*I*M*List) URI="https://marc.info/?l=openbsd-misc&s=${C}&q=b"; ;;
M*I*P*CVS) URI="https://marc.info/?l=openbsd-ports-cvs&s=${C}&q=b"; ;;
Zalando) URI="https://www.zalando.de/herren/?q=${C}"; ;;
*) exit 0 ;;
esac
}
# Which browser shall we use?
# EXPECTS: $URI $DMENU_CMD
# PROVIDES: $BROWSER
choose_browser() {
case "${URI}" in
gopher://*) DEFAULT="Lagrange (default)"; ;;
gemini://*) DEFAULT="Lagrange (default)"; ;;
*console.hetzner.cloud*) DEFAULT="Firefox (default)"; ;;
*youtube.com/watch*) DEFAULT="Mpv (default)"; ;;
*media.ccc.de/v/*) DEFAULT="Mpv (default)"; ;;
*.pdf|*.cb|*.ps) DEFAULT="Zathura (default)"; ;;
*.mp4|*.m4v|*.mkv) DEFAULT="Mpv (default)"; ;;
*) DEFAULT="$BROWSER (default)"; ;;
esac
local S="${DEFAULT}\nLuakit\nVimb\nFirefox\nChrome\nQutebrowser\nWyeb\nNetsurf\nTor-Browser\nDillo\nSurf\nMpv"
case $(echo "${S}" | ${DMENU_CMD} -p "Browser") in
[Nn]etsurf*) BROWSER=netsurf-gtk3 ;;
[Vv]imb*) BROWSER="vimb --no-maximize" ;;
[Dd]illo*) BROWSER=dillo; ;;
[Qq]uteb*r*) BROWSER="qutebrowser -R" ;;
[Ss]urf*) BROWSER=surf ;;
[Oo]tter*r*) BROWSER=otter-browser ;;
[Ll]uakit*) BROWSER="luakit -Un" ;;
[Cc]hrome*) BROWSER=chrome ;;
[Ff]irefox*) BROWSER=firefox ;;
[Tt]or-B*r*) BROWSER=tor-browser ;;
[Zz]athura*) BROWSER=zathura ;;
[Ll]agrange*) BROWSER=lagrange ;;
[Ww]yeb*) BROWSER=wyeb ;;
[Mm]pv*) BROWSER="mpv" ;;
*) exit 0;;
esac
}
save_history() {
printf '%s\n' "${INPUT}" | sed 's/^ *//g;s/ *$//g' >> "${HISTFILE}"
}
# main program starts here.
read_input
choose_wrapper
# choose_browser
save_history
$BROWSER "$(printf '%s' "${URI}" | sed 's/ /%20/g')" &

210
.bin/OLD/dexec_browser2 Executable file
View File

@@ -0,0 +1,210 @@
#!/bin/sh
# dexec_browser
# A multi browser launcher
#
# 1. choose input source
# (filtered-, full history, clipboad, manual entry)
# 2. choose how to handle the input
# (can suggest a matching default)
# 3. choose which browser to use
# (can suggest a matching default)
HISTFILE="${HOME}/.browser_history2"
test -f ${HOME}/.bin/_config \
&& . ${HOME}/.bin/_config \
|| DMENU_CMD=dmenu
test -f "${HISTFILE}" \
|| touch "${HISTFILE}"
HISTDATA="$(while IFS= read -r l; do echo "${#l} $((++n)) $l"; done \
< "${HISTFILE}" \
| sed 's|/$||;s|http[s]\{0,1\}://||' \
| sort -t\| -k 2 -u \
| sort -n \
| cut -d" " -f3-)"
PICKLIST="paste_from_clipboard
pick_from_history
edit_history_file
-----------------
$(echo "${HISTDATA}" \
| cut -b 23- \
| egrep -v ' |^[^a-zA-Z0-9]' \
| grep '..\...'\
)
http://localhost"
# show filtered history file
# EXPECTS: $PICKLIST $HISTFILE $DMENU_CMD
# PROVIDES: $INPUT
read_input() {
local S=$(printf '%s\n' "${PICKLIST}" \
| ${DMENU_CMD} -p "Bookmarks")
case "${S}" in
paste_from_clipboard)
S=$(xclip -o \
| head -n 1) ;;
pick_from_history)
S=$(sort -r "${HISTFILE}" \
| ${DMENU_CMD} -p "History:" \
|cut -b23-) ;;
edit_history_file)
texec "vim +\$ ${HISTFILE}"
dexec_browser
exit 0 ;;
esac
[ -z "${S}" ] && exit 0
INPUT="${S}"
}
# Decide how to open the thing
# EXPECTS: $INPUT $DMENU_CMD
# PROVIDES: $URI
choose_wrapper() {
local SE="OPEN URL
Amazon
CPAN
Crates.io
DuckDuckGo Web Search
DuckDuckGo Image Search
GLIB Documentation
Github
LibSOUP Documentation
Marc Info MessageID
Marc Info OpenBSD Misc List
Marc Info OpenBSD Ports CVS
Marc Info OpenBSD Ports List
Marc Info OpenBSD Tech List
PDF Viewer
SearX Web Search
SearX Image Search
Torrent Leech
Wikipedia DE
Wikipedia EN
InternetMovieDataBase (IMDB)
OpenStreetMap (OSM)
Grep.app
Google Maps
Youtube
Zalando"
local C="$(printf '%s' "${INPUT}" \
| head -n 1)"
case "${C}" in
*::*) DEFAULT="CPAN (default)"; ;;
http*) DEFAULT="OPEN (default)"; ;;
192.168.*) DEFAULT="OPEN (default)"; ;;
gopher*) DEFAULT="OPEN (default)"; ;;
g_*) DEFAULT="GLIB Documentation"; ;;
[Ss]oup_*) DEFAULT="LibSOUP Documentation"; ;;
www.*) DEFAULT="OPEN (default)"; ;;
\<*@*\>) DEFAULT="Marc Info Message ID (default)"; ;;
*.com|*.de|*.net|*.org) DEFAULT="OPEN (default)"; ;;
*.at|*.ch|*.social) DEFAULT="OPEN (default)"; ;;
*.io|*.sh|*.pw|*.party) DEFAULT="OPEN (default)"; ;;
*.coffee|*.me|*.cloud) DEFAULT="OPEN (default)"; ;;
*.[a-zA-Z]*/*) DEFAULT="OPEN (default)"; ;;
*) DEFAULT="DuckDuckGo Web Search (default)"; ;;
esac
local S="$(printf "%s\n%s" "${DEFAULT}" "${SE}" \
| ${DMENU_CMD} -p "Search Where?")"
C=$(echo "$C" | sed 's/ /%20/g')
case "${S}" in
OPEN*) URI="${C}"; ;;
Amazon*) URI="https://www.amazon.de/s?k=${C}"; ;;
CPAN*) URI="https://metacpan.org/search?q=${C}"; ;;
Crate*) URI="https://crates.io/search?q=${C}"; ;;
Grep*) URI="https://grep.app/search?q=${C}"; ;;
GLIB*) URI="https://docs.gtk.org/glib/flags.UriFlags.html?q=${C}"; ;;
LibSOUP*) URI="https://libsoup.org/libsoup-3.0/index.html?q=${C}"; ;;
Github) URI="https://github.com/search?q=${C}"; ;;
D*Web*) URI="https://html.duckduckgo.com/html?q=${C}"; ;;
D*Ima*) URI="https://duckduckgo.com/?q=${C}&iax=images&ia=images"; ;;
S*Web*) URI="https://searx.bar/search?q=${C}&category_general=on"; ;;
S*Ima*) URI="https://searx.bar/search?q=${C}&category_images=on"; ;;
Tor*Lee*) URI="https://www.torrentleech.org/torrents/browse/index/query/${C}"; ;;
W*DE*) URI="https://de.m.wikipedia.org/wiki/Spezial:Suche/${C}"; ;;
W*EN*) URI="https://en.m.wikipedia.org/wiki/Spezial:Search/${C}"; ;;
*IMDB*) URI="https://www.imdb.com/find?q=${C}"; ;;
O*S*M*) URI="https://www.openstreetmap.org/search?query=${C}"; ;;
G*Maps) URI="https://www.google.com/maps/place/${C}"; ;;
You*be) URI="https://m.youtube.com/results?sp=mAEA&search_query=${C}" ;;
M*I*ID*) URI="https://marc.info/?i=$(printf '%s' "${C}" | tr -d '<>')"; ;;
M*I*P*List) URI="https://marc.info/?l=openbsd-ports&s=${C}&q=b"; ;;
M*I*T*List) URI="https://marc.info/?l=openbsd-tech&s=${C}&q=b"; ;;
M*I*M*List) URI="https://marc.info/?l=openbsd-misc&s=${C}&q=b"; ;;
M*I*P*CVS) URI="https://marc.info/?l=openbsd-ports-cvs&s=${C}&q=b"; ;;
Zalando) URI="https://www.zalando.de/herren/?q=${C}"; ;;
*) exit 0 ;;
esac
}
# Which browser shall we use?
# EXPECTS: $URI $DMENU_CMD
# PROVIDES: $BROWSER
choose_browser() {
case "${URI}" in
gopher://*) DEFAULT="Lagrange (default)"; ;;
gemini://*) DEFAULT="Lagrange (default)"; ;;
*.pdf|*.cb|*.ps) DEFAULT="Zathura (default)"; ;;
192.168.*) DEFAULT="Chrome (default)"; ;;
*github.com*) DEFAULT="Chrome (default)"; ;;
*amazon.de*) DEFAULT="Chrome (default)"; ;;
*twitter.com*) DEFAULT="Chrome (default)"; ;;
*chaos.social*) DEFAULT="Chrome (default)"; ;;
*hetzner.cloud*) DEFAULT="Chrome (default)"; ;;
*hetzner.de*) DEFAULT="Chrome (default)"; ;;
*duckduckgo.com/*images*) DEFAULT="Chrome (default)"; ;;
*codevoid.de*) DEFAULT="Chrome (default)"; ;;
*google.*) DEFAULT="Chrome (default)"; ;;
*youtube.com*) DEFAULT="Chrome (default)"; ;;
*youtu.be*) DEFAULT="Chrome (default)"; ;;
*bsd.network*) DEFAULT="Chrome (default)"; ;;
*itch.io*) DEFAULT="Chrome (default)"; ;;
*chat.uugrn.org*) DEFAULT="Chrome (default)"; ;;
*[./]amazon.*) DEFAULT="Chrome (default)"; ;;
*comdirect.de*) DEFAULT="Chrome (default)"; ;;
*motorradfreunde-rheinneckar.de*) DEFAULT="Chrome (default)"; ;;
*polo-motorrad.com*) DEFAULT="Chrome (default)"; ;;
*peek-cloppenburg.de*) DEFAULT="Chrome (default)"; ;;
*asos.com*) DEFAULT="Chrome (default)"; ;;
*zalando.de*) DEFAULT="Chrome (default)"; ;;
*) DEFAULT="Chrome (default)"; ;;
esac
local S="${DEFAULT}\nLuakit\nFirefox\nChrome\nQutebrowser\nNetsurf\nTor-Browser"
case $(echo "${S}" | ${DMENU_CMD} -p "Browser") in
Netsurf*) BROWSER=netsurf-gtk3 ;;
Vimb*) BROWSER=vimb ;;
Quteb*r*) BROWSER=qutebrowser ;;
Surf*) BROWSER=surf ;;
Otter*r*) BROWSER=otter-browser ;;
Luakit*) BROWSER="luakit -Un" ;;
Chrome*) BROWSER=chrome ;;
Firefox*) BROWSER=firefox ;;
Tor-B*r*) BROWSER=tor-browser ;;
Zathura*) BROWSER=zathura ;;
Lagrange*) BROWSER=lagrange ;;
*) exit 0;;
esac
}
save_history() {
printf '%s %s\n' "$(date +"%Y-%m-%d %H:%M:%S |")" "${INPUT}" \
>> "${HISTFILE}"
}
# main program starts here.
read_input
choose_wrapper
choose_browser
save_history
exec $BROWSER "$(printf '%s' "${URI}" | sed 's/ /%20/g')"

186
.bin/OLD/dexec_browser3 Executable file
View File

@@ -0,0 +1,186 @@
#!/bin/sh
# dexec_browser
# A multi browser launcher
#
# 1. choose input source
# (filtered-, full history, clipboad, manual entry)
# 2. choose how to handle the input
# (can suggest a matching default)
# 3. choose which browser to use
# (can suggest a matching default)
HISTFILE="${HOME}/.browser_history"
test -f ${HOME}/.bin/_config \
&& . ${HOME}/.bin/_config \
|| DMENU_CMD=dmenu
test -f "${HISTFILE}" \
|| touch "${HISTFILE}"
PICKLIST="\
paste_from_clipboard
$(< "${HISTFILE}")
"
# show filtered history file
# EXPECTS: $PICKLIST $HISTFILE $DMENU_CMD
# PROVIDES: $INPUT
read_input() {
local S=$(printf '%s\n' "${PICKLIST}" \
| ${DMENU_CMD} -p "Bookmarks")
case "${S}" in
paste_from_clipboard)
S=$(xclip -o \
| head -n 1) ;;
esac
[ -z "${S}" ] && exit 0
INPUT="${S}"
}
# Decide how to open the thing
# EXPECTS: $INPUT $DMENU_CMD
# PROVIDES: $URI
choose_wrapper() {
local SE="OPEN URL
Amazon
CPAN
Crates.io
DuckDuckGo Web Search
DuckDuckGo Image Search
GLIB Documentation
Github
LibSOUP Documentation
Marc Info MessageID
Marc Info OpenBSD Misc List
Marc Info OpenBSD Ports CVS
Marc Info OpenBSD Ports List
Marc Info OpenBSD Tech List
PDF Viewer
SearX Web Search
SearX Image Search
Torrent Leech
Wikipedia DE
Wikipedia EN
InternetMovieDataBase (IMDB)
OpenStreetMap (OSM)
Grep.app
Google Maps
Youtube
Zalando"
local C="$(printf '%s' "${INPUT}" \
| head -n 1)"
case "${C}" in
*::*) DEFAULT="CPAN (default)"; ;;
http*) DEFAULT="OPEN (default)"; ;;
192.168.*) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
gopher*) DEFAULT="OPEN (default)"; ;;
g_*) DEFAULT="GLIB Documentation"; ;;
[Ss]oup_*) DEFAULT="LibSOUP Documentation"; ;;
www.*) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
\<*@*\>) DEFAULT="Marc Info Message ID (default)"; ;;
*.com|*.de|*.net|*.org) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
*.at|*.ch|*.social) DEFAULT="OPEN (default)"; C="http://${C}" ;;
*.io|*.sh|*.pw|*.party) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
*.coffee|*.me|*.cloud) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
*.[a-zA-Z]*/*) DEFAULT="OPEN (default)"; C="http://${C}"; ;;
*) DEFAULT="DuckDuckGo Web Search (default)"; ;;
esac
local S="$(printf "%s\n%s" "${DEFAULT}" "${SE}" \
| ${DMENU_CMD} -p "Search Where?")"
C=$(echo "$C" | sed 's/ /%20/g')
case "${S}" in
OPEN*) URI="${C}"; ;;
Amazon*) URI="https://www.amazon.de/s?k=${C}"; ;;
CPAN*) URI="https://metacpan.org/search?q=${C}"; ;;
Crate*) URI="https://crates.io/search?q=${C}"; ;;
Grep*) URI="https://grep.app/search?q=${C}"; ;;
GLIB*) URI="https://docs.gtk.org/glib/flags.UriFlags.html?q=${C}"; ;;
LibSOUP*) URI="https://libsoup.org/libsoup-3.0/index.html?q=${C}"; ;;
Github) URI="https://github.com/search?q=${C}"; ;;
D*Web*) URI="https://html.duckduckgo.com/html?q=${C}"; ;;
D*Ima*) URI="https://duckduckgo.com/?q=${C}&iax=images&ia=images"; ;;
S*Web*) URI="https://searx.bar/search?q=${C}&category_general=on"; ;;
S*Ima*) URI="https://searx.bar/search?q=${C}&category_images=on"; ;;
Tor*Lee*) URI="https://www.torrentleech.org/torrents/browse/index/query/${C}"; ;;
W*DE*) URI="https://de.m.wikipedia.org/wiki/Spezial:Suche/${C}"; ;;
W*EN*) URI="https://en.m.wikipedia.org/wiki/Spezial:Search/${C}"; ;;
*IMDB*) URI="https://www.imdb.com/find?q=${C}"; ;;
O*S*M*) URI="https://www.openstreetmap.org/search?query=${C}"; ;;
G*Maps) URI="https://www.google.com/maps/place/${C}"; ;;
You*be) URI="https://m.youtube.com/results?sp=mAEA&search_query=${C}" ;;
M*I*ID*) URI="https://marc.info/?i=$(printf '%s' "${C}" | tr -d '<>')"; ;;
M*I*P*List) URI="https://marc.info/?l=openbsd-ports&s=${C}&q=b"; ;;
M*I*T*List) URI="https://marc.info/?l=openbsd-tech&s=${C}&q=b"; ;;
M*I*M*List) URI="https://marc.info/?l=openbsd-misc&s=${C}&q=b"; ;;
M*I*P*CVS) URI="https://marc.info/?l=openbsd-ports-cvs&s=${C}&q=b"; ;;
Zalando) URI="https://www.zalando.de/herren/?q=${C}"; ;;
*) exit 0 ;;
esac
}
# Which browser shall we use?
# EXPECTS: $URI $DMENU_CMD
# PROVIDES: $BROWSER
choose_browser() {
case "${URI}" in
gopher://*) DEFAULT="Lagrange (default)"; ;;
gemini://*) DEFAULT="Lagrange (default)"; ;;
*.pdf|*.cb|*.ps) DEFAULT="Zathura (default)"; ;;
192.168.*) DEFAULT="Firefox (default)"; ;;
*github.com*) DEFAULT="Firefox (default)"; ;;
*amazon.de*) DEFAULT="Firefox (default)"; ;;
*twitter.com*) DEFAULT="Firefox (default)"; ;;
*chaos.social*) DEFAULT="Firefox (default)"; ;;
*hetzner.cloud*) DEFAULT="Firefox (default)"; ;;
*hetzner.de*) DEFAULT="Firefox (default)"; ;;
*duckduckgo.com/*images*) DEFAULT="Firefox (default)"; ;;
*codevoid.de*) DEFAULT="Firefox (default)"; ;;
*google.*) DEFAULT="Firefox (default)"; ;;
*youtube.com*) DEFAULT="Firefox (default)"; ;;
*youtu.be*) DEFAULT="Firefox (default)"; ;;
*bsd.network*) DEFAULT="Firefox (default)"; ;;
*itch.io*) DEFAULT="Firefox (default)"; ;;
*chat.uugrn.org*) DEFAULT="Firefox (default)"; ;;
*[./]amazon.*) DEFAULT="Firefox (default)"; ;;
*comdirect.de*) DEFAULT="Firefox (default)"; ;;
*motorradfreunde-rheinneckar.de*) DEFAULT="Firefox (default)"; ;;
*polo-motorrad.com*) DEFAULT="Firefox (default)"; ;;
*peek-cloppenburg.de*) DEFAULT="Firefox (default)"; ;;
*asos.com*) DEFAULT="Firefox (default)"; ;;
*zalando.de*) DEFAULT="Firefox (default)"; ;;
*) DEFAULT="Luakit (default)"; ;;
esac
local S="${DEFAULT}\nLuakit\nFirefox\nChrome\nQutebrowser\nNetsurf\nTor-Browser"
case $(echo "${S}" | ${DMENU_CMD} -p "Browser") in
Netsurf*) BROWSER=netsurf-gtk3 ;;
Vimb*) BROWSER=vimb ;;
Quteb*r*) BROWSER=qutebrowser ;;
Surf*) BROWSER=surf ;;
Otter*r*) BROWSER=otter-browser ;;
Luakit*) BROWSER="luakit -Un" ;;
Chrome*) BROWSER=chrome ;;
Firefox*) BROWSER=firefox ;;
Tor-B*r*) BROWSER=tor-browser ;;
Zathura*) BROWSER=zathura ;;
Lagrange*) BROWSER=lagrange ;;
*) exit 0;;
esac
}
save_history() {
printf '%s\n' "${INPUT}" >> "${HISTFILE}"
}
# main program starts here.
read_input
choose_wrapper
choose_browser
save_history
exec $BROWSER "$(printf '%s' "${URI}" | sed 's/ /%20/g')"

4
.bin/OLD/dexec_command Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh -x
. $HOME/.bin/_config
S="$($DMENU_CMD -p "Terminal:" < /dev/null)"
[ ! -z "$S" ] && sterm -e "ksh -ic \"$S\""

4
.bin/OLD/dexec_ding Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. $HOME/.bin/_config
D="$(echo "$(xclip -o)" | $DMENU_CMD -p Translate)"
[ ! -z "$D" ] && ding "$D"

4
.bin/OLD/dexec_edit Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. $HOME/.bin/_config
THING=$(ls -1 $HOME/.bin/edit/ | $DMENU_CMD -p Edit)
[ ! -z "$THING" ] && $HOME/.bin/edit/$THING

10
.bin/OLD/dexec_findwin Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
. $HOME/.bin/_config
WID=$(wmctrl -l | col -b \
| grep -v "^$" \
| awk '{printf("%s",$1);$1="";$2="";$3=""; print $0}' \
| $DMENU_CMD -p "Windows" \
| awk '{ print $1 }' \
)
[ -z "$WID" ] || wmctrl -i -a $WID

4
.bin/OLD/dexec_findwin.old Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. $HOME/.bin/_config
num=$(wmctrl -l | awk '{$1="";$2="";$3="";gsub(/ /,"_", $0);printf("%d - %s\n",NR,$0)}' | tr -s '_' | $DMENU_CMD -p "Windows" | cut -d"-" -f1)
[ -z "$num" ] || wmctrl -l | awk -v n="$num" 'NR==n { print $1 }' | xargs wmctrl -i -a

23
.bin/OLD/dexec_man Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
. $HOME/.bin/_config
MAN1=$(man -s1 -k .)
MAN2=$(man -s2 -k .)
MAN3=$(man -s3 -k .)
MAN4=$(man -s4 -k .)
MAN5=$(man -s5 -k .)
MAN6=$(man -s6 -k .)
MAN7=$(man -s7 -k .)
MAN8=$(man -s8 -k .)
MAN9=$(man -s9 -k .)
SEL=$(echo "$MAN1" "$MAN2" "$MAN3" "$MAN4" \
"$MAN5" "$MAN6" "$MAN7" "$MAN8" \
"$MAN9" "$MAN3P" | $DMENU_CMD -l 10 -p "Man")
[ -z "$SEL" ] && exit 0
N=$(echo "$SEL" | cut -d"(" -f2 | cut -d")" -f1)
M=$(echo "$SEL" | cut -d"(" -f1 | cut -d"," -f1)
sterm -e man -s $N $M

23
.bin/OLD/dexec_man.1 Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
. $HOME/.bin/_config
MAN1=$(man -s 1 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "1-"$1}')
MAN2=$(man -s 2 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "2-"$1}')
MAN3=$(man -s 3 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "3-"$1}')
MAN4=$(man -s 4 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "4-"$1}')
MAN5=$(man -s 5 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "5-"$1}')
MAN6=$(man -s 6 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "6-"$1}')
MAN7=$(man -s 7 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "7-"$1}')
MAN8=$(man -s 8 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "8-"$1}')
MAN9=$(man -s 9 -k . | awk -F" - " '{print $1}' | awk -F"(" '{print $1}' | tr -d ' ' | tr ',' '\n' | awk -F"(" '{print "9-"$1}')
MAN=$(printf '%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \
"$MAN1" "$MAN2" "$MAN3" "$MAN4" "$MAN5" "$MAN6" "$MAN7" "$MAN8" "$MAN9" \
| $DMENU_CMD -p "Manpage")
if [ ! -z "$MAN" ]; then
M="$(printf '%s' "$MAN" | cut -d"-" -f2)"
S="$(printf '%s' "$MAN" | cut -d"-" -f1)"
bterm -e man -s $S $M
fi

10
.bin/OLD/dexec_man.2 Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
. $HOME/.bin/_config
MAN="$(for i in $(jot 9 1); do man -s $i -k . | awk -v i=$i -F"(" '{ gsub(", ","\n"i"-",$1); print i"-"$1}'; done | while IFS= read -r l; do echo "${#l} $((++n)) $l"; done | sort -n -k 1 | cut -d" " -f3- | $DMENU_CMD -p "Manpage")"
if [ ! -z "$MAN" ]; then
M="$(printf '%s' "$MAN" | cut -d"-" -f2)"
S="$(printf '%s' "$MAN" | cut -d"-" -f1)"
bterm -e man -s "$S" "$M"
fi

11
.bin/OLD/dexec_pasteaction Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
. $HOME/.bin/_config
INPUT="$(xclip -r -o | tr -d "\n")"
SEL=$(printf "mpv $INPUT\nimv $INPUT" | $DMENU_CMD -l 20 -p "Page Action")
case $SEL in
mpv*) texec "mpv $INPUT"; ;;
imv*) texec "curl -s $INPUT | imv -"; ;;
esac

13
.bin/OLD/dexec_ssh.bak Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
. $HOME/.bin/_config
CONF=$(cat $HOME/.ssh/config| grep -Ei "^host" | grep -v '*' | cut -d" " -f2)
HOSTS=$(cat $HOME/.ssh/known_hosts | cut -d" " -f1 | tr ',' '\n')
HOST=$(printf '%s\n%s' "$CONF" "$HOSTS" | grep -v '=' | sort -ru | $DMENU_CMD -p SSH)
if [ ! -z "$HOST" ]; then
case "$HOST" in
*-sftp) texec "sftp $HOST"; ;;
*) texec "ssh $HOST"; ;;
esac
fi

23
.bin/OLD/dexec_ssh_favs Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
. ~/.bin/_config
HOST=$(echo "
barton.oldbsd.de
tweety.home.codevoid.de
gopher.codevoid.de
shell.codevoid.de
cvs.openbsd.org
shell.uugrn.org
mail2.uugrn.org
mail.codevoid.de
git.codevoid.de
fossil.codevoid.de
jabber.codevoid.de
chat.uugrn.org
www.uugrn.org
" | $DMENU_CMD -p SSH)
if [ ! -z "$HOST" ]; then
set -x
texec "ssh -tt $HOST 'LC_ALL=de_DE.UTF-8 tmux -u2 attach || LC_ALL=de_DE.UTF-8 tmux -u2'"
fi

78
.bin/OLD/dexec_super Executable file
View File

@@ -0,0 +1,78 @@
#!/bin/sh
. $HOME/.bin/_config
KEYS="\
cvs
dalek
git
github
inbox
make-web
mastodon
matrix
openbsd all
openbsd bugs
openbsd ports
openbsd tech
reddit
shell
telegram
telegram-desktop
tweety
vorstand
"
SEL=$(printf "$KEYS" | $DMENU_CMD -p "Next key" -b -l 20)
case "$SEL" in
dalek)
texec "ssh -t home.codevoid.de 'tmux -u attach || tmux -u'"
;;
tweety)
texec "ssh -t tweety.home.codevoid.de 'tmux -u attach || tmux -u'"
;;
cvs)
texec "ssh -t cvs.openbsd.org"
;;
vorstand)
texec "sftp vorstand@vorstand.uugrn.org"
;;
inbox)
texec "ksh -ic mutt"
;;
reddit)
texec "tuir"
;;
mastodon)
texec "tuta"
;;
*ports)
texec "ksh -ic mutt-openbsd-ports"
;;
*tech)
texec "ksh -ic mutt-openbsd-tech"
;;
*bugs)
texec "ksh -ic mutt-openbsd-bugs"
;;
github)
$BROWSER https://github.com/c0dev0id
;;
git)
$BROWSER https://git.uugrn.org/sdk
;;
make-web)
texec 'ssh home.codevoid.de "cd ~/make-web && make install"'
$BROWSER https://home.codevoid.de
;;
matrix)
texec "gomuks"
;;
telegram)
texec "tg"
;;
telegram-desktop)
telegram-desktop
;;
esac

4
.bin/OLD/dexec_term Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. $HOME/.bin/_config
S="$(dmenu_path | $DMENU_CMD -p "Terminal:")"
[ ! -z "$S" ] && sterm -e "ksh -ic \"$S\""

4
.bin/OLD/dexec_work Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. $HOME/.bin/_config
APP=$(ls -1 $HOME/.bin/work/ | $DMENU_CMD -p Work)
[ ! -z "$APP" ] && $HOME/.bin/work/$APP

14
.bin/OLD/diff-from-orig.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
find . -name "*.orig" | while read ORIG
do
FILE="${ORIG%*.orig}"
SIZE=$(stat $ORIG | awk '{print $8}')
if [ $SIZE -eq 0 ]
then
echo "full file: $FILE"
continue
fi
diff -u $ORIG $FILE
done

51
.bin/OLD/dlimage.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
# setup directories
DIR="$HOME/IMAGE"
COOKIE="$DIR/cookies.txt"
mkdir -p "$DIR"
# mask requests
UA="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36"
# add pictures from log
ssh shell.codevoid.de tail -n 80000 -f .irssi/url \
| grep -i http \
| while read line;
do
local C=$(tput cols)
local URL=$(printf '%s' "$line" | sed 's,.*\(http[^ ]*\),\1,g')
local TMP="$DIR/$(sha1 -qs "$URL")"
local MIME=""
# set the short URL to max terminal width
local SURL=$(printf '%s' "$URL" \
| awk -vC="$C" '{ line=substr($0,1,C-21) }
{ if (length($0) > C-21) print line"..."; else print $0 }')
# check if file has been handled previously
if stat -qnf "" "$TMP"* 2>&1 > /dev/null; then
printf '↷ (in cache) [%s]\n' "$SURL"
else
local MIME=$(curl -A "$UA" --connect-timeout 5 -sI "$URL" \
| grep -i "content-type:" | cut -d" " -f2 \
| cut -d";" -f1 | tr -d '\r')
local EXT=${MIME##*/}
case "$MIME" in
image/*)
printf '⇊ (%s) [%s]\n' "$MIME" "$SURL"
curl -Lc "$COOKIE" -b "$COOKIE" -A "$UA" \
-s "$URL" > "$TMP.$EXT"
;;
*)
if [ "$MIME" == "" ]; then MIME="???/???"; fi
printf '↷ (%s) [%s]\n' "$MIME" "$SURL"
if [[ x"$EXT" != "x" ]]; then
touch "$TMP.$EXT"
else
touch "$TMP.unknown"
fi
;;
esac
fi
done

8
.bin/OLD/dmark Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
doas touch /var/cache/dmark
doas chmod 666 /var/cache/dmark
if [ -f "$1" ]; then
doas readlink -f "$1" > /var/cache/dmark
else
echo 'devmark: file not found.'
fi

26
.bin/OLD/dock Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
INTERNAL=LVDS-1
CONLIST=$(xrandr --query | grep " connected" | awk '{ print $1 }' | grep -v $INTERNAL)
OFFLIST=$(xrandr --query | grep "disconnected" | awk '{ print $1 }')
if [ -z "$CONLIST" ]; then
printf 'No external displays found, activating %s\n' "$INTERNAL"
xrandr --output $INTERNAL --auto
else
printf 'External displays found, deactivating %s\n' "$INTERNAL"
xrandr --output $INTERNAL --off --noprimary
fi
for _dev in $OFFLIST;
do
printf 'Turning off disconnected output: %s\n' "$_dev"
xrandr --output $_dev --off
done
for _dev in $CONLIST;
do
printf 'Turning on connected output: %s\n' "$_dev"
xrandr --output $_dev --auto --primary
done

32
.bin/OLD/dopaste Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
. $HOME/.bin/_config
RPATH=/home/sdk/make-web/src/paste
SSH="sdk@home.codevoid.de"
WEB="https://ptrace.org"
f="$1"
if [ "$1" = "-h" ]; then
printf "Usage:\n"
printf " paste < text.txt - read from stdin, generate filename\n"
printf " paste new.txt < file.txt - read from stdin with filename\n"
printf " paste file.txt - upload file as is\n"
return 0
fi
if [ -z "$1" ]; then
f="$(date +"%Y-%m-%d_%M-%S")-$(pwgen -1 4 -A -0).txt"
ssh ${SSH} "printf \"%s\" \"$(cat)\" > ${RPATH}/$f"
elif [ -f "$f" ]; then
scp "$f" ${SSH}:"${RPATH}/${f##*/}"
else
ssh ${SSH} "printf \"%s\n\" \"$(cat)\" > ${RPATH}/${f##*/}"
fi
ssh ${SSH} "cd ~/make-web && make install"
printf "${WEB}/${f##*/}\n"
printf "${WEB}/${f##*/}" | xclip
[ -z $DISPLAY ] || notify-send "$(xclip -o)"

55
.bin/OLD/dopaste.orig Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/sh
. $HOME/.bin/_config
PSSH="${USER}@${DOMAIN}"
LOC="p"
f="$1"
if [ "$1" = "-h" ]; then
printf "Usage:\n"
printf " paste < text.txt - read from stdin, generate filename\n"
printf " paste new.txt < file.txt - read from stdin with filename\n"
printf " paste file.txt - upload file as is\n"
return 0
fi
if [ -z "$1" ]; then
f="$(date +"%Y-%m-%d_%M-%S")-$(pwgen -1 4 -A -0).txt"
ssh ${PSSH} "printf \"%s\" \"$(cat)\" > ${RPATH}/${LOC}/$f"
elif [ -f "$f" ]; then
scp "$f" ${PSSH}:"${RPATH}/${LOC}/${f##*/}"
else
ssh ${PSSH} "printf \"%s\n\" \"$(cat)\" > ${RPATH}/${LOC}/${f##*/}"
fi
SELECTOR="9"
# if data comes from stdin
if [ ! -t 0 ]; then
# it's always 0
SELECTOR="0"
else
# if a parmeter is given and it's a file
if [ -f "$f" ]; then
# determine type and set selector
case "$(file --mime-type -b "$f")" in
image/*) SELECTOR="I";;
text/*) SELECTOR="0";;
message/*) SELECTOR="0";;
*/x-shellscript) SELECTOR="0";;
*/pgp-keys) SELECTOR="0";;
esac
else
# parameter given, but not a file, must be cat then...
SELECTOR=0
fi
fi
printf "https://${DOMAIN}/${SELECTOR}/${LOC}/${f##*/}\n"
printf "https://${DOMAIN}/${SELECTOR}/${LOC}/${f##*/}" | xclip
# write paste history (for convenience and rmpaste)
printf "$(date +"%Y-%m-%d %M:%S")|$f\n" \
| ssh -q $PSSH "cat - >> $RPATH/${LOC}/.pastehistory"
[ -z $DISPLAY ] || notify-send "$(xclip -o)"

Some files were not shown because too many files have changed in this diff Show More