Skip to content

Instantly share code, notes, and snippets.

View TheOnlyWayUp's full-sized avatar
📰
Democratizing information

Dhanush R TheOnlyWayUp

📰
Democratizing information
View GitHub Profile

Fun fact : a lightbulb has been on since 1901 in a region of siberia. Ivan Popov discovered that electricity could be extracted from the ground in the region as the soil is mineral rich, and the water table is high. This discovery has allowed the earth to accomplish this remarkable feat

Fun fact : the covalent character of ionic bonds was discovered as a result of a similar mathematical error. George Smith made a mathematical error while calculating the lattice energy of a compound, and ended up with the result he expected despite the error. When his assistant discovered the error, he devised the theory used today

Fun fact : Hydrated salts were the result of a paranoid geologist. Johnathan Everard began the practice of baking samples obtained in the field to kill microbes, believing that doing so would prevent him from contracting tetanus. A difference in mass before and after baking observed with one of the samples led him to this path paving discovery

Fun fact : In 2015 Dalia Scott, a student at the M

@AkshuAgarwal
AkshuAgarwal / webhook.py
Last active April 13, 2024 17:02
Send Message using Discord Webhooks by making request or using discord.py
"""Making a post request to Webhook, without using discord.py"""
import aiohttp
webhook_url = "your_webhook's_url" # URL of the Webhook (make sure NOT TO SHARE IT WITH ANYONE.)
# JSON data to send to the Webhook.
# You can find the data payload at https://discord.com/developers/docs/resources/webhook#execute-webhook
data = {
'content': 'Hello, world!',
@Mearman
Mearman / cloudflare_whitelist.sh
Last active February 25, 2024 15:23
NGINX Cloudflare Access whitelist
#!/bin/bash
cd /mnt/user/appdata/NginxProxyManager/nginx
echo "IPV4" >> new.conf
echo "" >> new.conf
curl -sSL https://www.cloudflare.com/ips-v4 | awk '{print "allow",$1,";"}' >> new.conf
echo "IPV6" >> new.conf
echo "" >> new.conf
curl -sSL https://www.cloudflare.com/ips-v6 | awk '{print "allow",$1,";"}' >> new.conf

Breaking Changes of discord.py 2.0

These are the breaking changes of discord.py version 2.0.

"Breaking change" includes:

  • [R]emoval: a feature is removed.
  • [N]ame changes: a feature is renamed.
  • [B]ehavior: something does not behave the way they did in 1.x.
  • [T]yping: types of arguments, attributes or return values changes in an incompatible way. (e.g. None disallowed for argument)
  • [S]yntax: a syntax previously allowed for an operation is no longer allowed. (e.g. positional only arguments, new required arguments)
@ItsDrike
ItsDrike / 1_basic_autoinit.py
Last active May 6, 2022 22:06
Python auto_init
"""
This attempts to abstarct away the standard way of using `__init__`,
the problem it tries to solve is the repetetiveness of using init purely
to store it's parameters into the instance under the exactly same name, i.e.:
class Stock:
def __init__(name, shares, price):
self.name = name
self.shares = shares
self.price = price
"""
@InterStella0
InterStella0 / HelpCommand_walkthrough_guide.md
Last active March 16, 2024 09:29
Walkthrough guide on subclassing HelpCommand
@Rafastoievsky
Rafastoievsky / cleaningdatafunctions.py
Created November 2, 2020 02:45
WhatsApp Group chat analysis: cleaning data functions
def startsWithDateAndTime(s):
pattern = '^\d{1,2}/\d{1,2}/\d{1,2}, \d{1,2}:\d{1,2}\S [AaPp][Mm] -'
result = re.match(pattern, s)
if result:
return True
return False
def FindAuthor(s):
patterns = [
'([\w]+):', # Nombre
@Soheab
Soheab / wait_for in command.md
Last active July 11, 2023 16:56
Examples for a wait_for in ext.commands.

This gist shows how to make the bot wait for a message or reaction after doing a command. This should not be copypasted.

Docs

Check the discord.py docs for a detailed explanation of how it all works internally and which kwargs it takes.

Commands

See here two commands, one waiting for any message in a channel and the other waiting for a reaction with a specific emoji.

Check

@Soheab
Soheab / API's.md
Last active April 25, 2024 19:48
See here some of the API's you can use in your discord bot or anything

Some API's for you.

See here some of the API's you can use in your discord bot or anything. For any help or questions on how to use one, please contact the owner of the API and not me.

A much bigger list of APIs can be found here


[TOKEN] = API requires a token to access some if not all endpoints.

The descriptions are mostly copied from the API, sometimes personal or from the dev.

@haykkh
haykkh / fastapi-discord.py
Created June 24, 2020 10:09
How to run a discord.py bot with FastAPI
import asyncio
import discord
from fastapi import FastAPI
app = FastAPI()
client = discord.Client()
# where the magic happens
# register an asyncio.create_task(client.start()) on app's startup event