Skip to content

Instantly share code, notes, and snippets.

View ajb0wers's full-sized avatar
:octocat:
./configure && make

ajb0wers

:octocat:
./configure && make
View GitHub Profile
@ajb0wers
ajb0wers / pdf-annoyances.md
Last active May 6, 2025 16:09
PDF annoyances
# Ghostscript password removal
gs -dNOPAUSE -dBATCH -q -sDEVICE=pdfwrite \
  -sPDFPassword="${PDF_PASSWORD}" -sOutputFile=output.pdf -f input.pdf
  
# qpdf decrypt removing password
# https://jade.fyi/blog/workflow-pdfs/
qpdf --password="${PDF_PASSWORD}" --decrypt input.pdf output.pdf
@ajb0wers
ajb0wers / yt-dlp.md
Last active May 26, 2025 05:47
yt-dlp, read browser cookies

Organise filenames matching, .*[%(id)s].{webm,mp4,mkv}, into directories.

for f in *.{webm,mp4,mkv}; do
    vid=$(printf "%s" "${f}" | sed -E 's/.*\[(.*)\].*$/\1/' ) &&
    upid=$(yt -o "%(uploader_id)s" --print filename -- "${vid}") &&
    mkdir -p "${upid}" &&
    mv -v -t "${upid}" "${f}" 
done  
@ajb0wers
ajb0wers / pwsafe-tsv.md
Last active April 25, 2025 04:40
Convert a passwordsafe XML (pwsafe.xml) to tsv format

Fedora 42, removed the passwordsafe package. Thus the impetus to migrate to KeePassXC. This bash script converts pwsafe.xml to tsv. Using yq to output tsv and awk to replace . seperator with / in the group name.

yq -o tsv '
[["group","title","username","password","url","email","runcommand","notes"]] +
[.passwordsafe.entry[] |
[.group,.title,.username,.password,.url,.email,.runcommand,.notes]]' pwsafe.xml \
| awk -v OFS='\t' '{ gsub(/[.]/, "/" , $1); print }' -