mirrorpdf: Initial release.

This commit is contained in:
Ole Tange 2018-01-16 15:37:35 +01:00
parent 7a68589462
commit 1f89673b34
5 changed files with 46 additions and 10 deletions

View file

@ -1,10 +1,10 @@
CMD = blink bsearch duplicate-packets em encdir field forever G \ CMD = blink bsearch duplicate-packets em encdir field forever G \
gitnext gitundo goodpasswd histogram mtrr neno off pdfman puniq \ gitnext gitundo goodpasswd histogram mtrr mirrorpdf neno off pdfman \
ramusage rand rclean rina rn rrm shython sound-reload stdout swapout \ puniq ramusage rand rclean rina rn rrm shython sound-reload stdout \
T timestamp tracefile upsidedown w4it-for-port-open wifi-reload wssh \ swapout T timestamp tracefile upsidedown w4it-for-port-open \
ytv yyyymmdd wifi-reload wssh ytv yyyymmdd
all: blink/blink.1 bsearch/bsearch.1 encdir/encdir.1 G/G.1 gitnext/gitnext.1 gitundo/gitundo.1 goodpasswd/goodpasswd.1 histogram/histogram.1 neno/neno.1 off/off.1 pdfman/pdfman.1 puniq/puniq.1 rand/rand.1 rina/rina.1 rn/rn.1 rrm/rrm.1 shython/shython.1 sound-reload/sound-reload.1 stdout/stdout.1 timestamp/timestamp.1 tracefile/tracefile.1 T/T.1 upsidedown/upsidedown.1 wifi-reload/wifi-reload.1 wssh/wssh.1 ytv/ytv.1 yyyymmdd/yyyymmdd.1 all: blink/blink.1 bsearch/bsearch.1 encdir/encdir.1 G/G.1 gitnext/gitnext.1 gitundo/gitundo.1 goodpasswd/goodpasswd.1 histogram/histogram.1 mirrorpdf/mirrorpdf.1 neno/neno.1 off/off.1 pdfman/pdfman.1 puniq/puniq.1 rand/rand.1 rina/rina.1 rn/rn.1 rrm/rrm.1 shython/shython.1 sound-reload/sound-reload.1 stdout/stdout.1 timestamp/timestamp.1 tracefile/tracefile.1 T/T.1 upsidedown/upsidedown.1 wifi-reload/wifi-reload.1 wssh/wssh.1 ytv/ytv.1 yyyymmdd/yyyymmdd.1
%.1: % %.1: %
pod2man $< > $@ pod2man $< > $@

2
README
View file

@ -22,6 +22,8 @@ gitundo - Undo commit.
histogram - make and display a histogram on the command line. histogram - make and display a histogram on the command line.
mirrorpdf - mirror PDF-file horizontally.
neno - No error no output. Only print STDERR and STDOUT if the command fails. neno - No error no output. Only print STDERR and STDOUT if the command fails.
off - Turn off monitor. off - Turn off monitor.

View file

@ -75,20 +75,53 @@ use Getopt::Long;
use Time::HiRes; use Time::HiRes;
use POSIX qw(strftime); use POSIX qw(strftime);
Getopt::Long::Configure("bundling","require_order");
get_options_from_array(\@ARGV); get_options_from_array(\@ARGV);
my $in_fh = *STDIN; my $in_fh = *STDIN;
$|=1;
set_fh_non_blocking($in_fh); set_fh_non_blocking($in_fh);
while(1) { while(1) {
sleep($opt::timeout || 10); my $newline = "";
if(not read($in_fh,$dummy,32768)) { my $t;
sleep(1);
if(read($in_fh,$dummy,32768)) { next; }
for($t = $opt::timeout || 10; $t; $t--) {
sleep(1);
if(read($in_fh,$dummy,32768)) { last; }
$newline = "\n";
@opt::verbose and print "$t ";
}
@opt::verbose and print $newline;
if(not $t) {
# run_command # run_command
@opt::verbose and print iso8601(Time::HiRes::time())," Running @ARGV\n"; @opt::verbose and print iso8601(Time::HiRes::time())," Running @ARGV\n";
system(@ARGV); system(@ARGV);
wait(); wait();
@opt::verbose and print iso8601(Time::HiRes::time())," Done @ARGV\n"; @opt::verbose and print iso8601(Time::HiRes::time())," Done @ARGV\n";
} }
while(read($in_fh,$dummy,32768)) { }
}
while(1){
my $t = $opt::timeout || 10;
my $newline = "";
sleep(1);
if(not read($in_fh,$dummy,32768)) {
$newline = "\n";
@opt::verbose and print "$t";
if(not $t--) {
# run_command
@opt::verbose and print $newline;
@opt::verbose and print iso8601(Time::HiRes::time())," Running @ARGV\n";
system(@ARGV);
wait();
@opt::verbose and print iso8601(Time::HiRes::time())," Done @ARGV\n";
}
}
@opt::verbose and print $newline;
# empty_buffer # empty_buffer
while(read($in_fh,$dummy,32768)) { } while(read($in_fh,$dummy,32768)) { }
} }

View file

@ -53,6 +53,7 @@ B<bash>(1), B<pulseaudio>(1)
perl -i.bak -ne '/autospawn/ or print' ~/.pulse/client.conf perl -i.bak -ne '/autospawn/ or print' ~/.pulse/client.conf
echo autospawn=no >> ~/.pulse/client.conf echo autospawn=no >> ~/.pulse/client.conf
pulseaudio -k pulseaudio -k
fuser -kv /dev/snd/*
modules=" modules="
snd_hda_intel snd_hda_intel
snd_hda_codec_hdmi snd_hda_codec_hdmi

View file

@ -52,10 +52,10 @@ B<bash>(1)
=cut =cut
sudo killall wpa_supplicant sudo killall wpa_supplicant
sudo parallel -j1 modprobe -r ::: iwl3945 iwldvm ath9k ath9k_common mac80211 ath9k_hw ath cfg80211 ath3k sudo parallel -j1 modprobe -r ::: iwl4965 iwl3945 iwldvm ath9k ath9k_common mac80211 ath9k_hw ath cfg80211 ath3k
sleep 1 sleep 1
sudo killall -9 wpa_supplicant sudo killall -9 wpa_supplicant
parallel -j1 sudo modprobe ::: ath9k ath9k_common mac80211 ath9k_hw ath cfg80211 ath3k iwldvm iwl3945 parallel -j1 sudo modprobe ::: ath9k ath9k_common mac80211 ath9k_hw ath cfg80211 ath3k iwldvm iwl3945 iwl4965
PID=$(sudo NetworkManager 2>&1 | grep -Eo '[0-9]+') PID=$(sudo NetworkManager 2>&1 | grep -Eo '[0-9]+')
sudo kill $PID || sudo killall NetworkManager sudo kill $PID || sudo killall NetworkManager
sleep 1 sleep 1