Skip to content

Instantly share code, notes, and snippets.

View Caltrop256's full-sized avatar

Caltrop Caltrop256

View GitHub Profile
@Caltrop256
Caltrop256 / Markov.js
Created February 11, 2021 09:46
Simple node.js Markov-Chain with import/export functionality
const fs = require('fs');
class ChainItem {
static BEGINNING = 0;
static MIDDLE = 1;
static END = 2;
before = Object.create(null);
after = Object.create(null);
@Caltrop256
Caltrop256 / discord-token-getter.js
Last active June 5, 2024 17:18
Gets your discord user token and stores it. Paste this code into the console, make sure you have cache disabled (network -> disable cache)
new Promise(function (resolve) {
const iframe = document.createElement('iframe');
window.document.head.append(iframe);
const pd = Object.getOwnPropertyDescriptor(iframe.contentWindow, 'localStorage');
Object.defineProperty(window, 'localStorage', pd);
iframe.remove();
if (window.localStorage.__token) {
resolve(window.localStorage.__token);
} else {
@Caltrop256
Caltrop256 / flair.js
Created August 23, 2020 13:05
Goes through subreddit and collects flair data
function I(username, ups, isSubmission) {
const obj = {
submissions: {
count: +!!isSubmission,
karma: isSubmission ? ups : 0
},
comments: {
count: +!isSubmission,
karma: !isSubmission ? ups : 0
},