Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77259e7f51 | ||
|
|
d1ac531af0 |
@@ -2,189 +2,47 @@
|
|||||||
|
|
||||||
Questa repository contiene i seguenti script:
|
Questa repository contiene i seguenti script:
|
||||||
|
|
||||||
- `steam-install` — [@BachoSeven](https://git.phc.dm.unipi.it/BachoSeven)
|
- `steam-install` — [@BachoSeven](https://git.phc.dm.unipi.it/BachoSeven)
|
||||||
|
|
||||||
Serve ad installare `steam` (o con poche modifiche qualsiasi AppImage) in aula
|
Serve ad installare `steam` (o con poche modifiche qualsiasi AppImage) in aula 3/4, pur non avendo FUSE installato.
|
||||||
3/4, pur non avendo FUSE installato. Per utilizzarlo, basta eseguire il
|
Per utilizzarlo, basta eseguire il seguente comando da terminale:
|
||||||
seguente comando da terminale:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -L "https://git.phc.dm.unipi.it/phc/dm-scripts/raw/branch/main/steam-install" | bash
|
curl -L "https://git.phc.dm.unipi.it/phc/dm-scripts/raw/branch/main/steam-install" | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
- `install-llm-web-interface` —
|
- `printa4` — [@BachoSeven](https://git.phc.dm.unipi.it/BachoSeven)
|
||||||
[@aziis98](https://git.phc.dm.unipi.it/aziis98)
|
|
||||||
|
|
||||||
Serve a scaricare una
|
Serve a stampare in aula4 (o qualsiasi altra stampante del dip) dal proprio computer, aprendo Okular graficamente da remoto.
|
||||||
[web-ui per usare LLM](https://github.com/oobabooga/text-generation-webui/) in
|
|
||||||
locale in Aula 3/4. Per utilizzarlo, basta eseguire il seguente comando da
|
|
||||||
terminale
|
|
||||||
|
|
||||||
```bash shell
|
- `impagina` — [@BachoSeven](https://git.phc.dm.unipi.it/BachoSeven)
|
||||||
$ curl -LO "https://git.phc.dm.unipi.it/phc/dm-scripts/raw/branch/main/install-llm-web-interface"
|
|
||||||
$ chmod +x install-llm-web-interface
|
|
||||||
|
|
||||||
# La prima volta che lo si esegue, bisogna installare i pacchetti necessari
|
Impagina un pdf in modo da poi poterlo stampare "a libretto", usando l'opzione fronte-retro (lato corto), per poi tagliare e sovrapporre una metà sull'altra.
|
||||||
$ ./install-llm-web-interface
|
|
||||||
|
|
||||||
# Le volte successive, si può eseguire questo per impostare una porta specifica
|
Dipendenze: `pdftk`, `pdfjam` (parte di TeXlive), `groff` (non solo `groff-base`)
|
||||||
$ ./install-llm-web-interface --listen-port 8080
|
|
||||||
```
|
|
||||||
|
|
||||||
Nel frattempo, è possibile usare LLM in locale aprendo il browser
|
- `bookletify` — [@Fran314](https://git.phc.dm.unipi.it/Fran314)
|
||||||
all'indirizzo `http://localhost:8080` oppure se si sta usando ssh aprendo un
|
|
||||||
tunnel con
|
|
||||||
|
|
||||||
```bash shell
|
Simile a `impagina`, ma in python. Formatta un pdf in modo da poi poterlo stampare "a libretto" tagliando chiudendolo come un libro.
|
||||||
$ ssh -L 8080:localhost:8080 <username>@a3-dott8.cs.dm.unipi.it
|
|
||||||
```
|
|
||||||
|
|
||||||
e poi aprendo il browser all'indirizzo `http://localhost:8080`.
|
Supporta:
|
||||||
|
- trim
|
||||||
|
- diversi tipi di paper size (A4 di default, per poter mandare in stampa senza dover mettere "fit-to-page")
|
||||||
|
- aggiunta di un bordo interno (a sinistra per le pagine dispari, a destra per le pagine pari) per la rilegatura
|
||||||
|
- pipe da stdin / a stdout
|
||||||
|
|
||||||
|
Dipendenze: `PyPDF2`
|
||||||
|
|
||||||
Una volta nell'interfaccia web si può scaricare un modello di LLM (ad esempio
|
- `pokepixel` — [@Fran314](https://git.phc.dm.unipi.it/Fran314)
|
||||||
<https://huggingface.co/TheBloke/Orca-2-7B-GGUF>) andando nella tab "Models"
|
|
||||||
ed inserendo l'ID da huggingface (e.g. `TheBloke/Orca-2-7B-GGUF` ed il nome
|
|
||||||
del singolo file `orca-2-7b.Q5_K_M.gguf`), poi premere "Refresh" e poi "Load"
|
|
||||||
nella lista dei modelli per selezionarlo (conviene tenere sotto'occhio il
|
|
||||||
terminare per vedere quando ha finito di scaricare il modello). Una volta
|
|
||||||
caricato il modello, si può andare in "Chat" per usarlo.
|
|
||||||
|
|
||||||
- `printa4` — [@BachoSeven](https://git.phc.dm.unipi.it/BachoSeven)
|
Permette di "disegnare" a terminale degli sprite di pokemon presi da [questa repo](https://github.com/msikma/pokesprite/)
|
||||||
|
|
||||||
Serve a stampare in aula4 (o qualsiasi altra stampante del dip) dal proprio
|
Ad esempio `pokepixel latias.png` cerca un file di nome `latias.png` nella cartella corrente. Se lo trova renderizza quello, altrimenti lo cerca nella repo linkata. Per ora funziona solo con i pokemon fino alla 7a gen non shiny
|
||||||
computer, aprendo Okular graficamente da remoto.
|
|
||||||
|
|
||||||
- `impagina` — [@BachoSeven](https://git.phc.dm.unipi.it/BachoSeven)
|
- `gobbino` — [@BachoSeven](https://git.phc.dm.unipi.it/BachoSeven) + [@Dilillo](http://poisson.phc.dm.unipi.it/~dilillo/Vario/index.html)
|
||||||
|
|
||||||
Impagina un pdf in modo da poi poterlo stampare "a libretto", usando l'opzione
|
Permette di scaricare video e/o pdf di qualsiasi corso presente sul sito del professor Gobbino
|
||||||
fronte-retro (lato corto), per poi tagliare e sovrapporre una metà sull'altra.
|
|
||||||
|
|
||||||
Dipendenze: `pdftk`, `pdfjam` (parte di TeXlive), `groff` (non solo
|
- `pdfcompress` — [@aziis98](https://git.phc.dm.unipi.it/aziis98) (script preso in prestito [da questa repo](https://git.phc.dm.unipi.it/aziis98/chatgpt-scripts/src/branch/main/bin/pdfcompress2))
|
||||||
`groff-base`)
|
|
||||||
|
|
||||||
- `bookletify` — [@Fran314](https://git.phc.dm.unipi.it/Fran314)
|
Comprime un PDF vettorizzato (ad esempio note scritte su un iPad) utilizzando poppler (file di ~100MB diventa tranquillamente di ~10MB)
|
||||||
|
|
||||||
Simile a `impagina`, ma in python. Formatta un pdf in modo da poi poterlo
|
|
||||||
stampare "a libretto" tagliando chiudendolo come un libro.
|
|
||||||
|
|
||||||
Supporta:
|
|
||||||
- trim
|
|
||||||
- diversi tipi di paper size (A4 di default, per poter mandare in stampa senza
|
|
||||||
dover mettere "fit-to-page")
|
|
||||||
- aggiunta di un bordo interno (a sinistra per le pagine dispari, a destra per
|
|
||||||
le pagine pari) per la rilegatura
|
|
||||||
- pipe da stdin / a stdout
|
|
||||||
|
|
||||||
Dipendenze: `PyPDF2`
|
|
||||||
|
|
||||||
- `pokepixel` — [@Fran314](https://git.phc.dm.unipi.it/Fran314)
|
|
||||||
|
|
||||||
Permette di "disegnare" a terminale degli sprite di pokemon presi da
|
|
||||||
[questa repo](https://github.com/msikma/pokesprite/)
|
|
||||||
|
|
||||||
Ad esempio `pokepixel latias.png` cerca un file di nome `latias.png` nella
|
|
||||||
cartella corrente. Se lo trova renderizza quello, altrimenti lo cerca nella
|
|
||||||
repo linkata. Per ora funziona solo con i pokemon fino alla 7a gen non shiny
|
|
||||||
|
|
||||||
- `gobbino` — [@BachoSeven](https://git.phc.dm.unipi.it/BachoSeven) +
|
|
||||||
[@Dilillo](http://poisson.phc.dm.unipi.it/~dilillo/Vario/index.html)
|
|
||||||
|
|
||||||
Permette di scaricare video e/o pdf di qualsiasi corso presente sul sito del
|
|
||||||
professor Gobbino
|
|
||||||
|
|
||||||
- `pdfcompress` — [@aziis98](https://git.phc.dm.unipi.it/aziis98) (script
|
|
||||||
preso in prestito
|
|
||||||
[da questa repo](https://git.phc.dm.unipi.it/aziis98/chatgpt-scripts/src/branch/main/bin/pdfcompress2))
|
|
||||||
|
|
||||||
Comprime un PDF vettorizzato (ad esempio note scritte su un iPad) utilizzando
|
|
||||||
poppler (file di ~100MB diventa tranquillamente di ~10MB)
|
|
||||||
|
|
||||||
- `pptx_to_pdf` — [@lukefleed](https://git.phc.dm.unipi.it/lukefleed)
|
|
||||||
|
|
||||||
Permette di convertire tutti i file .pptx dentro una cartella in file .pdf.
|
|
||||||
Per utilizzarlo, basta eseguire lo script da terminale nella cartella dove
|
|
||||||
sono presenti i file `.pptx`
|
|
||||||
|
|
||||||
I nuovi file `.pdf`verranno salvati nella cartella `pdf` (che verrà creata
|
|
||||||
automaticamente se non esiste già). Per poter eseguire lo script, è necessario
|
|
||||||
avere installati i seguenti pacchetti (ubuntu):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt install libreoffice default-jre libreoffice-java-common
|
|
||||||
```
|
|
||||||
|
|
||||||
- `removeproofs` — [@lukefleed](https://git.phc.dm.unipi.it/lukefleed)
|
|
||||||
|
|
||||||
Rimuove le dimostrazioni da un file `.tex`, utile per creare piccoli cheat
|
|
||||||
sheet da portare agli esami dove è consentito portare materiale di studio.
|
|
||||||
|
|
||||||
Utilizzo:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
removeproofs <file.tex>
|
|
||||||
```
|
|
||||||
|
|
||||||
Questo script è stato utilizzato per creare dei riassunti di Geometria 2 da
|
|
||||||
delle dispense più complete:
|
|
||||||
[G2-cheat-sheet](https://github.com/lukefleed/G2-cheat-sheet)
|
|
||||||
|
|
||||||
- `tex_to_md` — [@lukefleed](https://git.phc.dm.unipi.it/lukefleed)
|
|
||||||
|
|
||||||
Script che prende in input un file `.tex` da in output un file `.md`
|
|
||||||
contenente un elenco puntato di tutte le definizioni, teoremi e proposizioni
|
|
||||||
presenti nel file `.tex`. Utile per creare un riassunto degli argomenti di un
|
|
||||||
corso da utilizzare per preparare l'orale.
|
|
||||||
|
|
||||||
Utilizzo:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
tex_to_md <input.tex> <output.md>
|
|
||||||
```
|
|
||||||
|
|
||||||
Qui un esempio di utilizzo:
|
|
||||||
[Argomenti di G2](https://git.phc.dm.unipi.it/lukefleed/domande-orali/src/branch/master/geoemtria-2)
|
|
||||||
|
|
||||||
- `parseunimap` — [@aziis98](https://git.phc.dm.unipi.it/aziis98) +
|
|
||||||
[@alberto](https://git.phc.dm.unipi.it/alberto)
|
|
||||||
|
|
||||||
Script che converte il registro delle lezioni dell'Unipi in markdown
|
|
||||||
|
|
||||||
Installare:
|
|
||||||
```bash
|
|
||||||
bun init
|
|
||||||
bun install jsdom
|
|
||||||
bun install node-fetch
|
|
||||||
```
|
|
||||||
|
|
||||||
Per eseguire:
|
|
||||||
```bash
|
|
||||||
bun run script.js <registro_link>
|
|
||||||
```
|
|
||||||
Una volta ottenuto in output il file markdown, è possibile convertirlo in pdf
|
|
||||||
utilizzando ad esempio Pandoc tramite il comando
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pandoc fileregistro.md -o fileregistro.pdf
|
|
||||||
```
|
|
||||||
|
|
||||||
- `scritti_ro.sh` [@alberto](https://git.phc.dm.unipi.it/alberto)
|
|
||||||
|
|
||||||
Scarica tutti i PDF di **Testi** (o **Svolgimenti**) dalla
|
|
||||||
[pagina DidaWiki del corso](https://didawiki.cli.di.unipi.it/doku.php/matematica/ro/start)
|
|
||||||
e li unisce in un unico PDF.
|
|
||||||
|
|
||||||
Utilizzo:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# unisce tutti i PDF dei Testi
|
|
||||||
./scritti_ro.sh
|
|
||||||
|
|
||||||
# unisce tutti i PDF degli Svolgimenti
|
|
||||||
./scritti_ro.sh --with-solutions
|
|
||||||
```
|
|
||||||
|
|
||||||
Output: `testi_unificati.pdf` o `soluzioni_unificati.pdf`.
|
|
||||||
|
|
||||||
Dipendenze:
|
|
||||||
|
|
||||||
- `curl`, `grep`, `gs` (ghostscript)
|
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
export HOME="/tmp/$USER"
|
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
|
||||||
mkdir -p "$HOME"
|
|
||||||
echo "Home moved to /tmp/$USER because of space constraints, this will last only for this session."
|
|
||||||
|
|
||||||
cd "$HOME" || exit 1
|
|
||||||
|
|
||||||
# Install text-generation-webui
|
|
||||||
if [ ! -d "$HOME/text-generation-webui" ]; then
|
|
||||||
git clone https://github.com/oobabooga/text-generation-webui
|
|
||||||
else
|
|
||||||
git -C "$HOME/text-generation-webui" pull
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install requirements and start webui
|
|
||||||
export GPU_CHOICE="A"
|
|
||||||
export USE_CUDA118="Y"
|
|
||||||
bash "$HOME/text-generation-webui/start_linux.sh" "$@"
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
import {createWriteStream} from 'fs';
|
|
||||||
import {JSDOM} from "jsdom";
|
|
||||||
import fetch from "node-fetch";
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
try {
|
|
||||||
const url = process.argv[2];
|
|
||||||
if (!url) {
|
|
||||||
console.error("Usage: node script.js <registro_link>");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const response =
|
|
||||||
await fetch(url, {headers : {"User-Agent" : "Mozilla/5.0"}});
|
|
||||||
const buffer = await response.arrayBuffer();
|
|
||||||
const isoHtml = Buffer.from(buffer, "binary").toString("latin1");
|
|
||||||
|
|
||||||
const dom = new JSDOM(isoHtml);
|
|
||||||
const document = dom.window.document;
|
|
||||||
|
|
||||||
let ol = document.querySelector("ol");
|
|
||||||
if (!ol) {
|
|
||||||
console.error("No <ol> found on the page");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.querySelectorAll("a, i").forEach(el => el.remove());
|
|
||||||
|
|
||||||
const results = [...ol.children ]
|
|
||||||
.map(li => li.textContent.match(/\w+:(.+)/sm))
|
|
||||||
.filter(match => match)
|
|
||||||
.map(match => match[1].trim())
|
|
||||||
.map((x, index) => (index + 1) + ". " + x + " \n");
|
|
||||||
|
|
||||||
const writeStream = createWriteStream("registro.md")
|
|
||||||
const pathName = writeStream.path;
|
|
||||||
writeStream.on('error', function(err) { /* error handling */ });
|
|
||||||
const head = "# Registro delle lezioni \n\n";
|
|
||||||
writeStream.write(head)
|
|
||||||
results.forEach(value => writeStream.write(`${value}`));
|
|
||||||
// the finish event is emitted when all data has been flushed from the
|
|
||||||
// stream
|
|
||||||
writeStream.on(
|
|
||||||
'finish',
|
|
||||||
() => { console.log(`Registro salvato nel file ${pathName}`); });
|
|
||||||
|
|
||||||
// handle the errors on the write process
|
|
||||||
writeStream.on(
|
|
||||||
'error',
|
|
||||||
(err) => {console.error(
|
|
||||||
`There is an error writing the file ${pathName} => ${err}`)});
|
|
||||||
|
|
||||||
// close the stream
|
|
||||||
writeStream.end();
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error fetching or processing page:", error);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
Executable → Regular
-20
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Create the pdf folder if it doesn't exist
|
|
||||||
mkdir -p pdf
|
|
||||||
|
|
||||||
# Iterate through all .pptx files in the current folder
|
|
||||||
for file in *.pptx; do
|
|
||||||
if [ -f "$file" ]; then
|
|
||||||
# Extract the base name (without extension) of the file
|
|
||||||
base_name=$(basename "$file" .pptx)
|
|
||||||
|
|
||||||
# Convert the .pptx file to .pdf and save it in the pdf folder
|
|
||||||
libreoffice --headless --convert-to pdf --outdir pdf "$file"
|
|
||||||
|
|
||||||
echo "Converted $file to pdf/$base_name.pdf"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Conversion complete!"
|
|
||||||
|
|
||||||
@@ -40,11 +40,11 @@ Opzioni disponibili:
|
|||||||
|
|
||||||
Ad esempio:
|
Ad esempio:
|
||||||
|
|
||||||
$(basename "$0") -u n.cognome ~/GAAL.pdf
|
$(basename "$0") ~/GAAL.pdf
|
||||||
|
|
||||||
$(basename "$0") -u n.cognome alg2.pdf commRingTheory.pdf
|
$(basename "$0") alg2.pdf commRingTheory.pdf
|
||||||
|
|
||||||
$(basename "$0") -u n.cognome --cli '-o sides=two-sided-short-edge' MR-impaginato.pdf
|
$(basename "$0") --cli '-o sides=two-sided-short-edge' MR-impaginato.pdf
|
||||||
|
|
||||||
N.B.: L'opzione --cli usa le opzioni necessarie per poter stampare un file
|
N.B.: L'opzione --cli usa le opzioni necessarie per poter stampare un file
|
||||||
creato con lo script "impagina", per rilegare le dispense a libretto in A5.
|
creato con lo script "impagina", per rilegare le dispense a libretto in A5.
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
|
||||||
echo "Usage: $0 <input_tex_file>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
input_file=$1
|
|
||||||
output_file="${input_file%.tex}_without_proofs.tex"
|
|
||||||
|
|
||||||
awk '/\\begin{proof}/, /\\end{proof}/ {next} 1' "$input_file" > "$output_file"
|
|
||||||
|
|
||||||
echo "Lines between \\begin{proof} and \\end{proof} have been removed. Output saved to: $output_file"
|
|
||||||
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
URL="https://didawiki.cli.di.unipi.it/doku.php/matematica/ro/start"
|
|
||||||
BASE="https://didawiki.cli.di.unipi.it"
|
|
||||||
TMPDIR=$(mktemp -d)
|
|
||||||
|
|
||||||
cleanup() { rm -rf "$TMPDIR"; }
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
if [[ "${1:-}" == "--with-solutions" ]]; then
|
|
||||||
PREFIX="sc"
|
|
||||||
OUTFILE="soluzioni_ro_merge.pdf"
|
|
||||||
echo "Fetching Svolgimenti PDFs..."
|
|
||||||
else
|
|
||||||
PREFIX="c"
|
|
||||||
OUTFILE="testi_ro_merge.pdf"
|
|
||||||
echo "Fetching Testi PDFs..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
curl -s "$URL" \
|
|
||||||
| grep -oP "/lib/exe/fetch\.php/matematica/ro/${PREFIX}\d{6}\.pdf" \
|
|
||||||
| sort -u \
|
|
||||||
| while read -r path; do
|
|
||||||
filename=$(basename "$path")
|
|
||||||
echo " Downloading $filename"
|
|
||||||
curl -s -o "$TMPDIR/$filename" "${BASE}${path}"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Merging PDFs into $OUTFILE..."
|
|
||||||
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="$OUTFILE" "$TMPDIR"/*.pdf
|
|
||||||
|
|
||||||
echo "Done → $OUTFILE ($(wc -c < "$OUTFILE") bytes)"
|
|
||||||
Executable → Regular
+14
-28
@@ -1,38 +1,24 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -xeo pipefail
|
# Installs the AppImage for steam
|
||||||
|
|
||||||
# Variables
|
APP=Steam-202310201446-x86_64.AppImage
|
||||||
APP=Steam-x86_64.AppImage
|
|
||||||
NAME=steam
|
NAME=steam
|
||||||
URL="https://github.com/ivan-hc/Steam-appimage/releases/download/continuous/Steam-202402170551-x86_64.AppImage"
|
URL="https://github.com/ivan-hc/Steam-appimage/releases/download/continuous/Steam-202310201446-x86_64.AppImage"
|
||||||
LOCAL_BIN_DIR=$HOME/.local/bin
|
|
||||||
DESKTOP_DIR=$HOME/.local/share/applications
|
|
||||||
|
|
||||||
# Ensure local bin directory is in PATH
|
mkdir -p $HOME/.local/bin
|
||||||
if [[ ! ":$PATH:" == *":$LOCAL_BIN_DIR:"* ]]; then
|
echo "export PATH=$PATH:$HOME/.local/bin" >> .bashrc
|
||||||
echo "export PATH=\$PATH:$LOCAL_BIN_DIR" >> $HOME/.bashrc
|
echo "export PATH=$PATH:$HOME/.local/bin" >> .bash_profile
|
||||||
echo "export PATH=\$PATH:$LOCAL_BIN_DIR" >> $HOME/.bash_profile
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install Steam AppImage
|
|
||||||
cd /tmp
|
cd /tmp
|
||||||
curl -L $URL -o $APP
|
curl -LO $URL
|
||||||
chmod +x $APP
|
chmod +x $APP
|
||||||
./$APP --appimage-extract
|
./$APP --appimage-extract
|
||||||
mv squashfs-root $HOME/$NAME
|
mv squashfs-root $HOME/$NAME
|
||||||
|
|
||||||
# Create symbolic link to AppRun
|
cd $HOME/$NAME
|
||||||
ln -sf "$(realpath $HOME/$NAME/AppRun)" $LOCAL_BIN_DIR/$NAME
|
ln -sf $(realpath AppRun) $HOME/.local/bin/$NAME
|
||||||
|
desktop-file-install --dir="$HOME/.local/share/applications" $NAME.desktop
|
||||||
# Install desktop entry
|
sed -i "s|Exec=$NAME|Exec=$HOME/.local/bin/$NAME|g" $HOME/.local/share/applications/$NAME.desktop
|
||||||
desktop-file-install --dir="$DESKTOP_DIR" $HOME/$NAME/$NAME.desktop
|
gio set "$HOME/.local/share/applications/$NAME.desktop" "metadata::trusted" true
|
||||||
|
rm -rf /tmp/$APP
|
||||||
# Update desktop entry
|
|
||||||
sed -i "s|Exec=$NAME|Exec=$LOCAL_BIN_DIR/$NAME|g" $DESKTOP_DIR/$NAME.desktop
|
|
||||||
|
|
||||||
# Mark desktop entry as trusted
|
|
||||||
gio set "$DESKTOP_DIR/$NAME.desktop" "metadata::trusted" true
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf /tmp/$APP
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ $# -ne 2 ]; then
|
|
||||||
echo "Usage: $0 input.tex output.md"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
input_file="$1"
|
|
||||||
output_file="$2"
|
|
||||||
|
|
||||||
# Funzione per convertire le sezioni
|
|
||||||
convert_section() {
|
|
||||||
local level=$1
|
|
||||||
local name=$2
|
|
||||||
echo -e "$(printf '#%.0s' $(seq 1 $level)) $name\n" >> "$output_file"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Funzione per convertire definizioni, teoremi e proposizioni
|
|
||||||
convert_definition_or_theorem_or_proposition() {
|
|
||||||
local type=$1
|
|
||||||
local name=$2
|
|
||||||
if [[ $type == "teorema" || $type == "proposizione" ]]; then
|
|
||||||
echo "* [ ] [**$type**] $name" >> "$output_file"
|
|
||||||
else
|
|
||||||
echo "* [ ] [$type] $name" >> "$output_file"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Inizializza il file di output
|
|
||||||
> "$output_file"
|
|
||||||
|
|
||||||
# Leggi il file .tex e converti le sezioni, definizioni, teoremi e proposizioni
|
|
||||||
while IFS= read -r line; do
|
|
||||||
if [[ $line =~ \\section\{(.+)} ]]; then
|
|
||||||
convert_section 1 "${BASH_REMATCH[1]}"
|
|
||||||
elif [[ $line =~ \\subsection\{(.+)} ]]; then
|
|
||||||
convert_section 2 "${BASH_REMATCH[1]}"
|
|
||||||
elif [[ $line =~ \\subsubsection\{(.+)} ]]; then
|
|
||||||
convert_section 3 "${BASH_REMATCH[1]}"
|
|
||||||
elif [[ $line =~ \\begin\{definition\}\[(.+)\] ]]; then
|
|
||||||
convert_definition_or_theorem_or_proposition "definizione" "${BASH_REMATCH[1]}"
|
|
||||||
elif [[ $line =~ \\begin\{theorem\}\[(.+)\](\{.+})? ]]; then
|
|
||||||
convert_definition_or_theorem_or_proposition "teorema" "${BASH_REMATCH[1]}"
|
|
||||||
elif [[ $line =~ \\begin\{proposition\}\[(.+)\] ]]; then
|
|
||||||
convert_definition_or_theorem_or_proposition "proposizione" "${BASH_REMATCH[1]}"
|
|
||||||
fi
|
|
||||||
done < "$input_file"
|
|
||||||
Reference in New Issue
Block a user