From 1f89673b34c1fa0e5778aef06ed8a2129bf70018 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Tue, 16 Jan 2018 15:37:35 +0100 Subject: [PATCH] mirrorpdf: Initial release. --- Makefile | 10 +++++----- README | 2 ++ rina/rina | 39 ++++++++++++++++++++++++++++++++++++--- sound-reload/sound-reload | 1 + wifi-reload/wifi-reload | 4 ++-- 5 files changed, 46 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 1d73d16..3ce2970 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ CMD = blink bsearch duplicate-packets em encdir field forever G \ -gitnext gitundo goodpasswd histogram mtrr neno off pdfman puniq \ -ramusage rand rclean rina rn rrm shython sound-reload stdout swapout \ -T timestamp tracefile upsidedown w4it-for-port-open wifi-reload wssh \ -ytv yyyymmdd +gitnext gitundo goodpasswd histogram mtrr mirrorpdf neno off pdfman \ +puniq ramusage rand rclean rina rn rrm shython sound-reload stdout \ +swapout T timestamp tracefile upsidedown w4it-for-port-open \ +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: % pod2man $< > $@ diff --git a/README b/README index 2c33f49..23fef19 100644 --- a/README +++ b/README @@ -22,6 +22,8 @@ gitundo - Undo commit. 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. off - Turn off monitor. diff --git a/rina/rina b/rina/rina index 7c49d63..7a8ec3d 100755 --- a/rina/rina +++ b/rina/rina @@ -75,20 +75,53 @@ use Getopt::Long; use Time::HiRes; use POSIX qw(strftime); +Getopt::Long::Configure("bundling","require_order"); get_options_from_array(\@ARGV); my $in_fh = *STDIN; +$|=1; set_fh_non_blocking($in_fh); -while(1){ - sleep($opt::timeout || 10); - if(not read($in_fh,$dummy,32768)) { + +while(1) { + my $newline = ""; + 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 @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"; } + 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 while(read($in_fh,$dummy,32768)) { } } diff --git a/sound-reload/sound-reload b/sound-reload/sound-reload index 27568f3..af8a2d3 100755 --- a/sound-reload/sound-reload +++ b/sound-reload/sound-reload @@ -53,6 +53,7 @@ B(1), B(1) perl -i.bak -ne '/autospawn/ or print' ~/.pulse/client.conf echo autospawn=no >> ~/.pulse/client.conf pulseaudio -k +fuser -kv /dev/snd/* modules=" snd_hda_intel snd_hda_codec_hdmi diff --git a/wifi-reload/wifi-reload b/wifi-reload/wifi-reload index f9cf9f3..67ba07b 100755 --- a/wifi-reload/wifi-reload +++ b/wifi-reload/wifi-reload @@ -52,10 +52,10 @@ B(1) =cut 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 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]+') sudo kill $PID || sudo killall NetworkManager sleep 1