Compare commits

...

2 commits

Author SHA1 Message Date
Ole Tange 8f7d700812 encdir: Read password from stdin if dir.enc and dir exist. 2024-11-10 13:45:43 +01:00
Ole Tange 9890961c15 vid: Bug: stdin would never be detected as terminal. 2024-09-14 11:20:53 +02:00
5 changed files with 54 additions and 23 deletions

View file

@ -4,10 +4,10 @@ CMD = 2grep 2search audioping blink burncpu bwlimit clipboard drac \
gitdiffdir gitedit gitnext gitundo goodpasswd histogram \
Loffice mtrr mirrorpdf neno not off pdfman pidcmd pidtree \
plotpipe puniq ramusage rand rclean rina rn rrm seekmaniac \
shython sound-reload splitvideo stdout swapout T teetime \
timestamp tracefile transpose upsidedown vid \
w4it-for-port-open whitehash wifi-reload wssh youtube-lbry \
ytv yyyymmdd
shython sound-reload splitvideo stdout summer swapout T \
teetime timestamp tracefile transpose twitsplit ctc upsidedown \
vid w4it-for-port-open whitehash wifi-reload wssh \
youtube-lbry ytv yyyymmdd
all: 2search/2grep.1 2search/2search.1 blink/blink.1 \
burncpu/burncpu.1 bwlimit/bwlimit.1 clipboard/clipboard.1 \
@ -22,10 +22,10 @@ all: 2search/2grep.1 2search/2search.1 blink/blink.1 \
seekmaniac/seekmaniac.1 shython/shython.1 \
sound-reload/sound-reload.1 splitvideo/splitvideo.1 \
stdout/stdout.1 teetime/teetime.1 timestamp/timestamp.1 \
tracefile/tracefile.1 transpose/transpose.1 T/T.1 \
upsidedown/upsidedown.1 vid/vid.1 wifi-reload/wifi-reload.1 \
wssh/wssh.1 youtube-lbry/youtube-lbry.1 ytv/ytv.1 \
yyyymmdd/yyyymmdd.1
tracefile/tracefile.1 transpose/transpose.1 \
twitsplit/twitsplit.1 T/T.1 upsidedown/upsidedown.1 vid/vid.1 \
wifi-reload/wifi-reload.1 wssh/wssh.1 \
youtube-lbry/youtube-lbry.1 ytv/ytv.1 yyyymmdd/yyyymmdd.1
%.1: %
pod2man $< > $@

View file

@ -10,14 +10,17 @@ encdir - mount encfs dir or create it if missing
=head1 SYNOPSIS
B<encdir> I<dir>
B<encdir> I<my_dir>
B<encdir> I<my_encdir> I<my_dir>
=head1 DESCRIPTION
B<encdir> uses B<encfs> to mount I<dir>.enc on I<dir>.
B<encdir> uses B<encfs> to mount I<my_encdir> on
I<my_dir>. I<my_encdir> defaults to I<my_dir>.enc
If I<dir> or I<dir>.enc do not exist then they will be created.
If I<my_dir> or I<my_encdir> do not exist then they will be created.
=head1 EXAMPLE
@ -27,7 +30,7 @@ Mount mydir.enc on mydir:
=head1 AUTHOR
Copyright (C) 2017-2020 Ole Tange,
Copyright (C) 2017-2024 Ole Tange,
http://ole.tange.dk and Free Software Foundation, Inc.
@ -61,15 +64,31 @@ B<encfs>
=cut
if [ -z "$2" ] ; then
fusermount -u $1 2>/dev/null
# --public only works if root. Ignored otherwise.
encfs --public `readlink -f "$1".enc` `readlink -f "$1"`
dir="$1"
encdir="$1".enc
else
fusermount -u `readlink -f $2` 2>/dev/null
dir="$2"
encdir="$1"
fi
dir=$(readlink -f "$dir")
encdir=$(readlink -f "$encdir")
fusermount -u "$dir" 2>/dev/null
if [ -d "$encdir" -a -d "$dir" ] ; then
read -sp "Enter password: " password
echo
echo "$password" |
# --public only works if root. Ignored otherwise.
encfs --public `readlink -f "$1"` `readlink -f "$2"`
encfs --stdinpass --public "$encdir" "$dir"
echo
else
# --public only works if root. Ignored otherwise.
encfs --public "$encdir" "$dir"
fi

View file

@ -4,6 +4,6 @@
# Content processes can normally be restored by clicking restore tab.
ps aux |
G firefox contentproc childID -v grep |
G firefox contentproc tab -v grep |
field 2 |
parallel -v --delay 1 -r kill

View file

@ -109,6 +109,7 @@ if(not -e $infile or $time !~ /\d\d:\d\d:\d\d.\d/) {
my @end = ("ffmpeg","-ss",$time,"-i","file:$infile","-c","copy","file:$end_file");
system(@end) == 0 or die(join" ",@end);
system("mv",$infile,$rmdir) == 0 or die;
print "OK\n";
}
sub destinationfilenames {

17
vid/vid
View file

@ -176,11 +176,10 @@ stdin() {
}
stdout() {
if [ -t 1 ] ; then
# STDOUT = terminal
if $stdout_is_terminal ; then
# start $VIDEOPLAYER
VIDEOPLAYER=${VIDEOPLAYER:-vlc --}
if tty -s ; then
if $stdin_is_terminal ; then
# STDIN is terminal => limit to 100
shuf | parallel --halt now,done=1 --lb -n100 -Xj1 $VIDEOPLAYER
else
@ -191,6 +190,18 @@ stdout() {
fi
}
if [ -t 1 ] ; then
stdout_is_terminal=true
else
stdout_is_terminal=false
fi
if tty -s ; then
stdin_is_terminal=true
else
stdin_is_terminal=false
fi
stdin | G "$@" | stdout
exit $?