Skip to content

Instantly share code, notes, and snippets.

View scraped_anilist_20210408.json
[
"https://twitter.com/heroaca_anime",
"https://twitter.com/DemonSlayerUSA",
"https://twitter.com/sao_anime",
"https://twitter.com/opm_anime",
"https://twitter.com/anime_shingeki",
"https://twitter.com/yakuneba_staff",
"https://twitter.com/koenokatachi_M",
"https://twitter.com/ansatsu_anime",
"https://twitter.com/SG_anime",
View DisableCutCopyPaste-killer.user.js
// ==UserScript==
// @name DisableCutCopyPaste-killer
// @match *://siska.smkteljkt.com/*
// @match *://mylms.telkomschools.sch.id/*
// @grant none
// @version 1.0
// @author intrnl
// ==/UserScript==
@intrnl
intrnl / clear_mal.js
Last active Feb 8, 2021
Clear MyAnimeList
View clear_mal.js
let sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
let random = (min, max) => ~~(Math.random() * (max - min) + min);
let form_data = new FormData();
form_data.append('csrf_token', document.querySelector('meta[name=csrf_token]').content);
let elements = Array.from(document.querySelectorAll('.animetitle'));
console.log(`${elements.length} to delete`);
View discord-ws.ts
import { getPlatformInfo } from '../utils/platform';
import { noop } from '../utils/util';
import * as http from '../lib/http';
import { GATEWAY_VERSION } from '../constants/endpoints';
import { GATEWAY } from '../constants/api';
import { GatewayOP, ConnectionStatus } from '../constants/gateway';
import { Inflate } from '@intrnl/pako-esm/inflate';
import { Z_SYNC_FLUSH } from '@intrnl/pako-esm/constants';
View lazy-promise.js
export function createLazyPromise (executor) {
let promise;
function ensure () {
return promise || (promise = new Promise(executor));
}
return {
then (onfulfilled, onrejected) {
return ensure().then(onfulfilled, onrejected);
View sleep.ts
function sleep (ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
View promise-queue.ts
// class Queue<V = any>
// function createDeferred<V> (): Deferred<V>
// function sleep (ms: number): Promise<void>
export class PromiseQueue {
queue = new Queue<Task<any>>();
options: PromiseQueueOptions;
ongoing = 0;
View deferred.ts
export function createDeferred<V> (): Deferred<V> {
let deferred: Deferred<V> = {} as any;
deferred.promise = new Promise((resolve, reject) => (
Object.assign(deferred, { resolve, reject })
));
return deferred;
}
View queue.ts
export class Queue<V = any> {
head?: Node<V>;
tail?: Node<V>;
size!: number;
constructor () {
this.clear();
}
@intrnl
intrnl / handler.js
Last active Dec 14, 2020
Discord slash commands example on Cloudflare Workers
View handler.js
import * as ed from './noble-ed25519';
let encoder = new TextEncoder();
let commands = new Map();
export function define (name, handler) {
commands.set(name, handler);
}