Skip to content

Instantly share code, notes, and snippets.

View 182exe's full-sized avatar
🐢

182exe 182exe

🐢
View GitHub Profile
@182exe
182exe / jibber.js
Last active July 3, 2023 17:49
Jibber (randomized fake words/sentences generator in 1 function)
function jibber(length, punctuate, punctuationMarks, wordLengthLimit, mimicEnglishPractices) {
length = typeof length !== `undefined` ? length : 1;
punctuate = typeof punctuate !== `undefined` ? punctuate : false;
punctuationMarks = typeof punctuationMarks !== `undefined` ? punctuationMarks : [".", "!", "?", "..."];
const cv = 'aeiou';
const cc = 'bcdfghjklmnprstvw';
const ccx = 'qxzy';
const cca = 'bcdfghjklmnpqrstvwxyz'
@182exe
182exe / loginator.js
Last active December 29, 2023 19:17
Loginator (a NodeJS logging function where you can have nice little tabs with customizable colors)
/*
simple colored console message prefixes
Usage:
const Loginator = require(`./loginator.js`)
const logger = new Loginator(4, false, {
"info": {fg: "brightblack", bg: "white"},
"chat": {fg: "white", bg: "brightblack"},
"warn": {fg: "brightwhite", bg: "yellow"},
"uhoh": {fg: "yellow", bg: "red"},
@182exe
182exe / discordwebhookedit.js
Last active April 11, 2024 05:29
discord - simple webhook message edit (nodejs, axios)
const axios = require('axios');
const url = `https://discord.com/api/webhooks/<webhookid>/<webhooktoken>`
// initially post a message
// "?wait=true" url param tells discord to return a message object so we can get the id of it
axios.post(`${url}?wait=true`, {
content: "hi, test. this is the first message."
}).then((response) => {
// use PATCH method to edit webhooks
// use with @prismarinejs/mineflayer
// if you don't know what a session token/access token is, don't bother with this; it's for the silliest of devs
const mineflayer = require(`mineflayer`)
const config = {
host: `example.com`,
port: 25565,
token: `eyJraWQiOiJhYzg0YSIsImFsZyI6IkhTMjU2In0.eyJ4dWlkIjoiMjUzNTQ...`
}
// thanks to gapple.pw for the very well made docs (https://mojang-api-docs.gapple.pw/)
// thanks to wiki.vg for teaching me microsoft auth scheme (https://wiki.vg/Microsoft_Authentication_Scheme)
const axios = require(`axios`)
async function getUsernameAndUUID(bearerToken) {
try {
const url = 'https://api.minecraftservices.com/minecraft/profile';
const config = {
headers: {