mirrorpdf: source.

This commit is contained in:
Ole Tange 2018-02-02 07:25:34 +01:00
parent 1f89673b34
commit e7dd4cf74a
2 changed files with 88 additions and 5 deletions

75
mirrorpdf/mirrorpdf Executable file
View file

@ -0,0 +1,75 @@
#!/bin/bash
: <<=cut
=pod
=head1 NAME
mirrorpdf - Mirror PDF horizontally
=head1 SYNOPSIS
B<mirrorpdf> I<file.pdf>
=head1 DESCRIPTION
B<mirrorpdf> mirrors the pages of a PDF-file. Output is in
I<file>_mirror.pdf.
=head1 EXAMPLE
Mirror pages of foo.pdf:
mirrorpdf foo.pdf
=head1 AUTHOR
Copyright (C) 2018 Ole Tange,
http://ole.tange.dk and Free Software Foundation, Inc.
=head1 LICENSE
Copyright (C) 2012 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
=head1 DEPENDENCIES
B<mirrorpdf> uses B<pdf2ps>, B<pstops>, B<pdftk>, and B<ps2pdf>.
=head1 SEE ALSO
B<man>
=cut
mirror() {
tmp=`mktemp /tmp/mirpdfXXXXX`
pdf2ps "$1" - |
# Flip both horizontally and vertically
pstops H |
ps2pdf - $tmp
# Flip both horizontally and vertically
pdftk $tmp cat 1-endnorth output "$2"
rm $tmp
}
export -f mirror
parallel mirror {} {.}_mirror.pdf ::: "$@"

View file

@ -51,18 +51,26 @@ B<bash>(1)
=cut =cut
modules="iwl4965 iwl3945 iwldvm ath9k ath9k_common ath9k_hw ath ath3k brcmfmac rt73usb rt2x00lib cfg80211 mac80211"
sudo killall wpa_supplicant sudo killall wpa_supplicant
sudo parallel -j1 modprobe -r ::: iwl4965 iwl3945 iwldvm ath9k ath9k_common mac80211 ath9k_hw ath cfg80211 ath3k sudo parallel -j0 --delay 0.03 --retries 50 modprobe -r ::: $modules
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 iwl4965 parallel -j1 sudo modprobe ::: $modules
sudo rfkill unblock all
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
sudo kill -9 $PID sudo kill -9 $PID
sudo NetworkManager & #sudo NetworkManager &
if tty -s ; then if tty -s ; then
# STDIN is terminal # STDIN is terminal
timeout 12 forever dmesg | puniq timeout 12 dmesg -Tw
# timeout 12 forever dmesg | puniq
fi fi
sudo bash -c 'cat >> /etc/resolv.conf' < /etc/resolvconf/resolv.conf.d/head
sudo iwconfig wls1 essid Turris
sudo dhclient wls1 &
sudo wpa_supplicant -Dwext -c/etc/wpa_supplicant.conf -iwls1 -d &