trucos

Table of Contents

1. trucos

1.1. pdfs

1.1.1. Páginas web a pdf

1.1.2. docx a pdf

libreoffice --headless --convert-to pdf:writer_pdf_Export *.docx

1.1.4. pdf a latex

1.1.6. recrear el índice de un pdf

https://github.com/trueroad/extractpdfmark → pdf a pdfmark
https://github.com/silmeth/pdfmark-gen

  • https://github.com/Krasjet/pdf.tocgen
    1. pdftocgen: generate a table of contents from the recipe.
    2. pdftocio: import the table of contents to the PDF document.
    3. pdfxmeta: extract the metadata (font attributes, positions) of headings to build a recipe file.

1.1.7. pdf con capa de texto con tesseract

pdfmyocr es mejor

  sudo apt install tesseract-ocr
  sudo pacman -S tesseract tesseract-data-eng
  for ((i=1; i<299; i++)); do num=`printf "%.4i" $i`; filename="image_$num.jpg"; tesseract "$filename" "out/${filename%%.*}" pdf; done; pdfunite image*.pdf out.pdf

1.1.8. unir pdfs manteniendo table of contents

https://blog.dbrgn.ch/2013/8/14/merge-multiple-pdfs/

pdftk tema*.pdf cat output output.pdf

1.1.9. epub a pdf

<color grey> Complicado, nunca ha funcionado

  sudo apt-get install calibre
  sudo add-apt-repository ppa:beineri/opt-qt-5.15.0-focal && sudo apt-get update
  sudo apt-get install qt515base qt515webglplugin-no-lgpl
  pip3 install --user pyqt5  --upgrade
  export PATH="$HOME/.local/bin:$PATH:$HOME/.local/bin"
  ebook-convert book.epub book.pdf

</color>

  • https://askubuntu.com/a/954582/975037
  pandoc -s -t latex --toc --top-level-division=chapter --pdf-engine=lualatex -V linkcolor:blue -V geometry:margin=1in Book.epub -o Book.pdf

Compila con Latex, queda bonito, pero no respeta el formato del orginal
Con calibre se puede hacer también y preserva el formato sin problema

1.1.10. editar metadatos

  sudo apt install  libimage-exiftool-perl
  exiftool -Title="This is the Title" -Author="Happy Man" -Subject="PDF Metadata" drawing.pdf

1.1.11. Poner contraseña a un pdf

  • setopt histignorespace
  • qpdf --encrypt "password" "password" 256 -- "input.pdf" "output.pdf"

1.1.12. Comprimir un pdf

https://itsfoss.com/compress-pdf-linux/

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH -sOutputFile=compressed.pdf input.pdf

https://bash.cyberciti.biz/file-management/linux-shell-script-to-reduce-pdf-file-size/ If the output file is larger than the input file, then it does copy instead of compressing. Useful if you have to batch compress a lot of pdfs

1.2. videos

  ffmpeg \
    -i opengl-rotating-triangle.mp4 \
    -r 15 \
    -vf "scale=512:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
    -ss 00:00:03 -to 00:00:06 \
    opengl-rotating-triangle-palettegen.gif

Speed up gif from video

ffmpeg -i simplescreenrecorder-2022-12-20_09.17.05.mkv -filter:v "setpts=0.25*PTS" simplescreenrecorder-2022-12-20_09.17.05.gif

1.3. imágenes

Quitarle 93 píxeles de arriba y abajo a una imagen (cuidado de no sobreescribir la misma imagen que es destructivo)

convert page1.png -crop 878x1240-0\-93 -gravity North -chop 0x93 new_page1.png

1.4. otros

1.4.1. Espejar pantalla de android en ubuntu

  • Nuevo método:
  • https://github.com/Genymobile/scrcpy
  • <color grey> Seleccionar USB Debugging en el android </color>
  • <color grey> apt-get install android-tools-adb(repos de ubuntu)
    </color>
  • <color grey> Descargar de
    Google
    </color>
  • <color grey> $ java -jar asm.jar </color>

1.4.2. convertir entre md, org, latex, …

1.4.3. HDMI con sonido en avlinux

  1. Conectar HDMI en Options > Display
  2. Seleccionar en Volume > Configuration el canal HDMI (HDMI 2 cuando lo
    escribí)
  3. Volume > Output devices
  4. HDMI 2 -> Set as fallback

1.4.4. emacs

1.4.6. Copiar al portapapeles en Android 10

Google deshabilitó esta opción pero instalando una aplicación se
recupera:
https://play.google.com/store/apps/details?id=me.thomasvt.sharetoclipboard

1.5. Firefox

1.5.1. quitar la megabarra de firefox

1.6. Torrent

https://linksnappy.com -> download torrents
https://www.reddit.com/r/Piracy/comments/sy72re/quick_review_of_4_debrid_services_for_anyone/
Debrid es un sitio para descargar torrents como LinkSnappy

1.7. zip

zip -FF datos_reducidos_europe.zip --out archive_repaired.zip -fz

Author: Julian Lopez Carballal

Created: 2024-09-16 Mon 06:17