New folder structure

This commit is contained in:
2023-04-03 17:47:42 +02:00
commit a2bdf977d9
42 changed files with 2055 additions and 0 deletions

9
Tools/cleanDisk.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
#limpiar cache de paquetes
paccache -r
# Eliminar huérfanos
paquetes=$(sudo pacman -Qtdq)
sudo pacman -Rns $paquetes

View File

@@ -0,0 +1,65 @@
# run this in any directory
# add -v for verbose
# get Pillow (fork of PIL) from
# pip before running -->
# pip install Pillow
# import required libraries
import os
import sys
from PIL import Image
# define a function for
# compressing an image
def compressMe(file, verbose = False):
# Get the path of the file
filepath = os.path.join(os.getcwd(),
file)
# open the image
picture = Image.open(filepath)
# Save the picture with desired quality
# To change the quality of image,
# set the quality variable at
# your desired level, The more
# the value of quality variable
# and lesser the compression
# En porcentaje
picture.save("Compressed_"+file,
"JPEG",
optimize = True,
quality = 9)
return
# Define a main function
def main():
verbose = False
# checks for verbose flag
if (len(sys.argv)>1):
if (sys.argv[1].lower()=="-v"):
verbose = True
# finds current working dir
cwd = os.getcwd()
formats = ('.jpg', '.jpeg', '.png')
# looping through all the files
# in a current directory
for file in os.listdir(cwd):
# If the file format is JPG or JPEG
if os.path.splitext(file)[1].lower() in formats:
print('compressing', file)
compressMe(file, verbose)
print("Done")
# Driver code
if __name__ == "__main__":
main()

19
Tools/csv_to_json.py Executable file
View File

@@ -0,0 +1,19 @@
import csv
import json
def make_json(csvFilePath, jsonFilePath):
data = {}
with open(csvFilePath, encoding='UTF-8') as csvf:
csvReader = csv.DictReader(csvf)
for rows in csvReader:
key = rows['id']
data[key] = rows
with open(jsonFilePath, 'w', encoding='UTF-8') as jsonf:
jsonf.write(json.dumps(data, indent=4))
csvFilePath = r'zona_rec_filtrado.csv'
jsonFilePath = r'zona_rec.json'
make_json(csvFilePath, jsonFilePath)

BIN
Tools/gdx-setup.jar Executable file
View File

Binary file not shown.

57
Tools/generaLaTeX.sh Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/bash
home="/home/danih"
modelos="$home/Documents/Modelos"
biblio="$modelos/biblio.bib"
dir=$(pwd)
preguntaNombre() {
rofi -dmenu\
-i\
-no-fixed-num-lines\
-p "Nombre : "\
-theme ~/Scripts/Temas/confirm_visible.rasi
}
plantilla="$(rofi -no-config -no-lazy-grab -sep "|" -dmenu -i -p 'Plantilla' -width 12 -line-padding 3 -lines 3 -theme ~/Scripts/Temas/latex.rasi <<< "Base|Universidad|Simple")"
if [[ $plantilla == "" ]]; then
exit 1
fi
images=false
case "$plantilla" in
"Base")
plantilla="base.tex"
;;
"Universidad")
plantilla="usal.tex"
images=true
;;
"Simple")
plantilla="simple.tex"
;;
*)
plantilla="base.tex"
;;
esac
base=$modelos/$plantilla
nombre=$(preguntaNombre &)
if [[ $nombre == "" ]]; then
exit 1
fi
final=$(echo $nombre | awk -F'.tex' '{print $1}')
cp $biblio "$dir"
if test -f "$dir/${final}.tex"; then
cp $base "$dir/${final}$(date +"%m%d%Y").tex"
else
cp $base "$dir/$final.tex"
fi
if [[ $images == true ]]; then
cp -r "$modelos/images $dir"
fi
exit 0

35
Tools/parsekml_csv.py Executable file
View File

@@ -0,0 +1,35 @@
from pykml import parser
import csv
fields = ['lat','lng','id','nombre','superficie','web','acceso']
filename = "zona_rec_filtrado.csv"
with open (filename, 'w') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerow(fields)
with open('zona_rec.kml','r',encoding="utf-8") as f:
doc = parser.parse(f).getroot()
line = ['0','0','0','0','0','0','0']
for place in doc.Document.Folder.Placemark:
cadena = str(place.Point.coordinates)
coords = cadena.split(",")
line[0] = coords[1]
line[1] = coords[0]
contador = 0
for field in place.ExtendedData.SchemaData.SimpleData:
if (contador == 0):
atr_id = str(field)
line[2] = atr_id
contador+=1
with open('zona_rec.csv') as f:
reader = csv.DictReader(f, delimiter=',')
for row in reader:
iden = row['atr_gr_id']
name = row['equip_b_nombre']
plain = row['equip_b_superficie_aprox']
web = row['web']
access = row['equip_b_acceso_modo']
if (iden == atr_id):
line[3] = name
line[4] = plain
line[5] = web
line[6] = access
csvwriter.writerow(line)

12
Tools/teclado.py Executable file
View File

@@ -0,0 +1,12 @@
from pynput.keyboard import Key, Listener
def show(key):
print('\nYou Entered {0}'.format( key))
if key == Key.delete:
# Stop listener
return False
with Listener(on_press = show) as listener:
listener.join()

11
Tools/ttfToWoff2.py Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
# Dependencies:
# $ pip install fontTools
# $ pip install brotli
from fontTools.ttLib import TTFont
import sys
if len(sys.argv) != 2:
raise ValueError('Argumentos incorrectos:\n $ python ttfToWoff2.py fuente.tipo')
f = TTFont(sys.argv[1])
f.flavor='woff2'
f.save(sys.argv[1]+'.woff2')

6
Tools/youtubedw.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
if test $# -eq 1; then
yt-dlp -f 'ba' -x --audio-format mp3 $1 -o '%(title)s.%(ext)s'
else
echo "$ youtubedw.sh 'enlace'"
fi