diff options
author | Aaron LI <aly@aaronly.me> | 2017-11-03 18:25:35 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-11-03 18:25:35 +0800 |
commit | 61a2aeeadfecd2a9f57a2727e63123f96e09d846 (patch) | |
tree | ddabf37c5a306c600af3e58e23f336f1a9f72127 /unix | |
parent | 3e11b2841e85a9d82d88d463479a5e0ff49a7a27 (diff) | |
download | atoolbox-61a2aeeadfecd2a9f57a2727e63123f96e09d846.tar.bz2 |
Remove some duplicate scripts
Diffstat (limited to 'unix')
-rwxr-xr-x | unix/pdfmerge.sh | 23 | ||||
-rwxr-xr-x | unix/shrinkpdf.sh | 50 | ||||
-rwxr-xr-x | unix/term_color_3.sh | 33 | ||||
-rwxr-xr-x | unix/unzip-gbk.py | 26 |
4 files changed, 0 insertions, 132 deletions
diff --git a/unix/pdfmerge.sh b/unix/pdfmerge.sh deleted file mode 100755 index aef72db..0000000 --- a/unix/pdfmerge.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# -# Merge multiple PDFs with pdftk. -# -# Ref: -# Merging Multiple PDFs under GNU/Linux -# https://blog.dbrgn.ch/2013/8/14/merge-multiple-pdfs/ -# -# Weitian LI -# 2015/01/23 -# - -if [ $# -lt 2 ]; then - printf "Usage: `basename $0` out.pdf in1.pdf ...\n" - exit 1 -fi - -outpdf="$1" -shift - -echo "Input files: $@" -pdftk "$@" cat output "${outpdf}" - diff --git a/unix/shrinkpdf.sh b/unix/shrinkpdf.sh deleted file mode 100755 index 56acef3..0000000 --- a/unix/shrinkpdf.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -case "$1" in - -[hH]*|--[hH]*) - printf "usage:\n" - printf " `basename $0` in=<input.pdf> out=<output.pdf> quality=<screen|ebook|printer|prepress> imgdpi=<img_dpi>\n" - exit 1 - ;; -esac - -getopt_keyval() { - until [ -z "$1" ] - do - key=${1%%=*} # extract key - val=${1#*=} # extract value - keyval="${key}=\"${val}\"" - echo "## getopt: eval '${keyval}'" - eval ${keyval} - shift # shift, process next one - done -} -getopt_keyval "$@" - -if [ -z "${in}" ] || [ -z "${out}" ]; then - printf "Error: 'in' or 'out' not specified\n" - exit 2 -fi -quality=${quality:-ebook} -imgdpi=${imgdpi:-120} - -printf "# in: ${in} -# out: ${out} -# quality: ${quality} -# imgdpi: ${imgdpi}\n" - -gs -dNOPAUSE -dBATCH -dSAFER \ - -sDEVICE=pdfwrite \ - -dCompatibilityLevel=1.4 \ - -dPDFSETTINGS="/${quality}" \ - -dEmbedAllFonts=true \ - -dSubsetFonts=true \ - -dColorImageDownsampleType=/Bicubic \ - -dColorImageResolution=${imgdpi} \ - -dGrayImageDownsampleType=/Bicubic \ - -dGrayImageResolution=${imgdpi} \ - -dMonoImageDownsampleType=/Bicubic \ - -dMonoImageResolution=${imgdpi} \ - -sOutputFile=${out} \ - ${in} - diff --git a/unix/term_color_3.sh b/unix/term_color_3.sh deleted file mode 100755 index 85b499a..0000000 --- a/unix/term_color_3.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash -# Original: http://frexx.de/xterm-256-notes/ -# http://frexx.de/xterm-256-notes/data/colortable16.sh -# Modified by Aaron Griffin -# and further by Kazuo Teramoto - - -FGNAMES=(' black ' ' red ' ' green ' ' yellow' ' blue ' 'magenta' ' cyan ' ' white ') -BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT') -echo " ----------------------------------------------------------------------------" -for b in $(seq 0 8); do - if [ "$b" -gt 0 ]; then - bg=$(($b+39)) - fi - - echo -en "\033[0m ${BGNAMES[$b]} : " - for f in $(seq 0 7); do - echo -en "\033[${bg}m\033[$(($f+30))m ${FGNAMES[$f]} " - done - echo -en "\033[0m :" - - echo -en "\033[0m\n\033[0m : " - for f in $(seq 0 7); do - echo -en "\033[${bg}m\033[1;$(($f+30))m ${FGNAMES[$f]} " - done - echo -en "\033[0m :" - echo -e "\033[0m" - - if [ "$b" -lt 8 ]; then - echo " ----------------------------------------------------------------------------" - fi -done -echo " ----------------------------------------------------------------------------" diff --git a/unix/unzip-gbk.py b/unix/unzip-gbk.py deleted file mode 100755 index 423e10f..0000000 --- a/unix/unzip-gbk.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# unzip-gbk.py -# -# http://note.ninehills.info/linux-gbk.html -# - -import os -import sys -import zipfile - -print "Processing File " + sys.argv[1] - -file=zipfile.ZipFile(sys.argv[1],"r"); -for name in file.namelist(): - utf8name=name.decode('gbk') - print "Extracting " + utf8name - pathname = os.path.dirname(utf8name) - if not os.path.exists(pathname) and pathname!= "": - os.makedirs(pathname) - data = file.read(name) - if not os.path.exists(utf8name): - fo = open(utf8name, "w") - fo.write(data) - fo.close -file.close() |