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

View file

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

View file

@ -4,6 +4,6 @@
# Content processes can normally be restored by clicking restore tab. # Content processes can normally be restored by clicking restore tab.
ps aux | ps aux |
G firefox contentproc childID -v grep | G firefox contentproc tab -v grep |
field 2 | field 2 |
parallel -v --delay 1 -r kill 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"); my @end = ("ffmpeg","-ss",$time,"-i","file:$infile","-c","copy","file:$end_file");
system(@end) == 0 or die(join" ",@end); system(@end) == 0 or die(join" ",@end);
system("mv",$infile,$rmdir) == 0 or die; system("mv",$infile,$rmdir) == 0 or die;
print "OK\n";
} }
sub destinationfilenames { sub destinationfilenames {

17
vid/vid
View file

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