This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatCSVValue(value) { | |
value = String(value); | |
// If the value contains a comma, newline, or quote, it needs to be quoted | |
if (/[,\"\n]/.test(value)) { | |
// Escape quotes by doubling them | |
value = value.replace(/"/g, '""'); | |
// Wrap the value in quotes | |
value = `"${value}"`; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
find . -iname "*.m3u*" -exec yt-dlp --enable-file-urls file://$PWD/{} \; | |
# same as above with subshell | |
find * -iname '*.m3u*' -print -exec sh -c 'yt-dlp --enable-file-urls "file://$PWD/${1}"' _ {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import torch | |
def is_metal_enabled(): | |
"""Checks if Metal acceleration is enabled for PyTorch.""" | |
# Check if MPS backend is available on the system | |
if not torch.backends.mps.is_available(): | |
print("MPS backend is not available on this system.") | |
return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.legbehindneck; | |
import java.io.IOException; | |
import com.fasterxml.jackson.databind.JsonNode; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.core.JsonPointer; | |
public class Main { | |
public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### ❗️❗️❗️ moved to https://github.com/glowinthedark/html-music-gallery-creator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Generate a static gallery.html file with all media files below the given folder | |
# for the VERSION WITH THUMBNAIL GENERATION use instead: | |
# https://gist.github.com/glowinthedark/81bc7c250ed245cb7a58d8d6b1f1a63e | |
from datetime import datetime | |
from pathlib import Path | |
from sys import argv | |
from urllib.parse import quote |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |