Skip to content

Instantly share code, notes, and snippets.

View pyzit's full-sized avatar
:shipit:
Working from home

Wajahat Murtaza pyzit

:shipit:
Working from home
View GitHub Profile
@pyzit
pyzit / steps to convert .py into .deb
Last active November 28, 2024 20:56
steps to convert .py into .deb
Install Dependencies: Install pyinstaller, dpkg-dev, and debhelper.
Create Executable: Use pyinstaller --onefile main.py to generate an executable.
Create Package Directory Structure: Set up the directory structure for the .deb package (~/my_app_package/usr/local/bin and ~/my_app_package/DEBIAN).
Move Executable: Move the main executable to the appropriate directory inside the package.
Create Control File: Write the package metadata in the control file.
Build the .deb Package: Use dpkg-deb --build to create the .deb package.
Install the .deb Package: Use dpkg -i to install your package.
Test the Executable: Run your executable to confirm it works.
Clean Up: Optionally clean up the build files.
Now, you have a .deb package for your Python application!
@pyzit
pyzit / Creating a Simple REST API with Flask and SQLAlchemy
Last active October 22, 2024 21:34
Creating a Simple REST API with Flask and SQLAlchemy
In this Gist, we will create a simple REST API using Flask, a popular web framework for Python, and SQLAlchemy, an ORM (Object Relational Mapper) for managing database interactions.
Prerequisites:
Make sure you have the following installed:
Python 3.x
pip
Flask
Flask-SQLAlchemy
@pyzit
pyzit / postgresql_basic_commands_ubuntu_webcog
Created October 7, 2024 16:44
This Gist provides a comprehensive guide on how to install and configure PostgreSQL on a Debian-based system for use with Webapps.
# Update package lists
sudo apt update
# Install PostgreSQL and contrib packages
sudo apt install postgresql postgresql-contrib
# Start and enable PostgreSQL
sudo systemctl start postgresql
sudo systemctl enable postgresql