This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from fastapi.staticfiles import StaticFiles | |
| from routes import routes_group_1, routes_group_2 | |
| api_app = FastAPI(title="api app") | |
| api_app.add_middleware( | |
| CORSMiddleware, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "math" | |
| "net/http" | |
| // go get "github.com/gorilla/mux" | |
| "github.com/gorilla/mux" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| ) | |
| func main() { | |
| myJson := map[string]interface{}{ | |
| "name": "Arsham", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Improvement after each stage: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o4htns2axmh87lieoclw.png | |
| # Resource 1 => https://simplernerd.com/docker-typescript-production/ | |
| # Resource 2 => https://medium.com/@ankit.wal/the-why-and-how-of-multi-stage-docker-build-with-typescript-example-bcadbce2686c | |
| FROM node:18-alpine3.15 as ts-compiler | |
| WORKDIR /usr/app | |
| COPY package*.json ./ | |
| COPY tsconfig.json ./ | |
| RUN npm install --include=dev | |
| COPY src src | |
| RUN ["npm", "run", "build"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Written by Arsham Arya | |
| Some snippets around pymongo package to prevent my confusion. | |
| """ | |
| from pymongo import MongoClient | |
| # Initializing | |
| client = MongoClient("mongodb://username:password@host:port/default_db?authSource=admin") | |
| database = client.get_database("db_name") | |
| collection = database.get_collection("collection_name") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scrapy import crawler | |
| from scrapy.utils.project import get_project_settings | |
| # pip install crochet | |
| from crochet import setup as crochet_setup, run_in_reactor | |
| crochet_setup() | |
| runner = crawler.CrawlerRunner(get_project_settings()) | |
| @run_in_reactor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Written by Arsham Arya | |
| I'm not sure it's the best way, | |
| So any contribution makes everyone happy! | |
| """ | |
| from os import environ | |
| # pip install python-dotenv | |
| from dotenv import dotenv_values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Written by Arsham Arya | |
| I'm not sure it's the best way, | |
| So any contribution makes everyone happy! | |
| """ | |
| # pip install requests | |
| from requests import get | |
| # Config is can is a dictionary of ENV variables including TMDB_API_KEY | |
| # https://gist.github.com/arshamalh/16a42854cb43bbe48038c7431529a552 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Compound unique indexs are indexes made of multiple columns together. | |
| # For example if we have this data: | |
| """ | |
| ("arsham", 930) | |
| """ | |
| # We can have ("arsham", 920), ("arsham", 910), Also we can have ("atousa", 930) | |
| # but we can't have ("arsham", 930) again. | |
| # I hope I explained it well enough. 😊 | |
| from pymongo import MongoClient, ASCENDING |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from tkinter import * | |
| from tkinter import messagebox | |
| root = Tk() | |
| root.geometry("480x170") | |
| root.title("Raha Contacts books") | |
| Name = StringVar() | |
| Number = StringVar() | |
| Address = StringVar() |