Skip to content

Instantly share code, notes, and snippets.

View Sasquire's full-sized avatar
💭
Alive

Sasquire

💭
Alive
View GitHub Profile

Userscript GM_* Polyfill Functions

Because some userscript managers keep using the old GM_* functions and some insist on the new async functions, there is an issue when building scripts for both of these. This helper script fixes that by adding a polyfill for the asynchronous functions.

How to use

const GM = require('./gm_functions.js');

GM.setValue('username', 'My name!')

Browserify Prepend-Text

This tool prepends a piece of text to the result of a browserify bundle. it is useful for making userscripts with browserify because the header information is a piece of text at the top of the script.

How to use

const browserify = require('browserify');
const apply_header = require('./prepend_text.js');

E621 Extensions Setting Page

This is supposed to be a universal settings-page utility for userscripts on e621. Designed to be simple, quick, and useful, I hope that this script can be integrated with other scripts and achieve a unified feel of userscripts on e621.

How to use

You can include this script in your userscript either by (I) copy-pasting it. (II) Using @require in your userscript's header. (III) Compiling this file into your userscript directly.

Once loaded, you can write custom settings like so

MD5 Sum

I wanted a public domain md5-sum utility so I could include it in other projects and have them be entirely public domain. To do this I extended code by Luigi Galli and updated much of it to be what I consider more readable.

Some documentation on the MD5 algorithm can be found here.

How to use

const md5_sum = require('./md5.js');

If you happen to have a large collection of images, tagged with artists, from another site, then it could be possible to search for the image on e621 and potentially apply the artist tag. The same holds for character tags, assuming artists and character owners post images they have made or comissioned on these sites. This fails if other people start uploading the same images, such as a specialized fetish-reposting account.

This repository contains some of the tools needed to do this matching on Furaffinities site.

character_artist_tags_by_post.json is a file produced by the sql

select post_id, tag_name, tag_type from (
	select unnest(tags) as tag_name, post_id, row_number() over (partition by post_id order by change_seq desc)
@Sasquire
Sasquire / e621_thread_hider.user.js
Created April 14, 2020 21:53
A simple userscript that can hide forum threads.
// ==UserScript==
// @name e621 Thread hider
// @namespace https://github.com/sasquire
// @version 0.00001
// @description Allows the ability to hide forum threads
// @author Sasquire
// @match *://*.e621.net/forum_topics
// @match *://*.e621.net/forum_topics?*
// @grant GM.getValue
// @grant GM.setValue
// ==UserScript==
// @name Highlight blacklist tags
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://e621.net/post/show/*
// @grant none
// ==/UserScript==
@Sasquire
Sasquire / User_set_info.js
Created February 14, 2020 17:59
A simple script that will download information about sets and determine the user who owns the most sets.
const fs = require('fs');
const request_main = require('request');
function request(url) {
let options = {url:url, headers: { 'User-Agent': 'Downloading user set information' }};
console.log(options);
return new Promise(function (resolve, reject) {
request_main(options, function (error, res, body) {
console.log(res.statusCode);
if (!error && res.statusCode == 200) {
@Sasquire
Sasquire / Identify_from_favorites.js
Created February 14, 2020 17:03
This is a quick program that can be used to identify users based on two or more posts from their favorites.
const request = require('request');
async function find_users(id){
const options = {
url: `https://e621.net/favorite/list_users.json?id=${id}`,
headers: {
'User-Agent': 'Identify users from favorites/v1.0'
}
};
return new Promise((resolve, reject) => {
@Sasquire
Sasquire / e621_post_merger.user.js
Created August 10, 2019 04:26
a quick little program that will add a box and two fields so you can easily merge the tags, sources, description, and flag one as inferior to the other.
// ==UserScript==
// @name e621 post merger
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://e621.net/post/show/*
// @grant GM.setValue
// @grant GM.getValue
// ==/UserScript==