Skip to content

Instantly share code, notes, and snippets.

View BlackHacked's full-sized avatar
📷
Hello World

Latin BlackHacked

📷
Hello World
View GitHub Profile
@gdamjan
gdamjan / README.md
Last active March 24, 2025 08:55
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
## Build angular site
- name: build
pull: if-not-exists
image: node:16.18.1-alpine
when:
branch:
- master
event:
- push
commands:

每个 Python 程序员可能都会遇到这样的场景:你写了一个 Python 程序,可能是一个简单的、包含单个文件的 、只使用了标准库的 Python 脚本,抑或是一个庞大的、包含多个模块的、甚至引用了大量的第三方库的复杂 Python 应用,如何将他们送到目标用户手中,让他们能很顺利地使用起来呢?

一种方案就是写一个详尽的文档,连带着你的程序一起发送给用户。文档中要说明,目标用户如何在自己机器上安装 Python 环境及依赖的包,如何对程序进行配置,等等。但倘若你的目标用户没用过 Python 甚至不懂编程,此种方案执行起来便困难重重。

另一种方案,就是将 Python 程序“打包”成可执行程序(.exe),只要目标用户具备基本的电脑操作技能,便能很容易地将程序运行起来。

在 Windows 平台上,将 Python 程序“打包”为可执行程序(.exe)的方案很多,我尝试过的方案有如下几种:

@numanturle
numanturle / wait-for-it.sh
Last active June 27, 2025 04:28
wait-for-it.sh
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port are available
WAITFORIT_cmdname=${0##*/}
echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
usage()
{
cat << USAGE >&2
@nilleb
nilleb / proxy.py
Created July 11, 2022 19:12
CORS proxy
# -*- coding: utf-8 -*-
# forwards the calls to http://localhost:8000/https://google.com to https://google.com - copying the headers, query strings, etc
from fastapi import FastAPI, Request, Response
from fastapi.middleware.cors import CORSMiddleware
import requests
app = FastAPI()
@mikepianka
mikepianka / README.txt
Last active April 30, 2026 08:55
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
@craig-m-unsw
craig-m-unsw / README.md
Last active August 30, 2022 09:05
Learn MongoDB with docker-compose
from tinydb import TinyDB
# Disk storage
db = TinyDB('data.json')
# Memory storage
from tinydb.storages import MemoryStorage, Storage
db = TinyDB(storage=MemoryStorage)
@ondrejmo
ondrejmo / .drone.yml
Created August 5, 2021 15:22
multi-architecture docker pipeline in Drone CI
---
kind: pipeline
type: docker
name: linux-amd64
trigger:
branch:
- myapp
event:
@bangonkali
bangonkali / README.md
Last active May 16, 2022 04:01
Jetson Xavier NX Notes

Docker Snippets

Create a deepstream-l4t docker container instance.

sudo docker run -it \
  --rm \
  --net=host \
  --runtime nvidia \
 -e DISPLAY=$DISPLAY \