Skip to content

Instantly share code, notes, and snippets.

@anadius
anadius / patreon.bulk.md
Last active February 25, 2024 20:12
Patreon bulk attachment downloader
@anadius
anadius / reverse_extract.py
Created April 26, 2023 12:09
Extract ZIP when you're low on space
"""
Quick and dirty script to extract ZIP files when you don't have enough space
for both ZIP and extracted files at the same time.
It extracts files from the end of the ZIP and then removes them from the archive.
Even if you abort with Ctrl+C the ZIP file should be valid.
First parameter is the ZIP file.
Second parameter is the output dir.
"""
@anadius
anadius / kemono_attachment_fix.user.js
Created March 30, 2023 17:49
Kemono Party attachment download fixer
// ==UserScript==
// @name Kemono Party attachment download fixer
// @author anadius
// @namespace anadius.hermietkreeft.site
// @match https://kemono.party/*
// @version 1.0.0
// @grant GM.xmlHttpRequest
// @run-at document-end
// ==/UserScript==
@anadius
anadius / around-the-sims.md
Last active October 27, 2023 16:35
Around the Sims download helper
@anadius
anadius / Origin Helper.user.js
Last active April 24, 2024 16:06
get download URL for your Origin games and generate Denuvo tokens
// ==UserScript==
// @name Origin Helper
// @author anadius
// @namespace anadius.hermietkreeft.site
// @homepageURL https://anadius.hermietkreeft.site/origin-helper
// @match *://www.ea.com/*
// @version 2.1.13
// @icon https://user-images.githubusercontent.com/8550471/187077252-2905e2dc-3241-4946-b1b3-f845a337d766.png
// @icon64 https://user-images.githubusercontent.com/8550471/187077254-476758f1-b784-45bf-a484-18d3ac704e44.png
// @grant GM.xmlHttpRequest
@anadius
anadius / myzipfile.py
Created November 7, 2021 00:14
Improved `zipfile` module
"""
This module is an improved `zipfile` module. Changes:
* fixed function for stripping the `extra` field of file header
+ added `compresslevel` support for LZMA compression
possible values: integer from 0 to 9 or a filter dict, like `{"dict_size": 67108864}`
https://docs.python.org/3/library/lzma.html#specifying-custom-filter-chains
+ when `ZipFile.store_if_smaller` is set to True and the compressed size is bigger than
the uncompressed size - scrap the compressed data and store file without compression;
+ added functions for writing/reading raw bytes or Python objects (anything that's
JSON serializable) to `extra` fields of file headers (up to 64KiB per file/folder)

Select the code below and add drag it to bookmarks bar. And if you want to read the full code see the file below.

javascript:(function()%7Bconst%20addJS%20%3D%20url%20%3D%3E%20new%20Promise((resolve%2C%20reject)%20%3D%3E%20%7B%0A%20%20const%20js%20%3D%20document.createElement('script')%3B%0A%20%20js.onload%20%3D%20resolve%3B%0A%20%20js.onerror%20%3D%20reject%3B%0A%20%20js.src%20%3D%20url%3B%0A%20%20document.body.appendChild(js)%3B%0A%7D)%3B%0A%0A(async%20()%20%3D%3E%20%7B%0A%20%20await%20Promise.all(%5B%0A%20%20%20%20addJS('https%3A%2F%2Fcdn.jsdelivr.net%2Fnpm%2Fjszip%403.7.1%2Fdist%2Fjszip.min.js')%2C%0A%20%20%20%20addJS('https%3A%2F%2Fcdn.jsdelivr.net%2Fnpm%2Ffile-saver-es%402.0.5%2Fdist%2FFileSaver.min.js')%0A%20%20%5D)%3B%0A%20%20const%20data%20%3D%20JSON.parse(document.querySelector('%23reader-init').innerHTML)%3B%0A%20%20const%20response%20%3D%20await%20fetch(data.manifest)%3B%0A%20%20const%20manifest%20%3D%20await%20response.json()%3B%0A%0A%20%20const%20zip%20%3D%20JSZip()%3B%0A%20%20const%20fol
@anadius
anadius / worker.js
Created February 24, 2021 18:31
Discord Slash Commands on Cloudflare Workers
const PUBLIC_KEY = '<PUBLIC KEY from your app>';
const POST_ERROR = true; // return the error message if your command function fails
/*
* @typedef slashCommandResult
* @type {array}
* @property {integer} 0 - InteractionResponseType:
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionresponsetype
* @property {Object|string} [1] - optional; string if you want a simple response
* or InteractionApplicationCommandCallbackData object:
@anadius
anadius / CS_RIN_add_missing_icons_to_generator.user.js
Last active February 26, 2020 15:34
CS RIN add missing icons to Steam BBcode generator
// ==UserScript==
// @name CS RIN add missing icons to Steam BBcode generator
// @author anadius
// @match *://cs.rin.ru/forum/*
// @version 1.0.1
// @grant none
// ==/UserScript==
const injection = () => {
SteamInfoBBCode.categoryIcons["PvP"] = "https://i.imgur.com/vt0nOoQ.png";
@anadius
anadius / _ srrDB .sfv downloader.md
Last active June 16, 2023 12:46
srrDB download .sfv for files inside the archive

Drag the bookmarklet to your bookmarks. Open release page on srrDB and click the bookmarklet.
Bookmarklet:

javascript:(()=>{a=b=>b.textContent.trim();d=document;w=window;l=[];for(e of d.querySelectorAll('.box-content-inner>table>tbody>tr')){f=e.children;if(f[0].textContent.trim().replace(/\s+/g,'')!=='Archivedfiles')continue;for(g of f[1].querySelectorAll('tr')){[t,s,c]=g.querySelectorAll('td');if(typeof s==='undefined')break;if(a(s)==='0')continue;l.push(a(t)+' '+a(c));}}l.push('');b=new Blob([l.join('\n')],{type:'octet/stream'});h=d.createElement('a');u=w.URL.createObjectURL(b);h.href=u;h.download=d.querySelector('#release-name').value+'.sfv';d.body.appendChild(h);h.click();w.URL.revokeObjectURL(u);h.remove()})()