Skip to content

Instantly share code, notes, and snippets.

View almeidx's full-sized avatar
:shipit:

Almeida almeidx

:shipit:
View GitHub Profile
import { Client, ChannelType } from './packages/discord.js/src/index.js';
const client = new Client({
intents: 1,
});
client.on('ready', async () => {
console.log('Ready!');
const guild = client.guilds.cache.get('GUILD_ID');
import { EventEmitter } from "node:events";
import { AsyncEventEmitter } from "@vladfrangu/async_event_emitter";
import benchmark from "benchmark";
import { EventEmitter as EventEmitter3 } from "eventemitter3";
import { Evt } from "evt";
const suite = new benchmark.Suite();
function handle(a) {}
@almeidx
almeidx / projection.ts
Last active February 27, 2022 23:04
Mongoose projection example
import { Schema, model } from 'mongoose';
interface IThing {
field1: string;
field2: string;
}
(async () => {
const thingSchema = new Schema<IThing>({
field1: String,
845460946658000897 845460915318554684 845460717024051200 845460522143973416 845460672774012939 845460673446281217 845460485843583006 845460599117709333 845460404204863498 845460502939172896 845460128429375499 845459935579471902 845460464048930826 845460062797037571 845460460441960468 845455801434374185 845460437742387250 845459923042041917 845459952206479400 845459853203210280 845460328686813206 845459715554672680 845455597126025216 845460265503948821 845460180308721685 845459935239602187 845459950482620427 845460222750621697 845459839152160819 845460014075478096 845460102915686400 845459693761724426 845459701408071680 845459632897654785 845459984661217312 845459492874878996 845459657718890516 845459781586124841 845459756009390120 845459560361754674 845459740283764776 845459237701943316 845459620361273384 845459383642095616 845459590983450656 845459589741805618 845459502877769749 845458941961306118 845459004335063051 845459396556226651 845459298368094239 845459440597729280 845459377598365708 84545929742490011
@almeidx
almeidx / steam_scam.yml
Last active October 27, 2021 21:24
Zeppelin automod rule for deleting scam messages
steam_scam:
affects_bots: false
triggers:
- match_words:
only_full_words: false
case_sensitive: false
normalize: true
loose_matching: true
strip_markdown: true
match_visible_names: true
@almeidx
almeidx / eval.json
Created June 17, 2020 11:15
Discord Bot Maker eval command.
{
"name": "eval",
"permissions": "NONE",
"restriction": "4",
"_id": "sRxja",
"actions": [
{
"behavior": "0",
"interpretation": "1",
"code": "const { RichEmbed } = require('discord.js')\nconst { inspect } = require('util')\n\nconst embed = new RichEmbed()\n .setFooter(msg.author.tag, msg.author.displayAvatarURL)\n\nconst prefix = (server && server.tag) || this.getDBM().Files.data.settings.tag\nconst args = msg.content.slice(prefix.length).trim().split(/ +/g); args.shift()\nconst query = args.join(' ')\nconst code = (lang, code) => (`\\`\\`\\`${lang}\\n${String(code).slice(0, 1000) + (code.length >= 1000 ? '...' : '')}\\n\\`\\`\\``).replace(this.getDBM().Bot.bot.token, '*'.repeat(this.getDBM().Bot.bot.token.length))\n\nif (!query) msg.channel.send('Please, write something so I can evaluate!')\nelse {\n try {\n const evald = eval(query)\n const res = typeof evald === 'string' ? evald : inspect(evald, { depth: 0 })\n\n embed.addField('Result', code('js', res))\n\n if
@almeidx
almeidx / fps.js
Last active November 17, 2022 17:44
Show the FPS of a window
let before = Date.now(), fps = 0, now;
requestAnimationFrame(function loop() {
now = Date.now();
fps = Math.round(1000 / (now - before));
before = now;
requestAnimationFrame(loop);
console.log('FPS:', fps);
});
@almeidx
almeidx / pi.txt
Created December 2, 2019 14:33
1 million decimals of pi
This file has been truncated, but you can view the full file.
3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327
@almeidx
almeidx / markdown-text-101.md
Last active May 22, 2023 22:37 — forked from matthewzring/markdown-text-101.md
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

Sweet Styles

Italics *italics* or _italics_

Underline italics __*underline italics*__