summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-12-06 10:40:21 +0100
committerFlorian Pritz <bluewind@xinu.at>2015-12-06 10:40:21 +0100
commit151b606189542704f787cfd550651fbb5bbb628e (patch)
tree01eb9e1d94c503257d0718b0359a0fbfed0ec727
parent8d8c5681e39d60ab9c826fc766a5ef0d9ab03916 (diff)
downloadbin-151b606189542704f787cfd550651fbb5bbb628e.tar.gz
bin-151b606189542704f787cfd550651fbb5bbb628e.tar.xz
Add scripts
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xflatten-latex31
-rwxr-xr-xhttpscert3
-rwxr-xr-xhttpstest5
-rwxr-xr-xsort-images11
4 files changed, 50 insertions, 0 deletions
diff --git a/flatten-latex b/flatten-latex
new file mode 100755
index 0000000..59d8d9b
--- /dev/null
+++ b/flatten-latex
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+"""Convert a master latex file,
+into a single document by including
+automatically all the LaTeX documents
+which are arguments of
+\include or \input
+ignoring any \includeonly
+"""
+import sys
+if len(sys.argv)==3:
+ masterfile=sys.argv[1]
+ flattenfile=sys.argv[2]
+else:
+ sys.exit('USAGE: %s masterfile.tex flattenfile.tex' %sys.argv[0])
+
+filetex=open(masterfile,'r')
+texlist=filetex.readlines()
+finaltex=open(flattenfile,'w')
+for i in texlist:
+ if i.find(r'\input{')==0 or i.find(r'\include{')==0:
+ includetex=open(i.split('{')[-1].split('}')[0]+'.tex','r')
+ finaltex.write(includetex.read())
+ finaltex.write('\n')
+ elif i.find(r'\includeonly{')==0:
+ finaltex.write(i.replace(r'\includeonly{',r'%\includeonly{'))
+ else:
+ finaltex.write(i)
+
+
+filetex.close()
+finaltex.close() \ No newline at end of file
diff --git a/httpscert b/httpscert
new file mode 100755
index 0000000..c2834c0
--- /dev/null
+++ b/httpscert
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+httpstest $1 | sed -n '/-----BEGIN/,/-----END/p' | openssl x509 -text
diff --git a/httpstest b/httpstest
new file mode 100755
index 0000000..e4fb0da
--- /dev/null
+++ b/httpstest
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# usage: httpstest <domain>
+
+openssl s_client -servername $1 -connect $1:443 </dev/null
diff --git a/sort-images b/sort-images
new file mode 100755
index 0000000..8f64811
--- /dev/null
+++ b/sort-images
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+perl-rename -v 'BEGIN{use Image::ExifTool qw(ImageInfo); use Date::Parse; use Date::Format;}; $data = ImageInfo($_); $date = time2str("%Y-%m-%d", str2time($data->{FileModifyDate})); $_ = "$date/$_";' "$@"
+
+# the same in slow
+#for i in "$@"; do
+ #[[ -d "$i" ]] && continue
+ #dir=$(exiftool "$i" | grep "File Modification Date/Time" | sed -rn "s/.*: ([0-9]{4}):([0-9]{2}):([0-9]{2}) .*/\1-\2-\3/p")
+ #mkdir -p "$dir"
+ #mv -nv "$i" "$dir/$(basename "$i")"
+#done