Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
77259e7f51 | 2 years ago |
|
|
d1ac531af0 | 2 years ago |
@ -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);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
@ -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!"
|
|
||||||
|
|
||||||
@ -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,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
|
||||||
|
|
||||||
# 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
|
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"
|
|
||||||
Loading…
Reference in New Issue