Added some scripts and updated some templates

This commit is contained in:
Dirk Alders 2021-01-06 14:45:51 +01:00
parent 5a6bed1853
commit 9df35b2168
5 changed files with 104 additions and 2 deletions

View File

@ -1,8 +1,13 @@
# common
sudo apt-get install joe git
sudo apt-get install keepass2 xdotool
sudo apt-get install sshfs curlftpfs openssh-server
sudo apt-get install fonts-powerline powerline python3-powerline python3-powerline-gitstatus
# multimedia
sudo apt-get install kodi kodi-pvr-hts
sudo apt-get install evolution
# programming
sudo apt-get install python-coverage python3-coverage python-jinja2 python3-jinja2
sudo apt-get install python-wxtools python3-wxgtk4.0
sudo apt-get install texlive-binaries texlive-latex-extra texlive-lang-german texlive-fonts-recommended texstudio
sudo apt-get install fonts-powerline powerline python3-powerline python3-powerline-gitstatus
sudo apt-get install meld

View File

@ -33,7 +33,7 @@
\Datum {\VAR{short_date}}
\Telefon {06028/\,40\,70\,41}
%\Telefax {}
\Telefax {06028/\,21\,800\,69}
%\HTTP {http://mount-mockery.de}
\EMail {dirk@mount-mockery.de}

17
log2json Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/python3
#
import sys
import json
output = []
with open(sys.argv[1], 'r') as rh:
i = 1
for line in rh.readlines():
try:
data = json.loads(line)
except json.decoder.JSONDecodeError as e:
print("ERROR in Line %d" % i)
raise
output.append(json.loads(line))
i += 1
print(json.dumps(output, indent=4))

79
mkgnuplot Executable file
View File

@ -0,0 +1,79 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import math
import jinja2
import optparse
import os
import shutil
import time
example_gnuplot = """
set terminal wxt
#set xdata time # tells gnuplot the x axis is time data
#set timefmt '%s' # specify our time string format
#set format x '%H' # otherwise it will show only MM:SS
set title "GnuPlot Example"
set xlabel "X"
set ylabel "Y"
set key autotitle columnhead
set datafile separator ','
plot 'example.csv' using 1:2 with lines title "title 1", \
'' using 1:3 with lines title "title 2", \
'' using 1:2 with lines, \
'' using 1:3 with lines
pause -1 "Hit any key to continue"
"""
example_csv = "x, sin(x)/x, sin(x)\n"
for i in range (-500, 500):
x = 3* i * math.pi / 500
f2_x = math.sin(x)
if x == 0:
f1_x = 1
else:
f1_x = f2_x / x
example_csv += "%f, %f, %f\n" % (x, f1_x, f2_x)
def mkdir(path):
""".. warning:: Needs to be documented
"""
path=os.path.abspath(path)
if not os.path.exists(os.path.dirname(path)):
mkdir(os.path.dirname(path))
if not os.path.exists(path):
os.mkdir(path)
return os.path.isdir(path)
if __name__ == "__main__":
parser = optparse.OptionParser("usage: %%prog [options] folder_for_document")
parser.add_option("-f", "--force", dest="force", action="store_true", default=False)
(options, args) = parser.parse_args()
if len(args) != 1:
parser.print_help()
else:
target_path = os.path.join(os.path.abspath('.'), args[0])
#
# Main Actions
#
if not os.path.exists(target_path) or options.force:
mkdir(target_path)
with open(os.path.join(target_path, 'example.gnuplot'), 'w+') as fh:
fh.write(example_gnuplot)
with open(os.path.join(target_path, 'example.csv'), 'w+') as fh:
fh.write(example_csv)
else:
print("Folder exists. Use option -f to force creation")

1
upload2etrex Executable file
View File

@ -0,0 +1 @@
sudo gpsbabel -t -i gpx -f "$1" -o garmin -F usb: