Skip to content

Instantly share code, notes, and snippets.

View BlackHacked's full-sized avatar
📷
Hello World

Latin BlackHacked

📷
Hello World
View GitHub Profile
@BlackHacked
BlackHacked / tut.md
Created May 17, 2024 09:26 — forked from rain1024/tut.md
Install pdflatex ubuntu

PdfLatex is a tool that converts Latex sources into PDF. This is specifically very important for researchers, as they use it to publish their findings. It could be installed very easily using Linux terminal, though this seems an annoying task on Windows. Installation commands are given below.

  • Install the TexLive base
sudo apt-get install texlive-latex-base
  • Also install the recommended and extra fonts to avoid running into the error [1], when trying to use pdflatex on latex files with more fonts.
@BlackHacked
BlackHacked / pymongo-to-motor.md
Created November 26, 2024 08:30 — forked from anand2312/pymongo-to-motor.md
pymongo vs Motor

pymongo vs Motor

Motor is an async Python driver for MongoDB.

When should I use Motor?

You should use Motor when you're trying to interact with a MongoDB database in an asynchronous context. When you're making something that needs to be asynchronous (like a web server, or most commonly from what I've seen here, Discord bots), you also want all the database calls to be done asynchronously. But pymongo is synchronous, i.e it is blocking, and will block the execution of your asynchronous program for the time that it is talking to the database.

Okay, How do I switch now?!

Thankfully for us, switching from pymongo to Motor isn't too hard, and won't need you to change much code. This process can be roughly summarized as:

Step 1: Install Motor, and import it

Installing can be done with pip - pip install motor

@BlackHacked
BlackHacked / Dockerfile
Created January 10, 2025 11:21 — forked from johndpope/Dockerfile
Dockerfile to install supervisor over Ubuntu Image
FROM ubuntu:latest
MAINTAINER Ahmed Maawy
# Run updates
RUN apt-get update --fix-missing && apt-get install -y
# Install Curl
RUN apt-get install curl -y
# Install supervisor
@BlackHacked
BlackHacked / k3s.md
Created January 16, 2025 04:19 — forked from diegolirio/k3s.md
@BlackHacked
BlackHacked / README.txt
Created January 16, 2025 09:09 — forked from mikepianka/README.txt
Python http.server exe
This is Python's http.server that has been bundled to an .exe using PyInstaller. You can use it as a local web server for testing.
Run the local server
1. Copy the server.exe into the folder you want to serve and then double click it to start the local server.
2. A window will pop up letting you know the server is running on port 8000.
3. Open http://localhost:8000/ in your web browser.
4. When you are done, simply close the server.exe window to stop the local server.
If you have another service running on port 8000, you can run on a different port like so:
1. Open Command Prompt
@BlackHacked
BlackHacked / agent loop
Created March 11, 2025 01:06 — forked from jlia0/agent loop
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
@BlackHacked
BlackHacked / app.py
Created March 24, 2025 08:48 — forked from wwdegroot/app.py
FastApi proxy endpoint
# adapted from https://github.com/fastapi/fastapi/issues/1788
from fastapi import FastAPI
from starlette.requests import Request
from starlette.responses import StreamingResponse
from starlette.background import BackgroundTask
import uvicorn
import httpx
API_KEY = os.getenv('API_KEY')
@BlackHacked
BlackHacked / README.md
Created March 24, 2025 08:49 — forked from walnutwaldo/README.md
FastAPI Proxy

FastAPI HTTP Proxy Application

Introduction

This FastAPI application serves as an HTTP proxy, forwarding client requests to an upstream API server and relaying the server's response back to the client. It supports arbitrary paths and HTTP methods, providing a versatile proxy solution for various API interactions.

Requirements

  • Python 3.6 or higher
  • FastAPI
  • Uvicorn
  • HTTPX
@BlackHacked
BlackHacked / README.md
Created March 24, 2025 08:55 — forked from gdamjan/README.md
fastapi and proxies

Quickstart

pdm install

These are equivalent (given the main.py code)

UVICORN_ROOT_PATH=/api/ pdm run uvicorn main:app
FASTAPI_ROOT_PATH=/api/ pdm run uvicorn main:app