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
@thesamesam
thesamesam / xz-backdoor.md
Last active April 25, 2024 23:45
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that

@Geczy
Geczy / migrate.sh
Last active April 24, 2024 06:41
Migrate Coolify to a new server
#!/bin/bash
# This script will backup your Coolify instance and move everything to a new server. Docker volumes, Coolify database, and ssh keys
# 1. Script must run on the source server
# 2. Have all the containers running that you want to migrate
# Configuration - Modify as needed
sshKeyPath="$HOME/.ssh/your_private_key" # Key to destination server
destinationHost="server.example.com"
@TheOnlyWayUp
TheOnlyWayUp / Dockerfile
Last active February 10, 2024 22:24
Dockerfile for projects with Python Backends and Javascript Frontends. Star if useful, thanks!
FROM node:20
WORKDIR /build
COPY src/frontend/package*.json .
RUN rm -rf node_modules
RUN rm -rf build
RUN npm install
COPY src/frontend/. .
RUN npm run build
# Thanks https://stackoverflow.com/q/76988450
DELAY 1000
GUI r
DELAY 500
STRING cmd
SHIFT CTRL ENTER
DELAY 1000
LEFT
ENTER
DELAY 1000
@TheOnlyWayUp
TheOnlyWayUp / imageFunctions.py
Last active March 6, 2022 14:01
Example of BytesIO and PIL for modifying images without saving them
domain = 'watermark' # just an example of how to use bytesio with PIL, works better if you know more about the images you're using instead of using random ones which can have random dimensions.
import aiohttp
from urllib.parse import unquote
from io import BytesIO
from PIL import Image, ImageDraw, ImageFont
async def returnRandomCat():
async with aiohttp.ClientSession() as session:
async with session.get("https://aws.random.cat/meow") as resp:
@JeyyGit
JeyyGit / modal_implementation_example.py
Last active March 4, 2022 20:32
Rough implementation of modal in discord.py 2
import discord, secrets
class TextInput:
"""for storing our text input data"""
def __init__(self, payload):
self.type = payload['type']
self.custom_id = payload['custom_id']
self.style = payload['style']
self.label = payload['label']
self.min_length = payload.get('min_length')
@kkrypt0nn
kkrypt0nn / ansi-colors-discord.md
Last active April 24, 2024 09:14
A guide to ANSI on Discord

A guide to ANSI on Discord

Discord is now slowly rolling out the ability to send colored messages within code blocks. It uses the ANSI color codes, so if you've tried to print colored text in your terminal or console with Python or other languages then it will be easy for you.

Quick Explanation

To be able to send a colored text, you need to use the ansi language for your code block and provide a prefix of this format before writing your text:

\u001b[{format};{color}m

\u001b is the unicode escape for ESCAPE/ESC, meant to be used in the source of your bot (see ). If you wish to send colored text without using your bot you need to copy the character from the website.

@lykn
lykn / buttons.md
Last active April 16, 2024 05:39
A gist which shows/tells you how to make buttons using discord.py v2(version 2.0.0a)

Note: Before we go any further. Let me make this real clear that the following gist uses the OFFICIAL discord.py library and not forks like discord_components, nextcord, etc... So when your using this code but a different library and fuck up don't comment something mean or go to a help channel in the server and say "this gist is misleading" or "bad gist who wrote this" when your at fault, trust me I'm going to fuck you up😅

Just a reminder^^

Related Links:

DPY's Docs

Discord's Docs

import pkg_resources
from subprocess import call
packages = [dist.project_name for dist in pkg_resources.working_set]
#Uses list comprehension to create a list of all packages installed, and then get their names.
call("pip install --upgrade " + ' '.join(packages), shell=True)
#Call is like os.system, it runs pip install upgrade and the join essentially seperates all the packages with a " ", ex if you had the packages discord and setuptools installed, the list would become ["discord", "setuptools"] and it would run pip install -upgrade discord setuptools

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