Update 2023-02-22 08:31 OpenBSD/amd64
This commit is contained in:
parent
1d3ee78382
commit
75fab8053a
4
.bin/12color.sh
Executable file
4
.bin/12color.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
fgbg=90
|
||||||
|
printf "\\e[${fgbg};5;%sm %3s \\e[0m" $fgbg
|
22
.bin/16colors.sh
Executable file
22
.bin/16colors.sh
Executable 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/256color.sh
Executable file
10
.bin/256color.sh
Executable 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
|
59
.bin/ascii
Executable file
59
.bin/ascii
Executable 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
|
||||||
|
|
18
.bin/avg.c
18
.bin/avg.c
@ -1,18 +0,0 @@
|
|||||||
#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;
|
|
||||||
}
|
|
13
.bin/backup
Executable file
13
.bin/backup
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. $HOME/.bin/_config
|
||||||
|
|
||||||
|
[ -d "$1" ] || ( printf "Usage: backup <target>\n" && exit 2; )
|
||||||
|
|
||||||
|
print "Tarsnap Backup:"
|
||||||
|
|
||||||
|
_target=$(readlink -f "$1")
|
||||||
|
_key=$(pwgen -n1 8)
|
||||||
|
_date=$(date "+%Y-%m-%d %H:%M")
|
||||||
|
_host=$(uname -n)
|
||||||
|
|
||||||
|
doas tarsnap --humanize-numbers --checkpoint-bytes 52428800 --exclude "*/.git/*" -cvf "$_host: $_target $_date ($_key)" "$_target"
|
15
.bin/bitshift
Executable file
15
.bin/bitshift
Executable 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
|
||||||
|
|
80
.bin/blog
Executable file
80
.bin/blog
Executable file
@ -0,0 +1,80 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. $HOME/.bin/_config
|
||||||
|
|
||||||
|
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$dash\n\nChangelog:\n* $date: Created\n" > "/tmp/tmp-$date-$1" && \
|
||||||
|
vim "/tmp/tmp-$date-$1" \
|
||||||
|
&& scp "/tmp/tmp-$date-$1" \
|
||||||
|
$USER@$DOMAIN:"$RPATH/posts/$date-$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
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.gph>\n" && return
|
||||||
|
printf "Opening $1\n"
|
||||||
|
local date=$(date +"%Y-%m-%d")
|
||||||
|
scp -q $USER@$DOMAIN:"$RPATH/posts/$1" "/tmp/tmp-$1" && \
|
||||||
|
printf "* $date: \n" >> "/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"
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
;;
|
||||||
|
*) usage;
|
||||||
|
exit 2;
|
||||||
|
;;
|
||||||
|
esac
|
32
.bin/bm
Executable file
32
.bin/bm
Executable 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
|
36
.bin/bpm-rename
Executable file
36
.bin/bpm-rename
Executable 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
|
11
.bin/cdrip2flac
Executable file
11
.bin/cdrip2flac
Executable 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
|
10
.bin/clipdl
Executable file
10
.bin/clipdl
Executable 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
|
||||||
|
|
||||||
|
|
||||||
|
|
7
.bin/clone
Normal file
7
.bin/clone
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
_thing="$(readlink -f $1)"
|
||||||
|
_remote="$2"
|
||||||
|
|
||||||
|
|
||||||
|
rsync -arvP $_think $_remote:$_thing
|
42
.bin/compress_maildir.sh
Executable file
42
.bin/compress_maildir.sh
Executable 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
|
12
.bin/cscope-update
Executable file
12
.bin/cscope-update
Executable 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/cv_motd
Executable file
24
.bin/cv_motd
Executable 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/cvs-log
Executable file
6
.bin/cvs-log
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cd /usr/ports/$1
|
||||||
|
|
||||||
|
cvs log -Nl -rHEAD 2>&1
|
||||||
|
tree
|
4
.bin/ddev
Executable file
4
.bin/ddev
Executable 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"
|
8
.bin/dev-continue
Executable file
8
.bin/dev-continue
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/ksh -i
|
||||||
|
f="$(cat /var/cache/dmark)"
|
||||||
|
cd "$(dirname "$f")"
|
||||||
|
|
||||||
|
owner="$(stat -f %Su "$f")"
|
||||||
|
doas chown sdk "$f"
|
||||||
|
vim "$f"
|
||||||
|
doas chown $owner "$f"
|
2
.bin/dev-cscope-go
Executable file
2
.bin/dev-cscope-go
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd /usr/src/sys && cscope -qkCRf /home/sdk/cscope.out "$@"
|
2
.bin/dev-cscope-go-definition
Executable file
2
.bin/dev-cscope-go-definition
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd /usr/src/sys && cscope -qkCRf /home/sdk/cscope.out -1 "$@"
|
2
.bin/dev-cscope-go-symbol
Executable file
2
.bin/dev-cscope-go-symbol
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd /usr/src/sys && cscope -qkCRf /home/sdk/cscope.out -0 "$@"
|
18
.bin/dev-dirs
Executable file
18
.bin/dev-dirs
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cd /usr/ports
|
||||||
|
|
||||||
|
[ ! -z "$1" ] && EXTRA="-q $1"
|
||||||
|
|
||||||
|
_ports=$(echo "SELECT PkgPath from Paths;" \
|
||||||
|
| sqlite3 /usr/local/share/sqlports \
|
||||||
|
| sort -u)
|
||||||
|
|
||||||
|
_list=$(find /usr/ports/mystuff/*/* /usr/src/*/* /usr/xenocara/*/* -type d -maxdepth 0)
|
||||||
|
|
||||||
|
echo "$_ports" "$_list" "/usr/src" "/usr/ports" "/usr/www" "/usr/xenocara" \
|
||||||
|
| grep -v "/CVS" \
|
||||||
|
| while IFS= read -r l; do echo "${#l} $((++n)) $l"; done \
|
||||||
|
| sort -n \
|
||||||
|
| cut -d" " -f3- \
|
||||||
|
| fzf $EXTRA -e -i -0 -1 +s --preview "tree {1}"
|
8
.bin/dev-fixrej
Executable file
8
.bin/dev-fixrej
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
for _f in $(find . -name "*.rej")
|
||||||
|
do
|
||||||
|
vim -O ${_f%*.rej} $_f
|
||||||
|
done
|
3
.bin/dev-grep-other-os
Executable file
3
.bin/dev-grep-other-os
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd /home/sdk/code \
|
||||||
|
&& ugrep -ir "$@" *-src
|
46
.bin/dev-here-openbsd
Executable file
46
.bin/dev-here-openbsd
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. ~/.bin/_config
|
||||||
|
doas chown -R sdk /home/sdk/.dev
|
||||||
|
set -xe
|
||||||
|
|
||||||
|
# save dev bookmark
|
||||||
|
DEVDIR="${PWD}"
|
||||||
|
echo "${DEVDIR}" > "/home/sdk/.dev/dir"
|
||||||
|
|
||||||
|
# create files list
|
||||||
|
find "${DEVDIR}" /usr/local/include /usr/xenocara/{lib,proto} -type f \
|
||||||
|
\( -name "*.c" \
|
||||||
|
-o -name "*.h" \
|
||||||
|
\) -not \
|
||||||
|
\( -path "*/gnu/*" \
|
||||||
|
-o -path "*/share/*" \
|
||||||
|
-o -path "*/alpha/*" \
|
||||||
|
-o -path "*/arm/*" \
|
||||||
|
-o -path "*/arm64/*" \
|
||||||
|
-o -path "*/armv7/*" \
|
||||||
|
-o -path "*/hppa/*" \
|
||||||
|
-o -path "*/i386/*" \
|
||||||
|
-o -path "*/landisk/*" \
|
||||||
|
-o -path "*/loongson/*" \
|
||||||
|
-o -path "*/luna88k/*" \
|
||||||
|
-o -path "*/m88k/*" \
|
||||||
|
-o -path "*/macppc/*" \
|
||||||
|
-o -path "*/mips64/*" \
|
||||||
|
-o -path "*/octeon/*" \
|
||||||
|
-o -path "*/powerpc/*" \
|
||||||
|
-o -path "*/powerpc64/*" \
|
||||||
|
-o -path "*/riscv64/*" \
|
||||||
|
-o -path "*/sh/*" \
|
||||||
|
-o -path "*/sparc64/*" \
|
||||||
|
\) > /home/sdk/.dev/files
|
||||||
|
|
||||||
|
# create cscope database
|
||||||
|
cscope -qbkCRvf /home/sdk/.dev/cscope.out -i/home/sdk/.dev/files
|
||||||
|
|
||||||
|
# create tags file
|
||||||
|
ectags --sort=yes \
|
||||||
|
--fields=afiksSt \
|
||||||
|
--extra=fq \
|
||||||
|
--totals=yes \
|
||||||
|
-L /home/sdk/.dev/files \
|
||||||
|
-f /home/sdk/.dev/tags
|
29
.bin/dev-portfiles
Executable file
29
.bin/dev-portfiles
Executable 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";
|
2
.bin/dev-portroach
Executable file
2
.bin/dev-portroach
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
portroach-cli -m codevoid
|
7
.bin/dev-search-ports-all
Executable file
7
.bin/dev-search-ports-all
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
ugrep --exclude-dir="CVS" \
|
||||||
|
--exclude-dir="pobj" \
|
||||||
|
--exclude-dir="distfiles" \
|
||||||
|
--recursive \
|
||||||
|
"$@" \
|
||||||
|
/usr/ports/
|
10
.bin/dev-search-ports-makefiles
Executable file
10
.bin/dev-search-ports-makefiles
Executable 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/
|
6
.bin/dev-search-ports-patches
Executable file
6
.bin/dev-search-ports-patches
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
ugrep --exclude-dir="CVS" \
|
||||||
|
--include="patch-*" \
|
||||||
|
--recursive \
|
||||||
|
"$@" \
|
||||||
|
/usr/ports/
|
6
.bin/dev-search-ports-plist
Executable file
6
.bin/dev-search-ports-plist
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
ugrep --exclude-dir="CVS" \
|
||||||
|
--include="PLIST*" \
|
||||||
|
--recursive \
|
||||||
|
"$@" \
|
||||||
|
/usr/ports/
|
5
.bin/dev-showdevelopers
Executable file
5
.bin/dev-showdevelopers
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
ssh sdk@cvs.openbsd.org 'fgrep -v ksh- /etc/passwd' \
|
||||||
|
| egrep 111\|122 | grep -v gitsync | cut -d: -f1,5 | tr -s ',' \
|
||||||
|
| sed 's/,/, /g;s/,[, ]*$//g' | column -s":" -t | fzf -i -e
|
||||||
|
|
8
.bin/dev-showdiff
Executable file
8
.bin/dev-showdiff
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
for _f in $(find . -name "*.orig")
|
||||||
|
do
|
||||||
|
vimdiff $_f ${_f%*.orig}
|
||||||
|
done
|
9
.bin/dev-showdiff-cvs
Executable file
9
.bin/dev-showdiff-cvs
Executable 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
|
11
.bin/dev-ugrep-sys
Executable file
11
.bin/dev-ugrep-sys
Executable 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/devs
Executable file
15
.bin/devs
Executable 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")"
|
4
.bin/dexec_findwin.old
Executable file
4
.bin/dexec_findwin.old
Executable 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/dexec_man.orig
Executable file
23
.bin/dexec_man.orig
Executable 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
|
11
.bin/dexec_pasteaction
Executable file
11
.bin/dexec_pasteaction
Executable 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/dexec_ssh.bak
Executable file
13
.bin/dexec_ssh.bak
Executable 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/dexec_ssh_favs
Executable file
23
.bin/dexec_ssh_favs
Executable 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
|
4
.bin/dexec_work
Executable file
4
.bin/dexec_work
Executable 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/diff-from-orig.sh
Executable file
14
.bin/diff-from-orig.sh
Executable 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
|
8
.bin/dmark
Executable file
8
.bin/dmark
Executable 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
|
6
.bin/documents-ocr
Executable file
6
.bin/documents-ocr
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#/bin/sh -xe
|
||||||
|
. ${HOME}/.bin/_config
|
||||||
|
|
||||||
|
cd ${PIMDIR}/documents/_incoming
|
||||||
|
|
||||||
|
find . -type f -maxdepth 1 -mindepth 1 -name "*.pdf" | xargs -P4 -n1 -I{} ocrmypdf -l deu $* "{}" "{}"
|
2
.bin/dsys
Executable file
2
.bin/dsys
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/ksh -i
|
||||||
|
cd /usr/src/sys && sterm "cscope -R -f /tmp/cscope.out"
|
3
.bin/dterm
Executable file
3
.bin/dterm
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh +x
|
||||||
|
. $HOME/.bin/_config
|
||||||
|
$STERM -T "term" $@
|
11
.bin/encode
Executable file
11
.bin/encode
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
ffmpeg -y -i "$1" \
|
||||||
|
-c:v libx264 \
|
||||||
|
-c:a aac \
|
||||||
|
-crf 21 \
|
||||||
|
-s 1920x1080 \
|
||||||
|
-preset fast \
|
||||||
|
-movflags faststart \
|
||||||
|
-threads 0 \
|
||||||
|
"${1%%.*}-enc.mp4" \
|
||||||
|
&& readlink -f "${1%%.*}-enc.mp4"
|
16
.bin/ext_ip_from_fritzbox.sh
Normal file
16
.bin/ext_ip_from_fritzbox.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
FRITZBOX="192.168.0.1"
|
||||||
|
|
||||||
|
PAYLOAD=\
|
||||||
|
'<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
<s:Body>
|
||||||
|
<u:GetExternalIPAddress xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1" />
|
||||||
|
</s:Body>
|
||||||
|
</s:Envelope>'
|
||||||
|
|
||||||
|
curl -s "http://$FRITZBOX:49000/igdupnp/control/WANIPConn1" \
|
||||||
|
-H "Content-Type: text/xml; charset=utf-8" \
|
||||||
|
-H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" \
|
||||||
|
-d "$PAYLOAD" | grep -Eo "\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>"
|
1122
.bin/findimagedupes
Executable file
1122
.bin/findimagedupes
Executable file
File diff suppressed because it is too large
Load Diff
8
.bin/gdb-get-backtrace
Executable file
8
.bin/gdb-get-backtrace
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
exe=$1
|
||||||
|
core=$2
|
||||||
|
gdb ${exe} \
|
||||||
|
--core ${core} \
|
||||||
|
--batch --quiet \
|
||||||
|
-ex "thread apply all bt full" \
|
||||||
|
-ex "quit";
|
71
.bin/hlsvideo.sh
Executable file
71
.bin/hlsvideo.sh
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
#!/bin/sh -xe
|
||||||
|
|
||||||
|
[ -z "$1" ] \
|
||||||
|
&& echo "usage: hlsvideo.sh video.mp4"
|
||||||
|
|
||||||
|
FULLPATH="$(readlink -f "$1")"
|
||||||
|
BASENAME="$(basename "$FULLPATH")"
|
||||||
|
NAME="${BASENAME%%.*}"
|
||||||
|
EXT="$(echo "${BASENAME##*.}" | tr '[:upper:]' '[:lower:]' )"
|
||||||
|
|
||||||
|
[ "$EXT" != "mp4" ] \
|
||||||
|
&& echo "Convert video to mp4 first"
|
||||||
|
|
||||||
|
mkdir -p "${NAME}"
|
||||||
|
cd "${NAME}"
|
||||||
|
|
||||||
|
#too slow.
|
||||||
|
# ffmpeg -i "${FULLPATH}" \
|
||||||
|
# -c:v libvpx-vp9 -crf 28 -b:v 4000k \
|
||||||
|
# -c:a libvorbis -qscale:a 5 \
|
||||||
|
# "${NAME}.webm"
|
||||||
|
|
||||||
|
ffmpeg -i "${FULLPATH}" \
|
||||||
|
-c:v libx264 -crf 28 -b:v 4000k \
|
||||||
|
-c:a aac -ar 44100 \
|
||||||
|
-profile:v baseline \
|
||||||
|
-level:v 13 \
|
||||||
|
-g 250 \
|
||||||
|
-r 25 \
|
||||||
|
-keyint_min 250 \
|
||||||
|
-strict experimental \
|
||||||
|
-b:a 128k \
|
||||||
|
-threads 0 \
|
||||||
|
-preset veryfast \
|
||||||
|
"${NAME}.mp4"
|
||||||
|
|
||||||
|
ffmpeg -i "$FULLPATH" \
|
||||||
|
-map 0:v:0 -map 0:a:0 \
|
||||||
|
-map 0:v:0 -map 0:a:0 \
|
||||||
|
-map 0:v:0 -map 0:a:0 \
|
||||||
|
-map 0:v:0 -map 0:a:0 \
|
||||||
|
-c:v libx264 -crf 28 -c:a aac -ar 44100 \
|
||||||
|
-filter:v:0 scale=w=480:h=360 -maxrate:v:0 600k -b:a:0 500k \
|
||||||
|
-filter:v:1 scale=w=640:h=480 -maxrate:v:1 1500k -b:a:1 1000k \
|
||||||
|
-filter:v:2 scale=w=1280:h=720 -maxrate:v:2 3000k -b:a:2 2000k \
|
||||||
|
-filter:v:3 scale=w=1920:h=1080 -maxrate:v:3 6000k -b:a:3 4000k \
|
||||||
|
-var_stream_map \
|
||||||
|
"v:0,a:0,name:360p v:1,a:1,name:480p v:2,a:2,name:720p v:3,a:3,name:1080p" \
|
||||||
|
-preset veryfast \
|
||||||
|
-hls_list_size 10 \
|
||||||
|
-threads 0 \
|
||||||
|
-f hls \
|
||||||
|
-hls_time 3 \
|
||||||
|
-hls_flags independent_segments \
|
||||||
|
-master_pl_name "${NAME}.m3u8" \
|
||||||
|
-y "${NAME}-%v.m3u8"
|
||||||
|
|
||||||
|
ffmpegthumbnailer -i "${FULLPATH}" -s 720 -o "${NAME}.jpg"
|
||||||
|
|
||||||
|
cat <<EOF > index.html
|
||||||
|
<h1>$NAME</h1>
|
||||||
|
<body>
|
||||||
|
<video width="720" poster="$NAME.jpg"
|
||||||
|
controls preload="none">
|
||||||
|
<source src="$NAME.m3u8"
|
||||||
|
type="application/vnd.apple.mpegurl">
|
||||||
|
<source src="$NAME.mp4"
|
||||||
|
type='video/mp4; codecs="avc1.42c00d,mp4a.40.2"'>
|
||||||
|
</video>
|
||||||
|
</body>
|
||||||
|
EOF
|
13
.bin/hostwatch
Executable file
13
.bin/hostwatch
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
_o=$_h
|
||||||
|
ping -qn -w1 -c1 $1 > /dev/null 2>&1
|
||||||
|
_h=$?
|
||||||
|
if [ x"$_o" != x"$_h" ];
|
||||||
|
then
|
||||||
|
[ $_h -eq 0 ] && echo "Host is up"
|
||||||
|
[ $_h -eq 1 ] && echo "Host is down"
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
done
|
44
.bin/hpaste
Executable file
44
.bin/hpaste
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# needs: col, date, pwgen, ssh, xclip, notify-send, tee, tr
|
||||||
|
|
||||||
|
# configuration
|
||||||
|
_ssh="sdk@codevoid.de"
|
||||||
|
_remote_dir="/home/www/htdocs/http/p"
|
||||||
|
_web_location="https://codevoid.de/h/p"
|
||||||
|
|
||||||
|
# handle -h parameter
|
||||||
|
if [ "$1" = "-h" ]; then
|
||||||
|
printf "Usage:\n"
|
||||||
|
printf " hpaste < text.txt - read from stdin, generate filename\n"
|
||||||
|
printf " hpaste new.txt < file.txt - read from stdin with filename\n"
|
||||||
|
printf " hpaste file.txt - upload file as is\n"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if there is no parameter: read STDIN
|
||||||
|
if [ -z "${1}" ]; then
|
||||||
|
# read stdin into some fancy file
|
||||||
|
_file="/tmp/$(date +"%Y-%m-%d_%M-%S")-$(pwgen -1 4 -A -0).txt"
|
||||||
|
cat > "${_file}"
|
||||||
|
# upload it
|
||||||
|
scp "${_file}" ${_ssh}:"${_remote_dir}/$(basename "${_file}")"
|
||||||
|
|
||||||
|
# we have a parameter, and it is a file
|
||||||
|
elif [ -f "${1}" ]; then
|
||||||
|
# normalize filename
|
||||||
|
_file="$(readlink -f "${1}")"
|
||||||
|
chmod 644 "${_file}"
|
||||||
|
scp "${_file}" ${_ssh}:"${_remote_dir}/$(basename "${_file}")"
|
||||||
|
|
||||||
|
# we have a parameter, but it is no file (let's read STDIN again, and
|
||||||
|
# use the parameter as filename)
|
||||||
|
else
|
||||||
|
_file="/tmp/$(printf '%s' "${1}" | col -b | tr -s ' /' '_' | head -n 1)"
|
||||||
|
cat > "${_file}"
|
||||||
|
scp "${_file}" ${_ssh}:"${_remote_dir}/$(basename "${_file}")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "${_web_location}/$(basename "${_file}")\n" \
|
||||||
|
| tee | tr -d '\n' | xclip -i
|
||||||
|
|
||||||
|
[ -z $DISPLAY ] || notify-send "$(xclip -o)"
|
294
.bin/ical2rem
Executable file
294
.bin/ical2rem
Executable file
@ -0,0 +1,294 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
my $debug = 0;
|
||||||
|
#
|
||||||
|
# ical2rem.pl -
|
||||||
|
# Reads iCal files and outputs remind-compatible files. Tested ONLY with
|
||||||
|
# calendar files created by Mozilla Calendar/Sunbird. Use at your own risk.
|
||||||
|
# Copyright (c) 2005, 2007, Justin B. Alcorn
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# version 0.5.2 2007-03-23
|
||||||
|
# - BUG: leadtime for recurring events had a max of 4 instead of DEFAULT_LEAD_TIME
|
||||||
|
# - remove project-lead-time, since Category was a non-standard attribute
|
||||||
|
# - NOTE: There is a bug in iCal::Parser v1.14 that causes multiple calendars to
|
||||||
|
# fail if a calendar with recurring events is followed by a calendar with no
|
||||||
|
# recurring events. This has been reported to the iCal::Parser author.
|
||||||
|
# version 0.5.1 2007-03-21
|
||||||
|
# - BUG: Handle multiple calendars on STDIN
|
||||||
|
# - add --heading option for priority on section headers
|
||||||
|
# version 0.5 2007-03-21
|
||||||
|
# - Add more help options
|
||||||
|
# - --project-lead-time option
|
||||||
|
# - Supress printing of heading if there are no todos to print
|
||||||
|
# version 0.4
|
||||||
|
# - Version 0.4 changes all written or inspired by, and thanks to Mark Stosberg
|
||||||
|
# - Change to GetOptions
|
||||||
|
# - Change to pipe
|
||||||
|
# - Add --label, --help options
|
||||||
|
# - Add Help Text
|
||||||
|
# - Change to subroutines
|
||||||
|
# - Efficiency and Cleanup
|
||||||
|
# version 0.3
|
||||||
|
# - Convert to GPL (Thanks to Mark Stosberg)
|
||||||
|
# - Add usage
|
||||||
|
# version 0.2
|
||||||
|
# - add command line switches
|
||||||
|
# - add debug code
|
||||||
|
# - add SCHED _sfun keyword
|
||||||
|
# - fix typos
|
||||||
|
# version 0.1 - ALPHA CODE.
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
cat /path/to/file*.ics | ical2rem.pl > ~/.ical2rem
|
||||||
|
|
||||||
|
All options have reasonable defaults:
|
||||||
|
--label Calendar name (Default: Calendar)
|
||||||
|
--lead-time Advance days to start reminders (Default: 3)
|
||||||
|
--todos, --no-todos Process Todos? (Default: Yes)
|
||||||
|
--heading Define a priority for static entries
|
||||||
|
--help Usage
|
||||||
|
--man Complete man page
|
||||||
|
|
||||||
|
Expects an ICAL stream on STDIN. Converts it to the format
|
||||||
|
used by the C<remind> script and prints it to STDOUT.
|
||||||
|
|
||||||
|
=head2 --label
|
||||||
|
|
||||||
|
ical2rem.pl --label "Bob's Calendar"
|
||||||
|
|
||||||
|
The syntax generated includes a label for the calendar parsed.
|
||||||
|
By default this is "Calendar". You can customize this with
|
||||||
|
the "--label" option.
|
||||||
|
|
||||||
|
=head2 --lead-time
|
||||||
|
|
||||||
|
ical2rem.pl --lead-time 3
|
||||||
|
|
||||||
|
How may days in advance to start getting reminders about the events. Defaults to 3.
|
||||||
|
|
||||||
|
=head2 --no-todos
|
||||||
|
|
||||||
|
ical2rem.pl --no-todos
|
||||||
|
|
||||||
|
If you don't care about the ToDos the calendar, this will surpress
|
||||||
|
printing of the ToDo heading, as well as skipping ToDo processing.
|
||||||
|
|
||||||
|
=head2 --heading
|
||||||
|
|
||||||
|
ical2rem.pl --heading "PRIORITY 9999"
|
||||||
|
|
||||||
|
Set an option on static messages output. Using priorities can made the static messages look different from
|
||||||
|
the calendar entries. See the file defs.rem from the remind distribution for more information.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use iCal::Parser;
|
||||||
|
use DateTime;
|
||||||
|
use Getopt::Long 2.24 qw':config auto_help';
|
||||||
|
use Pod::Usage;
|
||||||
|
use Data::Dumper;
|
||||||
|
use vars '$VERSION';
|
||||||
|
$VERSION = "0.5.2";
|
||||||
|
|
||||||
|
# Declare how many days in advance to remind
|
||||||
|
my $DEFAULT_LEAD_TIME = 3;
|
||||||
|
my $PROCESS_TODOS = 1;
|
||||||
|
my $HEADING = "";
|
||||||
|
my $help;
|
||||||
|
my $man;
|
||||||
|
|
||||||
|
my $label = 'Calendar';
|
||||||
|
GetOptions (
|
||||||
|
"label=s" => \$label,
|
||||||
|
"lead-time=i" => \$DEFAULT_LEAD_TIME,
|
||||||
|
"todos!" => \$PROCESS_TODOS,
|
||||||
|
"heading=s" => \$HEADING,
|
||||||
|
"help|?" => \$help,
|
||||||
|
"man" => \$man
|
||||||
|
);
|
||||||
|
pod2usage(1) if $help;
|
||||||
|
pod2usage(-verbose => 2) if $man;
|
||||||
|
|
||||||
|
my $month = ['None','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
|
||||||
|
|
||||||
|
my @calendars;
|
||||||
|
my $in;
|
||||||
|
|
||||||
|
while (<>) {
|
||||||
|
$in .= $_;
|
||||||
|
if (/END:VCALENDAR/) {
|
||||||
|
push(@calendars,$in);
|
||||||
|
$in = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print STDERR "Read all calendars\n" if $debug;
|
||||||
|
my $startdate = DateTime->new( year => 2010,
|
||||||
|
month => 4,
|
||||||
|
day => 1,
|
||||||
|
time_zone => 'US/Eastern',
|
||||||
|
);
|
||||||
|
my $oneyear = DateTime::Duration->new( years => 1);
|
||||||
|
my $oneweek = DateTime::Duration->new( weeks => -1);
|
||||||
|
$startdate = DateTime->now + $oneweek;
|
||||||
|
my $enddate = DateTime->now + $oneyear;
|
||||||
|
print STDERR "About to parse calendars\n" if $debug;
|
||||||
|
my $parser = iCal::Parser->new('start' => $startdate,
|
||||||
|
'debug' => 0,
|
||||||
|
'end' => $enddate);
|
||||||
|
my $hash = $parser->parse_strings(@calendars);
|
||||||
|
print STDERR "Calendars parsed\n" if $debug;
|
||||||
|
|
||||||
|
##############################################################
|
||||||
|
#
|
||||||
|
# Subroutines
|
||||||
|
#
|
||||||
|
#############################################################
|
||||||
|
#
|
||||||
|
# _process_todos()
|
||||||
|
# expects 'todos' hashref from iCal::Parser is input
|
||||||
|
# returns String to output
|
||||||
|
sub _process_todos {
|
||||||
|
my $todos = shift;
|
||||||
|
|
||||||
|
my ($todo, @newtodos, $leadtime);
|
||||||
|
my $output = "";
|
||||||
|
|
||||||
|
$output .= 'REM '.$HEADING.' MSG '.$label.' ToDos:%"%"%'."\n";
|
||||||
|
|
||||||
|
# For sorting, make sure everything's got something
|
||||||
|
# To sort on.
|
||||||
|
my $now = DateTime->now;
|
||||||
|
for $todo (@{$todos}) {
|
||||||
|
# remove completed items
|
||||||
|
if ($todo->{'STATUS'} && $todo->{'STATUS'} eq 'COMPLETED') {
|
||||||
|
next;
|
||||||
|
} elsif ($todo->{'DUE'}) {
|
||||||
|
# All we need is a due date, everything else is sugar
|
||||||
|
$todo->{'SORT'} = $todo->{'DUE'}->clone;
|
||||||
|
} elsif ($todo->{'DTSTART'}) {
|
||||||
|
# for sorting, sort on start date if there's no due date
|
||||||
|
$todo->{'SORT'} = $todo->{'DTSTART'}->clone;
|
||||||
|
} else {
|
||||||
|
# if there's no due or start date, just make it now.
|
||||||
|
$todo->{'SORT'} = $now;
|
||||||
|
}
|
||||||
|
push(@newtodos,$todo);
|
||||||
|
}
|
||||||
|
if (! (scalar @newtodos)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
# Now sort on the new Due dates and print them out.
|
||||||
|
for $todo (sort { DateTime->compare($a->{'SORT'}, $b->{'SORT'}) } @newtodos) {
|
||||||
|
my $due = $todo->{'SORT'}->clone();
|
||||||
|
my $priority = "";
|
||||||
|
if (defined($todo->{'PRIORITY'})) {
|
||||||
|
if ($todo->{'PRIORITY'} == 1) {
|
||||||
|
$priority = "PRIORITY 1000";
|
||||||
|
} elsif ($todo->{'PRIORITY'} == 3) {
|
||||||
|
$priority = "PRIORITY 7500";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (defined($todo->{'DTSTART'}) && defined($todo->{'DUE'})) {
|
||||||
|
# Lead time is duration of task + lead time
|
||||||
|
my $diff = ($todo->{'DUE'}->delta_days($todo->{'DTSTART'})->days())+$DEFAULT_LEAD_TIME;
|
||||||
|
$leadtime = "+".$diff;
|
||||||
|
} else {
|
||||||
|
$leadtime = "+".$DEFAULT_LEAD_TIME;
|
||||||
|
}
|
||||||
|
$output .= "REM ".$due->month_abbr." ".$due->day." ".$due->year." $leadtime $priority MSG \%a $todo->{'SUMMARY'}\%\"\%\"\%\n";
|
||||||
|
}
|
||||||
|
$output .= 'REM '.$HEADING.' MSG %"%"%'."\n";
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
#
|
||||||
|
# Main Program
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
print _process_todos($hash->{'todos'}) if $PROCESS_TODOS;
|
||||||
|
|
||||||
|
my ($leadtime, $yearkey, $monkey, $daykey,$uid,%eventsbyuid);
|
||||||
|
print 'REM '.$HEADING.' MSG '.$label.' Events:%"%"%'."\n";
|
||||||
|
my $events = $hash->{'events'};
|
||||||
|
foreach $yearkey (sort keys %{$events} ) {
|
||||||
|
my $yearevents = $events->{$yearkey};
|
||||||
|
foreach $monkey (sort {$a <=> $b} keys %{$yearevents}){
|
||||||
|
my $monevents = $yearevents->{$monkey};
|
||||||
|
foreach $daykey (sort {$a <=> $b} keys %{$monevents} ) {
|
||||||
|
my $dayevents = $monevents->{$daykey};
|
||||||
|
foreach $uid (sort {
|
||||||
|
DateTime->compare($dayevents->{$a}->{'DTSTART'}, $dayevents->{$b}->{'DTSTART'})
|
||||||
|
} keys %{$dayevents}) {
|
||||||
|
my $event = $dayevents->{$uid};
|
||||||
|
if ($eventsbyuid{$uid}) {
|
||||||
|
my $curreventday = $event->{'DTSTART'}->clone;
|
||||||
|
$curreventday->truncate( to => 'day' );
|
||||||
|
$eventsbyuid{$uid}{$curreventday->epoch()} =1;
|
||||||
|
for (my $i = 0;$i < $DEFAULT_LEAD_TIME && !defined($event->{'LEADTIME'});$i++) {
|
||||||
|
if ($eventsbyuid{$uid}{$curreventday->subtract( days => $i+1 )->epoch() }) {
|
||||||
|
$event->{'LEADTIME'} = $i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$eventsbyuid{$uid} = $event;
|
||||||
|
my $curreventday = $event->{'DTSTART'}->clone;
|
||||||
|
$curreventday->truncate( to => 'day' );
|
||||||
|
$eventsbyuid{$uid}{$curreventday->epoch()} =1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach $yearkey (sort keys %{$events} ) {
|
||||||
|
my $yearevents = $events->{$yearkey};
|
||||||
|
foreach $monkey (sort {$a <=> $b} keys %{$yearevents}){
|
||||||
|
my $monevents = $yearevents->{$monkey};
|
||||||
|
foreach $daykey (sort {$a <=> $b} keys %{$monevents} ) {
|
||||||
|
my $dayevents = $monevents->{$daykey};
|
||||||
|
foreach $uid (sort {
|
||||||
|
DateTime->compare($dayevents->{$a}->{'DTSTART'}, $dayevents->{$b}->{'DTSTART'})
|
||||||
|
} keys %{$dayevents}) {
|
||||||
|
my $event = $dayevents->{$uid};
|
||||||
|
if (exists($event->{'LEADTIME'})) {
|
||||||
|
$leadtime = "+".$event->{'LEADTIME'};
|
||||||
|
} else {
|
||||||
|
$leadtime = "+".$DEFAULT_LEAD_TIME;
|
||||||
|
}
|
||||||
|
my $start = $event->{'DTSTART'};
|
||||||
|
print "REM ".$start->month_abbr." ".$start->day." ".$start->year." $leadtime ";
|
||||||
|
if ($start->hour > 0) {
|
||||||
|
print " AT ";
|
||||||
|
print $start->strftime("%H:%M");
|
||||||
|
print " SCHED _sfun MSG %a %2 ";
|
||||||
|
} else {
|
||||||
|
print " MSG %a ";
|
||||||
|
}
|
||||||
|
print "%\"$event->{'SUMMARY'}";
|
||||||
|
print " at $event->{'LOCATION'}" if $event->{'LOCATION'};
|
||||||
|
print "\%\"%\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit 0;
|
||||||
|
#:vim set ft=perl ts=4 sts=4 expandtab :
|
4
.bin/icb-tunnel
Executable file
4
.bin/icb-tunnel
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/ksh
|
||||||
|
pkill -f "7326:localhost:7326 anonicb@slackers.openbsd.org"
|
||||||
|
sleep 1
|
||||||
|
ssh -fN -o ServerAliveInterval=15 -L 7326:localhost:7326 anonicb@slackers.openbsd.org
|
3
.bin/ipmi-tweety
Executable file
3
.bin/ipmi-tweety
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
ipmitool -U ADMIN -P $(pass Local/TweetyIPMI | head -1) \
|
||||||
|
-I lanplus -H 192.168.1.21 $@;
|
31
.bin/ksh-update-completions
Executable file
31
.bin/ksh-update-completions
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/ksh
|
||||||
|
|
||||||
|
rm -f "${HOME}/.ksh-complete"
|
||||||
|
|
||||||
|
add() { ( printf '%s %s' "$1" "$2" | tr '\n' ' '; printf '\n') >> "${HOME}/.ksh-complete"; }
|
||||||
|
|
||||||
|
if [ -d ~/.password-store ]; then
|
||||||
|
ARGS="$(cd ~/.password-store && ls -1d */* | sed 's/\.gpg$//g;s/ /\\ /g')"
|
||||||
|
add "set -A complete_pass -- edit insert show rm cp mv search find " "$ARGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f ${HOME}/.ssh/config ]; then
|
||||||
|
add "set -A complete_ssh -- " "$(awk '/^Host .*/ { print $2 }' ${HOME}/.ssh/config)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
add "set -A complete_kill_1 -- " "-9 -HUP -INFO -KILL -TERM"
|
||||||
|
add "set -A complete_ifconfig_1 -- " "$(ifconfig | grep ^[a-z] | cut -d: -f1)"
|
||||||
|
add "set -A complete_amused_1 -- " "add flush jump load monitor next pause play prev repeat restart show status stop toggle"
|
||||||
|
add "set -A complete_got_1 -- " "$(got -h 2>&1 | sed -n s/commands://p)"
|
||||||
|
|
||||||
|
ARGS="install uninstall test update-patches update-plist lib-depends-check port-lib-depends-check clean show="
|
||||||
|
add "set -A complete_make_1 -- " "$ARGS"
|
||||||
|
|
||||||
|
ARGS="reload restart stop start disable enable ls"
|
||||||
|
add "set -A complete_rcctl_1 -- " "$ARGS"
|
||||||
|
add "set -A complete_rcctl_2 -- " "$(rcctl ls all)"
|
||||||
|
add "set -A complete_got_1 -- " "$(got -h 2>&1 | sed -n s/commands://p)"
|
||||||
|
|
||||||
|
add "set -A complete_cg -- " "bitreich cufflink efnet hackint ircnet liberachat oftc robustirc uugrn"
|
||||||
|
|
||||||
|
add "set -A complete_man -- " "port-modules bsd.port.mk ports packages dpb make ffmpeg-complete mpv cabal-module cargo-module go-module gnome-module python-module qmake-module ruby-module cargo"
|
33
.bin/motd.sh
Normal file
33
.bin/motd.sh
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
OS=$(uname -s)
|
||||||
|
OSVER=$(uname -r)
|
||||||
|
OSARCH=$(uname -m)
|
||||||
|
|
||||||
|
CPUS=$(sysctl -n hw.ncpufound)
|
||||||
|
CPUMODEL=$(sysctl -n hw.model)
|
||||||
|
CPUSPEED=$(sysctl -n hw.cpuspeed)
|
||||||
|
|
||||||
|
MEM=$(printf "$(sysctl -n hw.physmem)/1024/1024\n" | bc)
|
||||||
|
|
||||||
|
INET=$(ifconfig vio0 | grep "inet")
|
||||||
|
[ -z "$INET" ] && INET=$(ifconfig em0 | grep "inet")
|
||||||
|
[ -z "$INET" ] && INET=$(ifconfig bge0 | grep "inet")
|
||||||
|
|
||||||
|
printf '%s\n' ' ___ _____ ____ ____ _ _ _____ ____ ____
|
||||||
|
/ __)( _ )( _ \( ___)( \/ )( _ )(_ _)( _ \
|
||||||
|
( (__ )(_)( )(_) ))__) \ / )(_)( _)(_ )(_) )
|
||||||
|
\___)(_____)(____/(____) \/ (_____)(____)(____/
|
||||||
|
'
|
||||||
|
|
||||||
|
printf " OS: %s" "$OS"
|
||||||
|
printf " Version: %s" "$OSVER"
|
||||||
|
printf " Architecture: %s\n" "$OSARCH"
|
||||||
|
|
||||||
|
printf " CPU: %s\n" "${CPUS}x $CPUMODEL"
|
||||||
|
printf " SPEED: %s" "${CPUSPEED}Mhz"
|
||||||
|
printf " Memory: %s\n\n" "${MEM}MB"
|
||||||
|
|
||||||
|
printf " Interfaces:\n %s\n\n" "$INET"
|
||||||
|
|
||||||
|
printf " Welcome to $(hostname)\n\n"
|
6
.bin/mutt-find
Executable file
6
.bin/mutt-find
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -ex
|
||||||
|
local LINKDIR="$HOME/.cache/mu/results"
|
||||||
|
mu find --clearlinks --format=links --linksdir=$LINKDIR "$@"
|
||||||
|
mutt -F $HOME/.mutt/rc-account-private -f $LINKDIR
|
||||||
|
rm -rf $LINKDIR;
|
61
.bin/obsd-vm
Executable file
61
.bin/obsd-vm
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
VM=openbsd.codevoid.de
|
||||||
|
|
||||||
|
restore() {
|
||||||
|
[ -z "${ID}" ] && exit 2
|
||||||
|
hcloud server rebuild \
|
||||||
|
--image ${ID} ${VM}
|
||||||
|
sleep 2
|
||||||
|
hcloud server poweron ${VM}
|
||||||
|
}
|
||||||
|
delete() {
|
||||||
|
[ -z "${ID}" ] && exit 2
|
||||||
|
printf "Selected:\n%s - %s" "${ID}" "${DESCR}"
|
||||||
|
printf "Are you sure [y/N]? "
|
||||||
|
read -r _sure
|
||||||
|
case $_sure in
|
||||||
|
[yY]) hcloud image delete "${ID}"; ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
save() {
|
||||||
|
printf "Description: "
|
||||||
|
read -r _desc
|
||||||
|
hcloud server create-image ${VM} \
|
||||||
|
--type snapshot \
|
||||||
|
--description "${_desc}"
|
||||||
|
sleep 2
|
||||||
|
hcloud server poweron ${VM}
|
||||||
|
}
|
||||||
|
|
||||||
|
list() {
|
||||||
|
hcloud image list \
|
||||||
|
-o columns=id,description \
|
||||||
|
-o noheader \
|
||||||
|
-t snapshot
|
||||||
|
}
|
||||||
|
|
||||||
|
console() {
|
||||||
|
hcloud server request-console ${VM}
|
||||||
|
}
|
||||||
|
|
||||||
|
get_info() {
|
||||||
|
SEL=$(list | fzf)
|
||||||
|
[ -z "${SEL}" ] && exit 2
|
||||||
|
ID="$(echo "$SEL" | cut -d" " -f1)"
|
||||||
|
DESCR="$(echo "$SEL" | cut -d" " -f2- | sed 's/^ *//')"
|
||||||
|
}
|
||||||
|
|
||||||
|
# MAIN PROGRAM
|
||||||
|
ACTION="$(printf "quit\nturn vm off\nturn vm on\nget console\ndelete snapshot\ncreate snapshot\nrestore vm" | fzf --header="Action for ${VM}")"
|
||||||
|
|
||||||
|
case $ACTION in
|
||||||
|
delete*) get_info && delete; ;;
|
||||||
|
restore*) get_info && restore; ;;
|
||||||
|
create*) save; ;;
|
||||||
|
*console) console; ;;
|
||||||
|
turn*on) hcloud server poweron ${VM}; exit 0; ;;
|
||||||
|
turn*off) hcloud server poweroff ${VM}; exit 0; ;;
|
||||||
|
esac
|
||||||
|
|
123
.bin/obsdmake
Executable file
123
.bin/obsdmake
Executable file
@ -0,0 +1,123 @@
|
|||||||
|
#!/bin/ksh -xe
|
||||||
|
umask 022
|
||||||
|
|
||||||
|
JOBS="${JOBS:=$(sysctl -n hw.ncpuonline)}"
|
||||||
|
export MAKE_JOBS="$JOBS"
|
||||||
|
|
||||||
|
|
||||||
|
export GLOBAL_AUTOCONF_CACHE="/var/ccache/config.cache"
|
||||||
|
export CCACHE_DIR="/var/ccache"
|
||||||
|
export CCACHE_SLOPPINESS="locale,time_macros,random_seed"
|
||||||
|
|
||||||
|
# base llvm?
|
||||||
|
export LLVM_CCACHE_DIR="/var/ccache"
|
||||||
|
export CMAKE_CXX_COMPILER_LAUNCHER="ccache"
|
||||||
|
export CMAKE_C_COMPILER_LAUNCHER="ccache"
|
||||||
|
|
||||||
|
FLAGS="-fno-ret-protector -mno-retpoline -march=native"
|
||||||
|
export CC="/opt/ccache/bin/cc $FLAGS"
|
||||||
|
export CXX="/opt/ccache/bin/c++ $FLAGS"
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: ${0} [kernel, base, xenocara, release, all] [clean]"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
doas mkdir -p /usr/obj /usr/xobj
|
||||||
|
doas chown build /usr/obj /usr/xobj
|
||||||
|
|
||||||
|
mkkernel() {
|
||||||
|
set -xe
|
||||||
|
cd /sys/arch/$(machine)/compile/GENERIC.MP
|
||||||
|
doas make clean
|
||||||
|
doas make obj
|
||||||
|
doas make config
|
||||||
|
time doas -u build make -j${JOBS}
|
||||||
|
doas make install
|
||||||
|
}
|
||||||
|
|
||||||
|
mkbase() {
|
||||||
|
set -xe
|
||||||
|
cd /usr/src
|
||||||
|
doas make obj
|
||||||
|
doas make -j${JOBS} build
|
||||||
|
doas make install
|
||||||
|
doas sysmerge
|
||||||
|
cd /dev
|
||||||
|
doas ./MAKEDEV all
|
||||||
|
}
|
||||||
|
|
||||||
|
mkxenocara() {
|
||||||
|
set -xe
|
||||||
|
cd /usr/xenocara
|
||||||
|
doas make clean
|
||||||
|
doas make bootstrap
|
||||||
|
doas make obj
|
||||||
|
doas make -j${JOBS} build
|
||||||
|
doas make install
|
||||||
|
}
|
||||||
|
|
||||||
|
mkrelease() {
|
||||||
|
set -xe
|
||||||
|
doas mkdir -p /data/{OpenBSD,Release}
|
||||||
|
doas chown -R build /data
|
||||||
|
doas chmod -R 700 /data
|
||||||
|
|
||||||
|
export DESTDIR=/data/OpenBSD
|
||||||
|
export RELEASEDIR=/data/Release
|
||||||
|
export RELDIR=/data/Release
|
||||||
|
export RELXDIR=/data/Release
|
||||||
|
|
||||||
|
cd /usr/src/etc
|
||||||
|
doas make release
|
||||||
|
cd /usr/src/distrib/sets
|
||||||
|
doas sh checkflist
|
||||||
|
|
||||||
|
cd /usr/xenocara
|
||||||
|
doas make release
|
||||||
|
doas make checkdist
|
||||||
|
|
||||||
|
cd /usr/src/distrib/$(machine)/iso
|
||||||
|
doas make
|
||||||
|
doas make install
|
||||||
|
}
|
||||||
|
|
||||||
|
kernelclean() {
|
||||||
|
cd /usr/src && doas make clean
|
||||||
|
}
|
||||||
|
baseclean() {
|
||||||
|
doas rm -rf /usr/obj/{,.}*
|
||||||
|
}
|
||||||
|
xenocaraclean() {
|
||||||
|
doas rm -rf /usr/xobj/{,.}*
|
||||||
|
}
|
||||||
|
releaseclean() {
|
||||||
|
doas rm -rf /data/OpenBSD/{,.}*
|
||||||
|
doas rm -rf /data/Release/{,.}*
|
||||||
|
}
|
||||||
|
allclean() {
|
||||||
|
kernelclean
|
||||||
|
baseclean
|
||||||
|
xenocaraclean
|
||||||
|
releaseclean
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$2" == "clean" ]; then
|
||||||
|
case "$1" in
|
||||||
|
kernel) kernelclean; ;;
|
||||||
|
base) baseclean; ;;
|
||||||
|
xenocara) xenocaraclean; ;;
|
||||||
|
release) releaseclean; ;;
|
||||||
|
all) allclean; ;;
|
||||||
|
esac
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
kernel) mkkernel; ;;
|
||||||
|
base) mkbase; ;;
|
||||||
|
xenocara) mkxenocara; ;;
|
||||||
|
release) mkrelease; ;;
|
||||||
|
all) mkkernel; mkbase; mkxenocara; ;;
|
||||||
|
esac
|
||||||
|
sync
|
19
.bin/pass-add
Executable file
19
.bin/pass-add
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
echo "Usage: pass-add Folder/page.de username"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
_file="${1}"
|
||||||
|
_login="${2}"
|
||||||
|
_password="$(pwgen -syn -r "{}'\\§()°\`|[]\";" 16 1)"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "$_password";
|
||||||
|
echo "login: $_login";
|
||||||
|
} | pass insert -m "${_file}"
|
||||||
|
|
||||||
|
echo "======="
|
||||||
|
|
||||||
|
pass "${_file}"
|
11
.bin/passmenu
Executable file
11
.bin/passmenu
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
shopt -s nullglob globstar
|
||||||
|
|
||||||
|
prefix=${PASSWORD_STORE_DIR-~/.password-store}
|
||||||
|
password_files=( "$prefix"/**/*.gpg )
|
||||||
|
password_files=( "${password_files[@]#"$prefix"/}" )
|
||||||
|
password_files=( "${password_files[@]%.gpg}" )
|
||||||
|
password=$(printf '%s\n' "${password_files[@]}" | fzf)
|
||||||
|
|
||||||
|
[[ -n $password ]] || exit
|
||||||
|
pass "$password"
|
18
.bin/passmenu-edit
Executable file
18
.bin/passmenu-edit
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
shopt -s nullglob globstar
|
||||||
|
|
||||||
|
prefix=${PASSWORD_STORE_DIR-~/.password-store}
|
||||||
|
|
||||||
|
password_files=( "$prefix"/**/*.gpg )
|
||||||
|
password_files=( "${password_files[@]#"$prefix"/}" )
|
||||||
|
password_files=( "${password_files[@]%.gpg}" )
|
||||||
|
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
password=$(printf '%s\n' "${password_files[@]}" | fzf)
|
||||||
|
|
||||||
|
[[ -n $password ]] || exit
|
||||||
|
pass edit "$password"
|
||||||
|
done
|
2
.bin/pastebitch
Executable file
2
.bin/pastebitch
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/ksh
|
||||||
|
curl -F 'pastebitch=<-' http://pastebitch.com
|
32
.bin/pwadd
Executable file
32
.bin/pwadd
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
_ask() {
|
||||||
|
# $1 question
|
||||||
|
# $2 default value
|
||||||
|
if [ -z $1 ]; then
|
||||||
|
printf "$1: "
|
||||||
|
else
|
||||||
|
printf "$1 [$2]: "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_ask "Url" "$1"
|
||||||
|
read url
|
||||||
|
[ -z $url ] && url="$1"
|
||||||
|
|
||||||
|
_ask "User" "$2"
|
||||||
|
read user
|
||||||
|
[ -z $user ] && user="$2"
|
||||||
|
|
||||||
|
if [ -z $user ] || [ -z $url ]; then
|
||||||
|
print "User and URL must be set."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PW="$(pwgen -y --remove-chars=\~\`\"\'{}\(\)\[\]\*:/.\;\|,\<\> 24)
|
||||||
|
|
||||||
|
User: $user"
|
||||||
|
|
||||||
|
printf '%s\n' "$PW" | pass insert -fm Internet/$url 1> /dev/null
|
||||||
|
pass Internet/$url | head -1 | xclip
|
||||||
|
print "Password copied."
|
46
.bin/rec_scr
Executable file
46
.bin/rec_scr
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
_vidfile="/home/sdk/rec-screen.mkv"
|
||||||
|
_outfile="/home/sdk/rec-encoded-$(date "+%Y%m%d_%H%M%S").mp4"
|
||||||
|
|
||||||
|
_res="1920x1080"
|
||||||
|
_fps="24"
|
||||||
|
|
||||||
|
_mon_dev="snd/mon"
|
||||||
|
_mic_dev="snd/default"
|
||||||
|
|
||||||
|
_mon_in="-thread_queue_size 16 -use_wallclock_as_timestamps 1 -f sndio -i ${_mon_dev}"
|
||||||
|
_mon_proc="-c:a pcm_s16le"
|
||||||
|
|
||||||
|
_mic_in="-thread_queue_size 16 -use_wallclock_as_timestamps 1 -f sndio -i ${_mic_dev}"
|
||||||
|
_mic_proc="-af pan='stereo|c0=FL|c1=FL' -c:a pcm_s16le"
|
||||||
|
|
||||||
|
_vid_in="-framerate ${_fps} -f x11grab -i :0.0"
|
||||||
|
_vid_proc="-c:v libx264rgb -crf 0 -qp 0 -framerate ${_fps} -sws_flags neighbor -preset ultrafast -tune zerolatency"
|
||||||
|
|
||||||
|
_ffmpeg_param="${_vid_in} ${_mic_in} ${_mon_in} -map 0:v ${_vid_proc} -map 1:a ${_mic_proc} -map 2:a ${_mon_proc}"
|
||||||
|
|
||||||
|
printf 'Press q to stop.\n'
|
||||||
|
set -x
|
||||||
|
ffmpeg -y -loglevel error -hide_banner ${_ffmpeg_param} "${_vidfile}"
|
||||||
|
set +x
|
||||||
|
|
||||||
|
# with audio?
|
||||||
|
[ "$1" == "-a" ] \
|
||||||
|
&& _audio_encode_param="-filter_complex amix=inputs=2,stereotools=phase=5,compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20 -c:a aac -b:a 160k"
|
||||||
|
|
||||||
|
printf 'Encoding...\n'
|
||||||
|
set -x
|
||||||
|
ffmpeg -hide_banner -y \
|
||||||
|
-i "${_vidfile}" \
|
||||||
|
-c:v libx264 \
|
||||||
|
-crf 28 \
|
||||||
|
-s ${_res} \
|
||||||
|
-preset veryfast \
|
||||||
|
-movflags faststart \
|
||||||
|
-threads 12 \
|
||||||
|
${_audio_encode_param} \
|
||||||
|
"${_outfile}"
|
||||||
|
set +x
|
||||||
|
printf '%s\n' "${_outfile}"
|
18
.bin/rec_scr_fast
Executable file
18
.bin/rec_scr_fast
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
ffmpeg \
|
||||||
|
-f x11grab \
|
||||||
|
-framerate 60 \
|
||||||
|
-video_size 1920x1080 \
|
||||||
|
-i :0.0 \
|
||||||
|
-codec:v mpeg2video \
|
||||||
|
-g 18 \
|
||||||
|
-b:v 6000k \
|
||||||
|
-maxrate:v 36000k \
|
||||||
|
-minrate:v 0 \
|
||||||
|
-bufsize:v 7340032 \
|
||||||
|
-ar 48000 \
|
||||||
|
-codec:a ac3 \
|
||||||
|
-b:a 448k \
|
||||||
|
out.mpg
|
46
.bin/rec_scr_huff
Executable file
46
.bin/rec_scr_huff
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
_vidfile="/home/sdk/rec-screen.mkv"
|
||||||
|
_outfile="/home/sdk/rec-encoded-$(date "+%Y%m%d_%H%M%S").mp4"
|
||||||
|
|
||||||
|
_res="1920x1080"
|
||||||
|
_fps="30"
|
||||||
|
|
||||||
|
_mon_dev="snd/mon"
|
||||||
|
_mic_dev="snd/default"
|
||||||
|
|
||||||
|
_mon_in="-thread_queue_size 16 -use_wallclock_as_timestamps 1 -f sndio -i ${_mon_dev}"
|
||||||
|
_mon_proc="-c:a pcm_s16le"
|
||||||
|
|
||||||
|
_mic_in="-thread_queue_size 16 -use_wallclock_as_timestamps 1 -f sndio -i ${_mic_dev}"
|
||||||
|
_mic_proc="-af pan='stereo|c0=FL|c1=FL' -c:a pcm_s16le"
|
||||||
|
|
||||||
|
_vid_in="-framerate ${_fps} -f x11grab -i :0.0"
|
||||||
|
_vid_proc="-qscale 0 -c:v huffyuv -framerate ${_fps}"
|
||||||
|
|
||||||
|
_ffmpeg_param="${_vid_in} ${_mic_in} ${_mon_in} -map 0:v ${_vid_proc} -map 1:a ${_mic_proc} -map 2:a ${_mon_proc}"
|
||||||
|
|
||||||
|
printf 'Press q to stop.\n'
|
||||||
|
set -x
|
||||||
|
ffmpeg -y -loglevel error -hide_banner ${_ffmpeg_param} "${_vidfile}"
|
||||||
|
set +x
|
||||||
|
|
||||||
|
# with audio?
|
||||||
|
[ "$1" == "-a" ] \
|
||||||
|
&& _audio_encode_param="-filter_complex amix=inputs=2,stereotools=phase=5,compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20 -c:a aac -b:a 160k"
|
||||||
|
|
||||||
|
printf 'Encoding...\n'
|
||||||
|
set -x
|
||||||
|
ffmpeg -hide_banner -y \
|
||||||
|
-i "${_vidfile}" \
|
||||||
|
-c:v libx264 \
|
||||||
|
-crf 28 \
|
||||||
|
-s ${_res} \
|
||||||
|
-preset veryfast \
|
||||||
|
-movflags faststart \
|
||||||
|
-threads 12 \
|
||||||
|
${_audio_encode_param} \
|
||||||
|
"${_outfile}"
|
||||||
|
set +x
|
||||||
|
printf '%s\n' "${_outfile}"
|
22
.bin/recio
Executable file
22
.bin/recio
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# store previous and new values
|
||||||
|
PA=$(sysctl -n kern.audio.record)
|
||||||
|
PV=$(sysctl -n kern.video.record)
|
||||||
|
NA=$1
|
||||||
|
NV=$2
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
[01]) doas sysctl -q kern.audio.record=$1;
|
||||||
|
;;
|
||||||
|
r) doas rcctl restart sndiod;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $2 in
|
||||||
|
[01]) doas sysctl -q kern.video.record=$2; ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf 'REC:%s CAM:%s\n' \
|
||||||
|
$(sysctl -n kern.audio.record) \
|
||||||
|
$(sysctl -n kern.video.record)
|
9
.bin/rename_to_lowercase
Executable file
9
.bin/rename_to_lowercase
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
find . -maxdepth 1 -type f \
|
||||||
|
| while read line
|
||||||
|
do
|
||||||
|
original="$line"
|
||||||
|
lowercase="$(printf '%s' "$line" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
mv -vf "$original" "$lowercase"
|
||||||
|
done
|
20
.bin/restore
Executable file
20
.bin/restore
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. $HOME/.bin/_config
|
||||||
|
|
||||||
|
print "Tarsnap Restore:"
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
doas tarsnap --list-archives | sort
|
||||||
|
printf "Usage: restore <key_id>\n"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
_backup="$(doas tarsnap --list-archives | grep "$1")"
|
||||||
|
if [ -z "$_backup" ]; then
|
||||||
|
print "No backup with key id $1 found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir "restore_$1"
|
||||||
|
doas tarsnap --humanize-numbers -xvf "$_backup" -C "restore_$1"
|
||||||
|
print "Data restored in $(readlink -f "restore_$1")"
|
27
.bin/s
Executable file
27
.bin/s
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. ~/.bin/_config
|
||||||
|
[ ! -z "$1" ] && EXTRA="-q $1"
|
||||||
|
F=$(find /usr/src /usr/xenocara/ /usr/www/ -type f \
|
||||||
|
-not -path "*/CVS/*" \
|
||||||
|
-not -path "*/.git/*" \
|
||||||
|
-not -path "/usr/src/gnu/*" \
|
||||||
|
\( -name "*.c" \
|
||||||
|
-o -name "*.h" \
|
||||||
|
-o -name "*.pl" \
|
||||||
|
-o -name "*.inc" \
|
||||||
|
-o -name "patch-*" \
|
||||||
|
-o -name "DESCR*" \
|
||||||
|
-o -name "PLIST*" \
|
||||||
|
-o -name "PLIST*" \
|
||||||
|
-o -name "Makefile*" \
|
||||||
|
\) \
|
||||||
|
-not -name "*.orig" \
|
||||||
|
-not -name "*.openbsd.orig" \
|
||||||
|
| while IFS= read -r l; do echo "${#l} $((++n)) $l"; done \
|
||||||
|
| sort -n -k 1 \
|
||||||
|
| cut -d" " -f3- \
|
||||||
|
| fzf -e -1 -0 +s $EXTRA --preview="cat {1}")
|
||||||
|
set -xe
|
||||||
|
R="$(readlink -f "$F")"
|
||||||
|
test -z "$R" || vim "$R"
|
||||||
|
echo "$(dirname "$R")"
|
5
.bin/smi
Executable file
5
.bin/smi
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -xe
|
||||||
|
doas make clean
|
||||||
|
make -j4
|
||||||
|
doas make install
|
19
.bin/sndevice
Executable file
19
.bin/sndevice
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# cat /etc/rc.conf.local
|
||||||
|
# sndiod_flags=-f rsnd/0 -F rsnd/1 -F rsnd/2 -F rsnd/3
|
||||||
|
|
||||||
|
cur=$(sndioctl -n server.device)
|
||||||
|
case $1 in
|
||||||
|
+) sndioctl server.device=$(( cur + 1 )) > /dev/null 2>&1 \
|
||||||
|
|| echo "Max device reached"; ;;
|
||||||
|
-) sndioctl server.device=$(( cur - 1 )) > /dev/null 2>&1 \
|
||||||
|
|| echo "Min device reached"; ;;
|
||||||
|
[0-9]) sndioctl server.device=$1 > /dev/null 2>&1 \
|
||||||
|
|| echo "Device $1 not available"; ;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
now=$(sndioctl -n server.device)
|
||||||
|
|
||||||
|
echo "Active server.device=$now"
|
||||||
|
dmesg | grep -B2 ^audio$now | grep " at " | head -n 1
|
8
.bin/sort-wantlib
Executable file
8
.bin/sort-wantlib
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cat | sed 's/^WANTLIB[[:blank:]+=]*//g' \
|
||||||
|
| tr ' ' '\n' \
|
||||||
|
| sort -u \
|
||||||
|
| fmt -w60 \
|
||||||
|
| sed 's/^/WANTLIB += /g'
|
||||||
|
# | sed '1s/^WANTLIB += /WANTLIB = /'
|
5
.bin/ssh-tunnel
Executable file
5
.bin/ssh-tunnel
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# $1 host
|
||||||
|
# $2 port
|
||||||
|
set -x
|
||||||
|
ssh -fN -o ServerAliveInterval=15 -L $2:localhost:$2 $1
|
26
.bin/sshot
Executable file
26
.bin/sshot
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
. ${HOME}/.bin/_config
|
||||||
|
|
||||||
|
trap cleanup 1 2 3 6
|
||||||
|
cleanup() {
|
||||||
|
rm -f "${_file_tmp}";
|
||||||
|
notify-send "sshot: Aborted..."
|
||||||
|
}
|
||||||
|
|
||||||
|
_filename="scr-$(date "+%Y%m%d_%H%M")-$(pwgen -A -0 -1 3).png"
|
||||||
|
_file_tmp="/tmp/${_filename}"
|
||||||
|
_file_out="${HOME}/.screenshots/${_filename}"
|
||||||
|
|
||||||
|
flameshot gui -p "${_file_tmp}"
|
||||||
|
|
||||||
|
test -f "${_file_tmp}" || exit 1
|
||||||
|
|
||||||
|
pngcrush -reduce "${_file_tmp}"
|
||||||
|
|
||||||
|
mv "${_file_tmp}" "${_file_out}"
|
||||||
|
|
||||||
|
scp "${_file_out}" "sdk@codevoid.de:/home/www/htdocs/gopher/p/${_filename}"
|
||||||
|
printf '%s' "https://codevoid.de/I/p/${_filename}" | xclip
|
||||||
|
|
||||||
|
|
||||||
|
notify-send "sshot: Screenshot copied to clipboard" "luakit https://codevoid.de/I/p/${_filename}"
|
81
.bin/subsonic
Executable file
81
.bin/subsonic
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# subsonic
|
||||||
|
alias subsonic-cli="\subsonic-cli -c $HOME/.subsonic-cli.conf"
|
||||||
|
|
||||||
|
subsonic-play() {
|
||||||
|
# $1 songId
|
||||||
|
for song in $@
|
||||||
|
do
|
||||||
|
echo $song > /tmp/.playing
|
||||||
|
subsonic-cli stream -p id $song \
|
||||||
|
| mpv --loop=no -
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
subsonic-random() {
|
||||||
|
while true;
|
||||||
|
do
|
||||||
|
echo "Fetching moar dataaa.."
|
||||||
|
subsonic-play $(subsonic-cli getRandomSongs \
|
||||||
|
| jq -r '.randomSongs[][].id')
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
subsonic-favorites() {
|
||||||
|
while true;
|
||||||
|
do
|
||||||
|
echo "Fetching moar dataaa.."
|
||||||
|
subsonic-play $(subsonic-cli getStarred \
|
||||||
|
| jq -r '.starred[][].id' \
|
||||||
|
| sort -r)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
subsonic-search() {
|
||||||
|
{
|
||||||
|
echo "|ALBUMID|ID|ALBUM|ARTIST|TITLE|GENRE|"
|
||||||
|
printf "|%s|%s|%s|%s|%s|%s|\n" "--------------------------------"\
|
||||||
|
"--------------------------------"\
|
||||||
|
"--------" "--------" "--------" "--------"
|
||||||
|
subsonic-cli search3 \
|
||||||
|
-p songcount 200 \
|
||||||
|
-p query "$@" \
|
||||||
|
| jq -r '.searchResult3[][]|select(.contentType!=null)|[.albumId,.id,.album,.title,.artist,.genre]' \
|
||||||
|
| tr -d '", ' \
|
||||||
|
| awk '/^\[/ { S++ } \
|
||||||
|
/^\]/ { S-- } \
|
||||||
|
S==0 { NR=0 } \
|
||||||
|
NR==2 { AID=$0 } \
|
||||||
|
NR==3 { ID=$0 } \
|
||||||
|
NR==4 { ALBUM=$0 } \
|
||||||
|
NR==5 { TITLE=$0 } \
|
||||||
|
NR==6 { ARTIST=$0 } \
|
||||||
|
NR==7 { GENRE=$0 } \
|
||||||
|
NR==0 { printf("|%s|%s|%s|%s|%s|%s|\n", AID, ID, ALBUM, ARTIST, TITLE, GENRE) }'
|
||||||
|
} | column -s'|' -t
|
||||||
|
}
|
||||||
|
|
||||||
|
subsonic-star() {
|
||||||
|
[ -f /tmp/.playing ] \
|
||||||
|
&& subsonic-cli star -p id $(cat /tmp/.playing | tail -1) \
|
||||||
|
|| echo bruh.
|
||||||
|
}
|
||||||
|
|
||||||
|
subsonic-unstar() {
|
||||||
|
[ -f /tmp/.playing ] \
|
||||||
|
&& subsonic-cli unstar -p id $(cat /tmp/.playing | tail -1) \
|
||||||
|
|| echo bruh.
|
||||||
|
}
|
||||||
|
|
||||||
|
subsonic-download() {
|
||||||
|
# $1 albumId
|
||||||
|
NAME=$(subsonic-cli getAlbum -p id $1 \
|
||||||
|
| jq -r '.album.artist,.album.name' | xargs | tr ' ' '-')
|
||||||
|
printf "Downloading to %s/subsonic-download/%s.zip\n" "$HOME" "$NAME"
|
||||||
|
mkdir -p "$HOME/subsonic-download"
|
||||||
|
subsonic-cli download -p id $1 | pv > "$HOME/subsonic-download/$NAME.zip"
|
||||||
|
}
|
||||||
|
|
||||||
|
subsonic-$1
|
||||||
|
|
96
.bin/tapebackup.sh
Executable file
96
.bin/tapebackup.sh
Executable file
@ -0,0 +1,96 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export LANG="UTF-16"
|
||||||
|
|
||||||
|
# v0.6 add finish time prediction
|
||||||
|
# v0.5 change + bsd tar
|
||||||
|
# v0.4 read with 4m buffer, write with 128k
|
||||||
|
# v0.3 added mbuffer to restore
|
||||||
|
# v0.2 merge restore/backup script and add parameter handling
|
||||||
|
# v0.1 initial version
|
||||||
|
|
||||||
|
### CONFIG ###
|
||||||
|
|
||||||
|
_key="/etc/keyfile"
|
||||||
|
_dev="/dev/nsa0"
|
||||||
|
_buffer="8G"
|
||||||
|
_tapeln="10320" # full tape read/write time in seconds
|
||||||
|
|
||||||
|
### FUNCTIONS ###
|
||||||
|
|
||||||
|
V=0.6
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
printf '%s%s\n%s\n%s\n%s\n\n' \
|
||||||
|
"$0" ": <mode> <directory>" \
|
||||||
|
" -b backup mode" \
|
||||||
|
" -r restore mode" \
|
||||||
|
" <directory> directory to backup or restore to"
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
_src="$(readlink -f "$2")"
|
||||||
|
[ -z $_src ] && printf 'File or Directory does not exist: %s\n\n' "$1" && usage
|
||||||
|
|
||||||
|
dates() {
|
||||||
|
printf 'Start: %s\nEnd: %s (predicted)\n' "$(date)" "$(date -r $(($(date +%s)+$_tapeln)))"
|
||||||
|
}
|
||||||
|
|
||||||
|
backup() {
|
||||||
|
printf 'Calculating...\n'
|
||||||
|
printf 'Backing up %s with a total size of %s\n' "$_src" "$(du -hs $_src | awk '{ print $1 }')"
|
||||||
|
dates
|
||||||
|
tar -b 2048 -cf - "$_src" \
|
||||||
|
| zstd -T0 \
|
||||||
|
| openssl enc -e -pbkdf2 -aes256 -pass file:$_key \
|
||||||
|
| mbuffer -v 1 -t -m $_buffer -P 90 -s 4096k \
|
||||||
|
| dd of=$_dev ibs=4096k obs=128k
|
||||||
|
printf 'End: %s\n' "$(date)"
|
||||||
|
}
|
||||||
|
|
||||||
|
restore() {
|
||||||
|
printf 'Restoring data to %s (logging to restore.log)\n' "$_src"
|
||||||
|
dates | tee restore.log
|
||||||
|
dd if=$_dev ibs=128k obs=4096k \
|
||||||
|
| openssl enc -d -pbkdf2 -aes256 -pass file:$_key \
|
||||||
|
| zstd -T0 -d \
|
||||||
|
| mbuffer -v 1 -t -m $_buffer -s 4096k \
|
||||||
|
| tar -C "$_src" -b 2048 -xvf - >> restore.log 2>&1
|
||||||
|
printf 'End: %s\n' "$(date)" | tee restore.log
|
||||||
|
}
|
||||||
|
|
||||||
|
### MAIN PROGRAM ###
|
||||||
|
|
||||||
|
blogo() {
|
||||||
|
printf '%s%s%s\n\n' \
|
||||||
|
'
|
||||||
|
______ ____ __
|
||||||
|
/_ __/___ _____ ___ / __ )____ ______/ /____ ______
|
||||||
|
/ / / __ `/ __ \/ _ \ / __ / __ `/ ___/ //_/ / / / __ \
|
||||||
|
/ / / /_/ / /_/ / __/ / /_/ / /_/ / /__/ ,< / /_/ / /_/ /
|
||||||
|
/_/ \__,_/ .___/\___/ /_____/\__,_/\___/_/|_|\__,_/ .___/
|
||||||
|
/_/ CODEVOID BACKUP TOOL v'"$V"' /_/
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
rlogo() {
|
||||||
|
printf '%s%s\n\n' \
|
||||||
|
'
|
||||||
|
______ ____ __
|
||||||
|
/_ __/___ _____ ___ / __ \___ _____/ /_____ ________
|
||||||
|
/ / / __ `/ __ \/ _ \ / /_/ / _ \/ ___/ __/ __ \/ ___/ _ \
|
||||||
|
/ / / /_/ / /_/ / __/ / _, _/ __(__ ) /_/ /_/ / / / __/
|
||||||
|
/_/ \__,_/ .___/\___/ /_/ |_|\___/____/\__/\____/_/ \___/
|
||||||
|
/_/ CODEVOID BACKUP TOOL v'"$V"
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
-b) blogo;
|
||||||
|
backup;
|
||||||
|
;;
|
||||||
|
-r) rlogo;
|
||||||
|
restore;
|
||||||
|
;;
|
||||||
|
*) usage;
|
||||||
|
;;
|
||||||
|
esac
|
21
.bin/tarsnap-delete
Executable file
21
.bin/tarsnap-delete
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. $HOME/.bin/_config
|
||||||
|
|
||||||
|
print "Tarsnap Delete:"
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
doas tarsnap --list-archives | sort
|
||||||
|
printf "Usage: delete <key_id>\n"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
_delete="$(doas tarsnap --list-archives | grep "$1")"
|
||||||
|
if [ -z "$_delete" ]; then
|
||||||
|
print "No backup with key id $1 found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
print "Deleting: $_delete"
|
||||||
|
doas tarsnap -df "$_delete"
|
||||||
|
print "done."
|
||||||
|
|
7
.bin/texec
Executable file
7
.bin/texec
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. $HOME/.bin/_config
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
$STERM -T "$@" -e ksh -ic "$1"
|
||||||
|
else
|
||||||
|
$STERM
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user