Skip to content

Instantly share code, notes, and snippets.

View glowinthedark's full-sized avatar

glowinthedark glowinthedark

  • URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
  • HTTPError: HTTP Error 403: Forbidden
View GitHub Profile
@glowinthedark
glowinthedark / pyqt5_pdf_viewer.py
Last active May 7, 2024 01:41
Python simple PDF viewer using PyQt5 and mozilla's pdf.js
#!/usr/bin/env python3
import sys
from pathlib import Path
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import *
# REQUIREMENTS
@glowinthedark
glowinthedark / nllb200_translate.py
Last active April 27, 2024 16:35
Text translation with facebook/nllb-200-3.3B model
#!/usr/bin/env python3
# Dependencies
# =============================
# pip install nltk transformers
import argparse
import sys
from pathlib import Path
@glowinthedark
glowinthedark / image-gallery-generator-with-thumbnails-v2.md
Last active March 15, 2024 12:30
Script to generate a static HTML image gallery file with thumbnail generation using imagemagick and keyboard navigation; support for images, audio, video
@glowinthedark
glowinthedark / generate_directory_index_caddystyle.py
Last active February 16, 2024 21:58
Generate directory index (recurse subfolders with `-r` or `--recursive`). Use `-h` or `--help` for all options ❗️superseded by https://github.com/glowinthedark/index-html-generator
#!/usr/bin/env python3
# NOTE: this script is deprecated;
# maintained version with SVG icons: https://github.com/glowinthedark/index-html-generator/
# ---
# Copyright 2020 glowinthedark
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@glowinthedark
glowinthedark / image-gallery-generator-with-thumbnails.py
Last active February 14, 2024 20:32
Script to generate a static HTML image gallery file with thubnails generation using imagemagick https://gist.github.com/glowinthedark/75ae05cb0052cc6c99697278bb2d9f7d
We couldn’t find that file to show.
@glowinthedark
glowinthedark / image-gallery.py
Last active February 11, 2024 17:34
Script to generate a static HTML image gallery file
@glowinthedark
glowinthedark / json_remove_null_keys.js
Created February 10, 2024 09:44
remove empty or null keys from JSON file; print to stdout or to file with `-o output.json`; to beautify output JSON add the `-f` flag
#!/usr/bin/env node
const fs = require('fs');
// Function to remove null keys from an object
function removeEmpty(obj) {
Object.keys(obj).forEach(function(key) {
if (obj[key] && typeof obj[key] === 'object') {
removeEmpty(obj[key]);
} else if (obj[key] === '' || obj[key] === null) {
@glowinthedark
glowinthedark / scp-turbo.sh
Last active February 9, 2024 20:32
Copy folders between local <=> SSH remote using tar piped over SSH using scp syntax like: `scp-turbo.sh myremote:/etc/apache2 /tmp/mylocal/dir`
#!/usr/bin/env bash
# URL: https://gist.github.com/glowinthedark/e56fed33be889cea6ec2326dc33f535d
# uses scp syntax e.g.:
#
# REMOTE -> LOCAL (folder to folder)
# scp-turbo.sh myremote:/etc/apache2 /tmp/mylocal/dir
# REMOTE -> LOCAL (folder to .gz)
@glowinthedark
glowinthedark / immich-orphan-cleaner.py
Created February 6, 2024 20:14 — forked from sircharlo/immich-orphan-cleaner.py
I modified @T-One 's excellent Gist somewhat for my purposes: I had alot of orphaned files in my Immich instance! I was getting impatient and wanted to see progress and ETA. Here it is in case anyone is impatient like me lol; all credit goes to @T-One though. Original Gist: https://gist.github.com/T-One/c857005e58286149914ad38f24a891e1
#!/usr/bin/env python3
# Note: you might need to run "pip install halo tabulate tqdm" if these dependencies are missing on your machine
import argparse
import json
import requests
from datetime import datetime
from halo import Halo