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 / 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 / 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 / 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

Setup nut and netdata on Ubuntu

In this document, I will explain how to setup nut (Network UPS Tools) on Ubuntu 18.04 and 20.04.

It is basically the next chapter of my previous gist, Upgrade nut on Ubuntu 18.04.

I'll only document USB connected UPS and not the other supported connection modes.

Install required dependencies

@glowinthedark
glowinthedark / telegram_bot_api_curl.cpp
Created January 4, 2024 20:43 — forked from ozlb/telegram_bot_api_curl.cpp
Telegram bot API via curl
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <ctype.h>
#include <string>
//https://github.com/DaveGamble/cJSON
#include "cJSON.h"
@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 / midnight-commander-build-macos.sh
Last active November 29, 2023 15:36
Midnight Commander: build and install from source on macos
brew install libssh libssh2 slang
clone --depth 1 https://github.com/MidnightCommander/mc.git
cd mc
./configure --disable-doxygen-doc --disable-doxygen-dot --disable-doxygen-html CPPFLAGS="-I/opt/homebrew/Cellar/libssh2/1.11.0_1/include -I/opt/homebrew/Cellar/s-lang/2.3.3/include -I/opt/X11/include" LDFLAGS="-L/opt/homebrew/Cellar/libssh2/1.11.0_1/lib -L/opt/homebrew/Cellar/s-lang/2.3.3/lib -L/opt/X11/lib"
make CPPFLAGS="-I/opt/homebrew/Cellar/libssh2/1.11.0_1/include -I/opt/homebrew/Cellar/s-lang/2.3.3/include -I/opt/X11/include" LDFLAGS="-L/opt/homebrew/Cellar/libssh2/1.11.0_1/lib -L/opt/homebrew/Cellar/s-lang/2.3.3/lib -L/opt/X11/lib"
sudo mkdir -p /usr/local/{libexec,etc,share}
sudo chown `whoami` /usr/local/{libexec,etc,share}