Skip to content

Instantly share code, notes, and snippets.

View quanticc's full-sized avatar
👽
>:]

Ivan Abarca quanticc

👽
>:]
View GitHub Profile
@advaith1
advaith1 / intents.md
Last active April 20, 2024 05:39
Discord Gateway Intents Explainer

Intents Explainer

If you're wondering what Gateway Intents are, what Privileged Intents are, why your bot can't see statuses, or why your bot can't see member joins anymore, then this page should explain it to you!

if you do not know what intents are, please read this entire page

Intro

First, a short explanation of how bots work: bots can make requests over the REST (HTTP) API to retreive information and do actions, and they get real-time updates from Discord in the form of websocket gateway events. They can also fetch server members via the gateway.

Examples of gateway events you are probably familiar with are Message Create (a message was sent) and Guild Member Add (a user joined a server).

@advaith1
advaith1 / top bots.md
Last active May 2, 2024 15:40
The top Discord bots ranked by server count
Rank Bot Approximate Server Count Library
1 MEE6 21,600,000 Custom Python
2 Rythm 🪦 15,200,000 JDA
3 Groovy 🪦 10,400,000 JDA, Discord4J
4 carl-bot 🅱️ 9,770,000 Pycord
5 ProBot
package com.github.alex1304.ultimategdbot.core;
import java.time.Duration;
import org.reactivestreams.Publisher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import discord4j.rest.request.GlobalRateLimiter;
import reactor.core.publisher.Flux;
@darichey
darichey / Content.md
Last active March 22, 2019 00:35
Variance

The reason you get Object when you use andThen with Consumer<? super EmbedCreateSpec> is because ? super EmbedCreateSpec indicates contravariance. Variance affects the subtyping relationship between types depending on the subtyping relathionship of their type parameters. You've probably seen ? extends which indicates covariance. I think this one is a bit easier to explain, so we'll do that and then go back to contravariance.

Covariance "forwards" the subtyping relationship to the containing type. That is, if T is a subtype of U (notated as T <: U) then List<T> is a subtype of List <? extends U>. For example, List<Double> is a subtype of List<? extends Number>. This is a useful relationship if we are only reading (that is, get()) from the list. We can never write (that is add() to this list). The following example helps show why:

List<? extends Number> list;
list = new ArrayList<Double>();
// list = new ArrayList<Long>();
@mraible
mraible / jhipster-java10.md
Last active April 3, 2019 21:28
JHipster v5 with Java 10

Thanks to Josh Long's Java 10 blog post for instructions!

  1. Download and install Java 10. Make sure it's the version used when you run java -version.

  2. Clone the JHipster project's master branch:

    git clone https://github.com/jhipster/generator-jhipster.git
    
  3. In the cloned directory, run npm link.

@DasWolke
DasWolke / microservice bots.md
Last active March 23, 2024 16:41
Microservice bots

Microservice Bots

What they are and why you should use them

Introduction

Recently more and more chatbots appear, the overall chatbot market grows and the platform for it grows as well. Today we are taking a close look at what benefits creating a microservice chatbot on Discord - (a communication platform mainly targeted at gamers) would provide.

The concepts and ideas explained in this whitepaper are geared towards bots with a bigger userbase where the limits of a usual bot style appear with a greater effect

Information about Discord itself

(If you are already proficient with the Discord API and the way a normal bot works, you may skip ahead to The Concept)

@rkaramandi
rkaramandi / nginx-and-certbot-config.md
Last active February 15, 2024 21:20
Running NGINX and CertBot Containers on the Same Host

Running NGINX and CertBot Containers on the Same Host

The Problem

A lot of people run into the problem of running Let's Encrypt's CertBot Tool and an NGINX on the same container host. A big part of this has to do with CertBot needing either port 80 or 443 open for the tool to work as intended. This tends to conflict with NGINX as most people usually use port 80 (HTTP) or 443 (HTTPS) for their reverse proxy. Section 1 outlines how to configure NGINX to get this to work, and Section 2 is the Docker command to run CertBot.

1. NGINX Configuration

I use Docker Compose (docker-compose) for my NGINX server. My docker-compose.yml file looks something like this:

@jahe
jahe / jpa-cheatsheet.java
Last active May 5, 2024 09:34
JPA Cheatsheet
/*
JPA (Java Persistence API)
Transaction Management with an Entity-Mananger:
---
entityManager.getTransaction().begin();
entityManager.persist(<some-entity>);
entityManager.getTransaction().commit();
entityManager.clear();
@daurrutia
daurrutia / deploymentSettings.ps1
Last active June 12, 2021 17:54
Windows Server AD Deployment Settings on AWS (DNS, Domain join)
<#
.Synopsis
Joins new Windows server to a Windows domain on AWS
.DESCRIPTION
Sets local DNS entries to DNS server(s) by IP (Set-DnsClientServerAddress)
Enables "Use this connection's DNS suffix in DNS registration" (Set-DnsClient)
Appends domain DNS suffix (WMI)
Adds server to domain in specified OU and renames server (Add-Computer)
.EXAMPLE
Log on to new server
@ursuad
ursuad / kafka-cheat-sheet.md
Last active March 14, 2024 10:32
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...