From 51dc23db6ece60de03f8d2ff25332baff5aa86bc Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Fri, 3 Feb 2017 07:45:32 -0500 Subject: [PATCH] new examples plus a new function for showing md file content, and new scripts for showing network interface info and for showing packages that were manually installed. --- examples/bashisms/script_location.sh | 3 +++ examples/building/vs_var.bat | 2 ++ examples/graphics/pdf_picture_extractor.sh | 9 +++++++++ examples/os_related/block_ip_address.sh | 1 + scripts/core/functions.sh | 11 +++++++++++ scripts/networking/interface_info.sh | 4 ++++ scripts/system/show_manually_installed.sh | 5 +++++ 7 files changed, 35 insertions(+) create mode 100644 examples/building/vs_var.bat create mode 100644 examples/graphics/pdf_picture_extractor.sh create mode 100644 examples/os_related/block_ip_address.sh create mode 100644 scripts/networking/interface_info.sh create mode 100644 scripts/system/show_manually_installed.sh diff --git a/examples/bashisms/script_location.sh b/examples/bashisms/script_location.sh index a01dc95a..7fa942a6 100644 --- a/examples/bashisms/script_location.sh +++ b/examples/bashisms/script_location.sh @@ -5,3 +5,6 @@ # personal aliases or functions disrupting the results. ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && /bin/pwd )" +# another slightly tighter version: +export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory. + diff --git a/examples/building/vs_var.bat b/examples/building/vs_var.bat new file mode 100644 index 00000000..de9ecc14 --- /dev/null +++ b/examples/building/vs_var.bat @@ -0,0 +1,2 @@ + +"c:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/Tools/vsvars32.bat" diff --git a/examples/graphics/pdf_picture_extractor.sh b/examples/graphics/pdf_picture_extractor.sh new file mode 100644 index 00000000..bb46a0df --- /dev/null +++ b/examples/graphics/pdf_picture_extractor.sh @@ -0,0 +1,9 @@ +var=0 +for i in *; do + var=$(($var + 1)) + mkdir -p ~/pictures_converted/$var/ + pdfimages -j $i ~/pictures_converted/$var/ + mv ~/pictures_converted/$var/* ~/pictures_converted/$(basename $i .pdf).jpg +done + + diff --git a/examples/os_related/block_ip_address.sh b/examples/os_related/block_ip_address.sh new file mode 100644 index 00000000..68919bee --- /dev/null +++ b/examples/os_related/block_ip_address.sh @@ -0,0 +1 @@ +sudo ufw deny from ${ip_address} to any diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index e2fbc519..86d89991 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -653,6 +653,17 @@ return 0 ############## +#hmmm: this points to an extended functions file being needed; not all of these are core. + + # displays documentation in "md" formatted files. + function show_md() + { + local file="$1"; shift + pandoc "$file" | lynx -stdin + } + + ############## + # just shows a separator line for an 80 column console, or uses the first # parameter as the number of columns to expect. function separator() diff --git a/scripts/networking/interface_info.sh b/scripts/networking/interface_info.sh new file mode 100644 index 00000000..78f1f59f --- /dev/null +++ b/scripts/networking/interface_info.sh @@ -0,0 +1,4 @@ + +ifc="$1"; shift + +nmcli device show "$ifc" diff --git a/scripts/system/show_manually_installed.sh b/scripts/system/show_manually_installed.sh new file mode 100644 index 00000000..0db2cdda --- /dev/null +++ b/scripts/system/show_manually_installed.sh @@ -0,0 +1,5 @@ + + +#gotten from http://askubuntu.com/questions/2389/generating-list-of-manually-installed-packages-and-querying-individual-packages + +comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n s/^Package: //p | sort -u) -- 2.34.1