Bläddra i källkod

Added some scripts and updated some templates

84582af
Dirk Alders 4 år sedan
förälder
incheckning
9df35b2168
5 ändrade filer med 104 tillägg och 2 borttagningar
  1. 6
    1
      apt-extend-mint
  2. 1
    1
      latex_doc/templates/brief.tex
  3. 17
    0
      log2json
  4. 79
    0
      mkgnuplot
  5. 1
    0
      upload2etrex

+ 6
- 1
apt-extend-mint Visa fil

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

+ 1
- 1
latex_doc/templates/brief.tex Visa fil

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

+ 17
- 0
log2json Visa fil

@@ -0,0 +1,17 @@
1
+#!/usr/bin/python3
2
+#
3
+import sys
4
+import json
5
+
6
+output = []
7
+with open(sys.argv[1], 'r') as rh:
8
+    i = 1
9
+    for line in rh.readlines():
10
+        try:
11
+            data = json.loads(line)
12
+        except json.decoder.JSONDecodeError as e:
13
+            print("ERROR in Line %d" % i)
14
+            raise 
15
+        output.append(json.loads(line))
16
+        i += 1
17
+print(json.dumps(output, indent=4))

+ 79
- 0
mkgnuplot Visa fil

@@ -0,0 +1,79 @@
1
+#!/usr/bin/env python3
2
+# -*- coding: UTF-8 -*-
3
+
4
+
5
+import math
6
+import jinja2
7
+import optparse
8
+import os
9
+import shutil
10
+import time
11
+
12
+
13
+example_gnuplot = """
14
+set terminal wxt
15
+
16
+
17
+#set xdata time # tells gnuplot the x axis is time data
18
+#set timefmt '%s' # specify our time string format
19
+#set format x '%H' # otherwise it will show only MM:SS
20
+
21
+set title "GnuPlot Example"
22
+set xlabel "X"
23
+set ylabel "Y"
24
+
25
+set key autotitle columnhead
26
+set datafile separator ','
27
+
28
+plot 'example.csv' using 1:2 with lines title "title 1", \
29
+     ''            using 1:3 with lines title "title 2", \
30
+     ''            using 1:2 with lines, \
31
+     ''            using 1:3 with lines
32
+
33
+
34
+pause -1 "Hit any key to continue"
35
+"""
36
+
37
+example_csv = "x, sin(x)/x, sin(x)\n"
38
+for i in range (-500, 500):
39
+    x = 3* i * math.pi / 500
40
+    f2_x = math.sin(x)
41
+    if x == 0:
42
+        f1_x = 1
43
+    else:
44
+        f1_x = f2_x / x
45
+    example_csv += "%f, %f, %f\n" % (x, f1_x, f2_x)
46
+
47
+
48
+def mkdir(path):
49
+    """.. warning:: Needs to be documented
50
+    """
51
+    path=os.path.abspath(path)
52
+    if not os.path.exists(os.path.dirname(path)):
53
+        mkdir(os.path.dirname(path))
54
+    if not os.path.exists(path):
55
+        os.mkdir(path)
56
+    return os.path.isdir(path)
57
+
58
+
59
+if __name__ == "__main__":
60
+    parser = optparse.OptionParser("usage: %%prog [options] folder_for_document")
61
+    parser.add_option("-f", "--force", dest="force", action="store_true", default=False)
62
+    (options, args) = parser.parse_args()
63
+
64
+    if len(args) != 1:
65
+        parser.print_help()
66
+    else:
67
+        target_path = os.path.join(os.path.abspath('.'), args[0])
68
+
69
+        #
70
+        # Main Actions
71
+        #
72
+        if not os.path.exists(target_path) or options.force:
73
+            mkdir(target_path)
74
+            with open(os.path.join(target_path, 'example.gnuplot'), 'w+') as fh:
75
+                fh.write(example_gnuplot)
76
+            with open(os.path.join(target_path, 'example.csv'), 'w+') as fh:
77
+                fh.write(example_csv)
78
+        else:
79
+            print("Folder exists. Use option -f to force creation")

+ 1
- 0
upload2etrex Visa fil

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

Laddar…
Avbryt
Spara