Skip to content

Instantly share code, notes, and snippets.

View duplaja's full-sized avatar

Dan D. duplaja

View GitHub Profile
@duplaja
duplaja / epubseries.py
Created December 31, 2023 03:59
CLI to Set Series and Series Index on Epubs
#!/usr/bin/env python
import ebookmeta
import argparse
# Initialize the argument parser
parser = argparse.ArgumentParser(description='Process arguments.')
# Add the mandatory arguments
parser.add_argument('series_name', help='Series Name (allowing spaces)', type=str)
parser.add_argument('series_index', help='Series Index', type=str)
@duplaja
duplaja / openaiassist.py
Last active August 1, 2023 22:08
OpenAI Assistant
#!/usr/bin/env python
import openai
import ast
import os
openai.api_key = 'sk-SAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxj'
userprompt ="""
You can have a multi-line prompt here.
@duplaja
duplaja / make-epub-folders.sh
Created October 30, 2022 07:26
Makes folders for each epub in the current directory, based on title and author tags.
#!/bin/bash
#Requires exiftool installed
#Subfolder to store results in
containingfolder="./epubs-folder/"
for i in *.epub; do
[ -f "$i" ] || break
@duplaja
duplaja / all-music-scraper-new.js
Created August 3, 2022 00:55
New All Music Favorites Scraper
start_countdown();
function start_countdown() {
for (let i = 1; i <= 2; i++) {
setTimeout(function timer() {
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' })
if (i == 2) {
export_csv_favorites();
}
}, i * 4000);
@duplaja
duplaja / rym-recs-to-txt.js
Created July 13, 2022 20:35
RYM Recs to Text Export
function generateTextDownload(filename, text, type='text/plain;charset=utf-8') {
// Create an invisible A element
const a = document.createElement('a');
a.style.display = 'none';
document.body.appendChild(a);
var BOM = new Uint8Array([0xEF,0xBB,0xBF]);
// Set the HREF to a Blob representation of the data to be downloaded
@duplaja
duplaja / scraperym.js
Created June 22, 2022 18:46
Scrape RYM Charts - 6-22-22
function generateDownload(filename, text, type='text/plain;charset=utf-8') {
// Create an invisible A element
const a = document.createElement('a');
a.style.display = 'none';
document.body.appendChild(a);
var BOM = new Uint8Array([0xEF,0xBB,0xBF]);
// Set the HREF to a Blob representation of the data to be downloaded
@duplaja
duplaja / create_privatebin.py
Last active May 30, 2022 03:56 — forked from dedunumax/create_privatebin.py
Sample program to create PrivateBin notes using Python 3. Change URL on line 41 to your desired instance of PrivateBin
"""
This script creates a PrivateBin using Python 3.
Code is based on https://github.com/r4sas/PBinCLI repository.
Thanks a lot @r4sas!
Below modules should be installed in the environment.
requests
base58
pycryptodome
"""
@duplaja
duplaja / mullvadcheck.py
Created May 1, 2022 23:12
Mullvad VPN Check - Python
import subprocess
result = subprocess.run(['mullvad', 'status'], stdout=subprocess.PIPE)
mullvad_status = result.stdout.decode('utf-8')
if 'Disconnected' in mullvad_status:
print('Mullvad VPN is Disconnected: Connect and try again')
quit()
else:
print('Mullvad VPN is Active, continuing: ')
@duplaja
duplaja / fixdiscordspellcheck.js
Last active April 13, 2022 18:35
Fix Discord Web Browser Spellcheck
window.addEventListener("load", fixStupidDiscordSpellcheck, false);
window.addEventListener('locationchange', fixStupidDiscordSpellcheck, false);
window.addEventListener('hashchange', fixStupidDiscordSpellcheck, false);
function fixStupidDiscordSpellcheck(event){
setTimeout(function() {
var textBoxes = document.querySelectorAll('div[role="textbox"]');
@duplaja
duplaja / librarything.js
Last active April 12, 2022 18:57
Rate LibraryThing Works
window.addEventListener("load", function(event) {
const ratingtd = document.getElementById("ratingstdtitle");
const orig_rating = document.getElementById("form_rating").value;
const button = document.createElement('a');
button.setAttribute("id", "rate-button");
button.innerHTML = "<h3>Rate Book (Current Rating: "+orig_rating+")</h3>"