├── snake_game ├── requirement.txt ├── images │ └── game_logo.jpg ├── __pycache__ │ └── constants.cpython-38.pyc └── constants.py ├── Sudoku-GUI-Solver ├── requirements.txt └── README.md ├── python-hangman-Sanyog_Mishra ├── .idea │ ├── .name │ ├── .gitignore │ ├── misc.xml │ ├── inspectionProfiles │ │ └── profiles_settings.xml │ ├── modules.xml │ └── hangman.iml ├── info.txt └── art.py ├── hs_battlegrounds ├── requirements.txt ├── .gitignore ├── config.py ├── run.py └── hs_cards.py ├── Hello.py ├── Mailer-main └── Mailer-main │ ├── README.md │ ├── Logo.png │ ├── logo-color.ico │ └── setup_repair.py ├── credit_card_fraud_detection ├── norm.json └── model.pk ├── apps ├── mr-b-141107-admin │ ├── .env │ ├── src │ │ ├── user │ │ │ ├── EnumRoles.ts │ │ │ ├── roles.ts │ │ │ ├── UserTitle.ts │ │ │ ├── RolesOptions.ts │ │ │ ├── UserShow.tsx │ │ │ ├── UserEdit.tsx │ │ │ ├── UserCreate.tsx │ │ │ └── UserList.tsx │ │ ├── util │ │ │ ├── MetaQueryPayload.ts │ │ │ ├── SortOrder.ts │ │ │ ├── BooleanFilter.ts │ │ │ ├── QueryMode.ts │ │ │ ├── BooleanNullableFilter.ts │ │ │ ├── JsonFilter.ts │ │ │ ├── JsonNullableFilter.ts │ │ │ ├── DateTimeFilter.ts │ │ │ ├── IntFilter.ts │ │ │ ├── FloatFilter.ts │ │ │ ├── DateTimeNullableFilter.ts │ │ │ ├── IntNullableFilter.ts │ │ │ ├── FloatNullableFilter.ts │ │ │ ├── StringFilter.ts │ │ │ └── StringNullableFilter.ts │ │ ├── api │ │ │ ├── order │ │ │ │ ├── OrderWhereUniqueInput.ts │ │ │ │ ├── CreateOrderArgs.ts │ │ │ │ ├── OrderCountArgs.ts │ │ │ │ ├── DeleteOrderArgs.ts │ │ │ │ ├── OrderFindUniqueArgs.ts │ │ │ │ ├── OrderListRelationFilter.ts │ │ │ │ ├── UpdateOrderArgs.ts │ │ │ │ ├── OrderFindManyArgs.ts │ │ │ │ ├── OrderOrderByInput.ts │ │ │ │ ├── Order.ts │ │ │ │ ├── OrderCreateInput.ts │ │ │ │ ├── OrderUpdateInput.ts │ │ │ │ └── OrderWhereInput.ts │ │ │ ├── user │ │ │ │ ├── UserWhereUniqueInput.ts │ │ │ │ ├── UserCountArgs.ts │ │ │ │ ├── CreateUserArgs.ts │ │ │ │ ├── DeleteUserArgs.ts │ │ │ │ ├── UserFindUniqueArgs.ts │ │ │ │ ├── UserListRelationFilter.ts │ │ │ │ ├── UpdateUserArgs.ts │ │ │ │ ├── UserCreateInput.ts │ │ │ │ ├── UserUpdateInput.ts │ │ │ │ ├── User.ts │ │ │ │ ├── UserFindManyArgs.ts │ │ │ │ ├── UserWhereInput.ts │ │ │ │ └── UserOrderByInput.ts │ │ │ ├── address │ │ │ │ ├── AddressWhereUniqueInput.ts │ │ │ │ ├── AddressCountArgs.ts │ │ │ │ ├── CreateAddressArgs.ts │ │ │ │ ├── DeleteAddressArgs.ts │ │ │ │ ├── AddressFindUniqueArgs.ts │ │ │ │ ├── AddressListRelationFilter.ts │ │ │ │ ├── CustomerCreateNestedManyWithoutAddressesInput.ts │ │ │ │ ├── UpdateAddressArgs.ts │ │ │ │ ├── AddressFindManyArgs.ts │ │ │ │ ├── CustomerUpdateManyWithoutAddressesInput.ts │ │ │ │ ├── AddressOrderByInput.ts │ │ │ │ ├── Address.ts │ │ │ │ ├── AddressUpdateInput.ts │ │ │ │ ├── AddressCreateInput.ts │ │ │ │ └── AddressWhereInput.ts │ │ │ ├── customer │ │ │ │ ├── CustomerWhereUniqueInput.ts │ │ │ │ ├── CustomerCountArgs.ts │ │ │ │ ├── CreateCustomerArgs.ts │ │ │ │ ├── DeleteCustomerArgs.ts │ │ │ │ ├── CustomerFindUniqueArgs.ts │ │ │ │ ├── OrderCreateNestedManyWithoutCustomersInput.ts │ │ │ │ ├── CustomerListRelationFilter.ts │ │ │ │ ├── UpdateCustomerArgs.ts │ │ │ │ ├── OrderUpdateManyWithoutCustomersInput.ts │ │ │ │ ├── CustomerFindManyArgs.ts │ │ │ │ ├── CustomerOrderByInput.ts │ │ │ │ ├── Customer.ts │ │ │ │ ├── CustomerUpdateInput.ts │ │ │ │ ├── CustomerCreateInput.ts │ │ │ │ └── CustomerWhereInput.ts │ │ │ └── product │ │ │ │ ├── ProductWhereUniqueInput.ts │ │ │ │ ├── ProductCountArgs.ts │ │ │ │ ├── CreateProductArgs.ts │ │ │ │ ├── DeleteProductArgs.ts │ │ │ │ ├── ProductFindUniqueArgs.ts │ │ │ │ ├── OrderCreateNestedManyWithoutProductsInput.ts │ │ │ │ ├── ProductListRelationFilter.ts │ │ │ │ ├── UpdateProductArgs.ts │ │ │ │ ├── Product.ts │ │ │ │ ├── ProductOrderByInput.ts │ │ │ │ ├── OrderUpdateManyWithoutProductsInput.ts │ │ │ │ ├── ProductUpdateInput.ts │ │ │ │ ├── ProductFindManyArgs.ts │ │ │ │ ├── ProductCreateInput.ts │ │ │ │ └── ProductWhereInput.ts │ │ ├── constants.ts │ │ ├── order │ │ │ ├── OrderTitle.ts │ │ │ ├── OrderEdit.tsx │ │ │ ├── OrderCreate.tsx │ │ │ └── OrderShow.tsx │ │ ├── product │ │ │ ├── ProductTitle.ts │ │ │ ├── ProductList.tsx │ │ │ ├── ProductEdit.tsx │ │ │ └── ProductCreate.tsx │ │ ├── setupTests.ts │ │ ├── address │ │ │ ├── AddressTitle.ts │ │ │ ├── AddressList.tsx │ │ │ ├── AddressEdit.tsx │ │ │ └── AddressCreate.tsx │ │ ├── customer │ │ │ ├── CustomerTitle.ts │ │ │ ├── CustomerList.tsx │ │ │ ├── CustomerEdit.tsx │ │ │ └── CustomerCreate.tsx │ │ ├── types.ts │ │ ├── Components │ │ │ └── Pagination.tsx │ │ ├── pages │ │ │ └── Dashboard.tsx │ │ ├── reportWebVitals.ts │ │ ├── index.css │ │ ├── index.tsx │ │ ├── theme │ │ │ └── theme.ts │ │ ├── data-provider │ │ │ └── graphqlDataProvider.ts │ │ ├── auth.ts │ │ └── App.scss │ ├── public │ │ ├── robots.txt │ │ └── manifest.json │ ├── .dockerignore │ ├── configuration │ │ └── nginx.conf │ ├── .gitignore │ └── tsconfig.json └── mr-b-141107 │ ├── src │ ├── validators │ │ ├── index.ts │ │ └── is-json-value-validator.ts │ ├── constants.ts │ ├── types.ts │ ├── auth │ │ ├── constants.ts │ │ ├── jwt │ │ │ ├── jwtAuth.guard.ts │ │ │ ├── jwt.strategy.ts │ │ │ ├── jwtSecretFactory.ts │ │ │ └── base │ │ │ │ └── jwt.strategy.base.ts │ │ ├── IAuthStrategy.ts │ │ ├── ITokenService.ts │ │ ├── token.service.ts │ │ ├── acl.module.ts │ │ ├── LoginArgs.ts │ │ ├── UserInfo.ts │ │ ├── abac.util.ts │ │ ├── gqlAC.guard.ts │ │ ├── auth.controller.ts │ │ ├── Credentials.ts │ │ ├── gqlDefaultAuth.guard.ts │ │ ├── gqlUserRoles.decorator.ts │ │ ├── defaultAuth.guard.ts │ │ ├── auth.resolver.ts │ │ └── base │ │ │ └── token.service.base.ts │ ├── util │ │ ├── SortOrder.ts │ │ ├── QueryMode.ts │ │ ├── MetaQueryPayload.ts │ │ ├── BooleanFilter.ts │ │ ├── BooleanNullableFilter.ts │ │ ├── JsonFilter.ts │ │ └── JsonNullableFilter.ts │ ├── connectMicroservices.ts │ ├── prisma │ │ ├── prisma.module.ts │ │ └── prisma.service.ts │ ├── providers │ │ └── secrets │ │ │ ├── secretsManager.module.ts │ │ │ ├── secretsManager.service.ts │ │ │ └── base │ │ │ └── secretsManager.service.base.ts │ ├── health │ │ ├── health.module.ts │ │ ├── health.service.ts │ │ ├── health.controller.ts │ │ └── base │ │ │ ├── health.service.base.ts │ │ │ └── health.controller.base.ts │ ├── order │ │ ├── order.service.ts │ │ ├── order.module.ts │ │ ├── order.controller.ts │ │ ├── base │ │ │ ├── order.module.base.ts │ │ │ ├── OrderWhereUniqueInput.ts │ │ │ ├── OrderCountArgs.ts │ │ │ ├── CreateOrderArgs.ts │ │ │ ├── DeleteOrderArgs.ts │ │ │ ├── OrderFindUniqueArgs.ts │ │ │ └── UpdateOrderArgs.ts │ │ └── order.resolver.ts │ ├── address │ │ ├── address.service.ts │ │ ├── address.module.ts │ │ ├── address.controller.ts │ │ ├── base │ │ │ ├── address.module.base.ts │ │ │ ├── AddressWhereUniqueInput.ts │ │ │ ├── AddressCountArgs.ts │ │ │ ├── CreateAddressArgs.ts │ │ │ ├── CustomerCreateNestedManyWithoutAddressesInput.ts │ │ │ ├── DeleteAddressArgs.ts │ │ │ └── AddressFindUniqueArgs.ts │ │ └── address.resolver.ts │ ├── product │ │ ├── product.service.ts │ │ ├── product.module.ts │ │ ├── product.controller.ts │ │ ├── base │ │ │ ├── product.module.base.ts │ │ │ ├── ProductWhereUniqueInput.ts │ │ │ ├── ProductCountArgs.ts │ │ │ ├── OrderCreateNestedManyWithoutProductsInput.ts │ │ │ ├── CreateProductArgs.ts │ │ │ ├── DeleteProductArgs.ts │ │ │ └── ProductFindUniqueArgs.ts │ │ └── product.resolver.ts │ ├── customer │ │ ├── customer.service.ts │ │ ├── customer.module.ts │ │ ├── customer.controller.ts │ │ ├── base │ │ │ ├── customer.module.base.ts │ │ │ ├── CustomerWhereUniqueInput.ts │ │ │ ├── CustomerCountArgs.ts │ │ │ ├── OrderCreateNestedManyWithoutCustomersInput.ts │ │ │ ├── CreateCustomerArgs.ts │ │ │ ├── DeleteCustomerArgs.ts │ │ │ └── CustomerFindUniqueArgs.ts │ │ └── customer.resolver.ts │ ├── errors.ts │ ├── decorators │ │ └── public.decorator.ts │ ├── user │ │ ├── user.service.ts │ │ ├── user.module.ts │ │ ├── user.controller.ts │ │ ├── base │ │ │ ├── user.module.base.ts │ │ │ ├── UserWhereUniqueInput.ts │ │ │ ├── UserCountArgs.ts │ │ │ ├── CreateUserArgs.ts │ │ │ ├── DeleteUserArgs.ts │ │ │ ├── UserFindUniqueArgs.ts │ │ │ └── UpdateUserArgs.ts │ │ └── user.resolver.ts │ ├── tests │ │ ├── auth │ │ │ ├── constants.ts │ │ │ └── jwt │ │ │ │ └── jwt.strategy.spec.ts │ │ └── health │ │ │ └── health.service.spec.ts │ ├── prisma.util.spec.ts │ ├── swagger.ts │ ├── prisma.util.ts │ ├── swagger │ │ └── favicon.png │ ├── serveStaticOptions.service.ts │ └── interceptors │ │ └── aclFilterResponse.interceptor.ts │ ├── .prettierignore │ ├── nest-cli.json │ ├── .dockerignore │ ├── .gitignore │ ├── tsconfig.build.json │ ├── .env │ ├── scripts │ ├── customSeed.ts │ └── seed.ts │ ├── docker-compose.dev.yml │ ├── tsconfig.json │ └── docker-compose.yml ├── Genetic_Algorithm ├── ui.png ├── debug.png ├── graph.png └── generations.png ├── Two Player Chess ├── Images │ ├── bB.png │ ├── bK.png │ ├── bN.png │ ├── bQ.png │ ├── bR.png │ ├── bp.png │ ├── dtb.jpg │ ├── ltb.jpg │ ├── wB.png │ ├── wK.png │ ├── wN.png │ ├── wQ.png │ ├── wR.png │ ├── wp.png │ ├── chess.jpg │ ├── icon.png │ ├── logo1.jpg │ ├── royal.jpg │ ├── chess1.jpg │ ├── Highlight.jpg │ └── PromotionMenu.jpg └── __pycache__ │ └── engine.cpython-310.pyc ├── weather_app ├── credentials.py ├── __pycache__ │ ├── output.cpython-311.pyc │ ├── credentials.cpython-311.pyc │ └── functions.cpython-311.pyc └── main.py ├── Generating audio from text data.py ├── Text_to_QR.py ├── factorial.py ├── Bubble_Sort.py ├── Area_of_Triangle.py ├── ScreenshotTaker.py ├── spirograph.py ├── Selection_Sort.py ├── DFS_Undirected_graph.py ├── Youtube_Video_Downloader.py ├── rock_paper,,scissor.py ├── Password_Generator.py ├── joke_bot.py ├── Longest_common_prefix.py ├── binary_search.py ├── fb_logo.py ├── LICENSE ├── Improved_Password_Generator.py ├── turtle_race.py ├── README.md ├── mergesort.py ├── qrcode generator.py ├── Guess_the_number.py ├── Trigonometric_ratios.py ├── etch-a-sketch.py ├── breadth_first_search.py ├── depth_first_search.py ├── CONTRIBUTING.md └── password_manager.py /snake_game/requirement.txt: -------------------------------------------------------------------------------- 1 | pygame==2.5.2 -------------------------------------------------------------------------------- /Sudoku-GUI-Solver/requirements.txt: -------------------------------------------------------------------------------- 1 | pygame 2 | -------------------------------------------------------------------------------- /python-hangman-Sanyog_Mishra/.idea/.name: -------------------------------------------------------------------------------- 1 | main.py -------------------------------------------------------------------------------- /hs_battlegrounds/requirements.txt: -------------------------------------------------------------------------------- 1 | termcolor==2.3.0 2 | -------------------------------------------------------------------------------- /hs_battlegrounds/.gitignore: -------------------------------------------------------------------------------- 1 | **/__pycache__/ 2 | venv/ 3 | 4 | -------------------------------------------------------------------------------- /Hello.py: -------------------------------------------------------------------------------- 1 | print("Hello World, this is the basic program in Python language!") -------------------------------------------------------------------------------- /Mailer-main/Mailer-main/README.md: -------------------------------------------------------------------------------- 1 | # Mailer 2 | An Email-Automation Tool 3 | -------------------------------------------------------------------------------- /credit_card_fraud_detection/norm.json: -------------------------------------------------------------------------------- 1 | [-8.226969338778424, 5.623285408193404] -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/.env: -------------------------------------------------------------------------------- 1 | PORT=3001 2 | REACT_APP_SERVER_URL=http://localhost:3000 -------------------------------------------------------------------------------- /apps/mr-b-141107/src/validators/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./is-json-value-validator"; 2 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/user/EnumRoles.ts: -------------------------------------------------------------------------------- 1 | export enum EnumRoles { 2 | User = "user", 3 | } 4 | -------------------------------------------------------------------------------- /python-hangman-Sanyog_Mishra/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /Genetic_Algorithm/ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Genetic_Algorithm/ui.png -------------------------------------------------------------------------------- /Genetic_Algorithm/debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Genetic_Algorithm/debug.png -------------------------------------------------------------------------------- /Genetic_Algorithm/graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Genetic_Algorithm/graph.png -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/MetaQueryPayload.ts: -------------------------------------------------------------------------------- 1 | export class MetaQueryPayload { 2 | count!: number; 3 | } 4 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/SortOrder.ts: -------------------------------------------------------------------------------- 1 | export enum SortOrder { 2 | Asc = "asc", 3 | Desc = "desc", 4 | } 5 | -------------------------------------------------------------------------------- /apps/mr-b-141107/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | prisma/migrations/ 4 | package-lock.json 5 | coverage/ -------------------------------------------------------------------------------- /Two Player Chess/Images/bB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/bB.png -------------------------------------------------------------------------------- /Two Player Chess/Images/bK.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/bK.png -------------------------------------------------------------------------------- /Two Player Chess/Images/bN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/bN.png -------------------------------------------------------------------------------- /Two Player Chess/Images/bQ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/bQ.png -------------------------------------------------------------------------------- /Two Player Chess/Images/bR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/bR.png -------------------------------------------------------------------------------- /Two Player Chess/Images/bp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/bp.png -------------------------------------------------------------------------------- /Two Player Chess/Images/dtb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/dtb.jpg -------------------------------------------------------------------------------- /Two Player Chess/Images/ltb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/ltb.jpg -------------------------------------------------------------------------------- /Two Player Chess/Images/wB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/wB.png -------------------------------------------------------------------------------- /Two Player Chess/Images/wK.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/wK.png -------------------------------------------------------------------------------- /Two Player Chess/Images/wN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/wN.png -------------------------------------------------------------------------------- /Two Player Chess/Images/wQ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/wQ.png -------------------------------------------------------------------------------- /Two Player Chess/Images/wR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/wR.png -------------------------------------------------------------------------------- /Two Player Chess/Images/wp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/wp.png -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /snake_game/images/game_logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/snake_game/images/game_logo.jpg -------------------------------------------------------------------------------- /Genetic_Algorithm/generations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Genetic_Algorithm/generations.png -------------------------------------------------------------------------------- /Mailer-main/Mailer-main/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Mailer-main/Mailer-main/Logo.png -------------------------------------------------------------------------------- /Two Player Chess/Images/chess.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/chess.jpg -------------------------------------------------------------------------------- /Two Player Chess/Images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/icon.png -------------------------------------------------------------------------------- /Two Player Chess/Images/logo1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/logo1.jpg -------------------------------------------------------------------------------- /Two Player Chess/Images/royal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/royal.jpg -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/OrderWhereUniqueInput.ts: -------------------------------------------------------------------------------- 1 | export type OrderWhereUniqueInput = { 2 | id: string; 3 | }; 4 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/UserWhereUniqueInput.ts: -------------------------------------------------------------------------------- 1 | export type UserWhereUniqueInput = { 2 | id: string; 3 | }; 4 | -------------------------------------------------------------------------------- /Two Player Chess/Images/chess1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/chess1.jpg -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/BooleanFilter.ts: -------------------------------------------------------------------------------- 1 | export class BooleanFilter { 2 | equals?: boolean; 3 | not?: boolean; 4 | } 5 | -------------------------------------------------------------------------------- /credit_card_fraud_detection/model.pk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/credit_card_fraud_detection/model.pk -------------------------------------------------------------------------------- /hs_battlegrounds/config.py: -------------------------------------------------------------------------------- 1 | CARD_TXT_SPACE = 3 2 | BOARD_LENGTH = 7 3 | POISON_PROB = 0.15 4 | BUBBLE_PROB = 0.25 5 | DELAY = 2 6 | -------------------------------------------------------------------------------- /Mailer-main/Mailer-main/logo-color.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Mailer-main/Mailer-main/logo-color.ico -------------------------------------------------------------------------------- /Two Player Chess/Images/Highlight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/Highlight.jpg -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/AddressWhereUniqueInput.ts: -------------------------------------------------------------------------------- 1 | export type AddressWhereUniqueInput = { 2 | id: string; 3 | }; 4 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/CustomerWhereUniqueInput.ts: -------------------------------------------------------------------------------- 1 | export type CustomerWhereUniqueInput = { 2 | id: string; 3 | }; 4 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/ProductWhereUniqueInput.ts: -------------------------------------------------------------------------------- 1 | export type ProductWhereUniqueInput = { 2 | id: string; 3 | }; 4 | -------------------------------------------------------------------------------- /apps/mr-b-141107/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "sourceRoot": "src", 3 | "compilerOptions": { 4 | "assets": ["swagger"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/constants.ts: -------------------------------------------------------------------------------- 1 | export const JWT_SECRET_KEY = "JWT_SECRET_KEY"; 2 | export const JWT_EXPIRATION = "JWT_EXPIRATION"; 3 | -------------------------------------------------------------------------------- /Two Player Chess/Images/PromotionMenu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/Images/PromotionMenu.jpg -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/user/roles.ts: -------------------------------------------------------------------------------- 1 | export const ROLES = [ 2 | { 3 | name: "user", 4 | displayName: "User", 5 | }, 6 | ]; 7 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/QueryMode.ts: -------------------------------------------------------------------------------- 1 | export enum QueryMode { 2 | Default = "default", 3 | Insensitive = "insensitive", 4 | } 5 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/types.ts: -------------------------------------------------------------------------------- 1 | import type { JsonValue } from "type-fest"; 2 | 3 | export type InputJsonValue = Omit; 4 | -------------------------------------------------------------------------------- /weather_app/credentials.py: -------------------------------------------------------------------------------- 1 | API_KEY = "8a29f69253228446ac8a44f14377a244" 2 | BASE_URL = "http://api.openweathermap.org/data/2.5/weather?" 3 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/.dockerignore: -------------------------------------------------------------------------------- 1 | .dockerignore 2 | docker-compose.yml 3 | Dockerfile 4 | build/ 5 | node_modules 6 | .env 7 | .gitignore 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107/.dockerignore: -------------------------------------------------------------------------------- 1 | .dockerignore 2 | docker-compose.yml 3 | Dockerfile 4 | dist/ 5 | node_modules 6 | .env 7 | .gitignore 8 | .prettierignore -------------------------------------------------------------------------------- /weather_app/__pycache__/output.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/weather_app/__pycache__/output.cpython-311.pyc -------------------------------------------------------------------------------- /snake_game/__pycache__/constants.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/snake_game/__pycache__/constants.cpython-38.pyc -------------------------------------------------------------------------------- /Two Player Chess/__pycache__/engine.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/Two Player Chess/__pycache__/engine.cpython-310.pyc -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/BooleanNullableFilter.ts: -------------------------------------------------------------------------------- 1 | export class BooleanNullableFilter { 2 | equals?: boolean | null; 3 | not?: boolean | null; 4 | } 5 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/constants.ts: -------------------------------------------------------------------------------- 1 | export const INVALID_USERNAME_ERROR = "Invalid username"; 2 | export const INVALID_PASSWORD_ERROR = "Invalid password"; 3 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/jwt/jwtAuth.guard.ts: -------------------------------------------------------------------------------- 1 | import { AuthGuard } from "@nestjs/passport"; 2 | 3 | export class JwtAuthGuard extends AuthGuard("jwt") {} 4 | -------------------------------------------------------------------------------- /weather_app/__pycache__/credentials.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/weather_app/__pycache__/credentials.cpython-311.pyc -------------------------------------------------------------------------------- /weather_app/__pycache__/functions.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blazier07/Python_Projects/HEAD/weather_app/__pycache__/functions.cpython-311.pyc -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/constants.ts: -------------------------------------------------------------------------------- 1 | export const CREDENTIALS_LOCAL_STORAGE_ITEM = "credentials"; 2 | export const USER_DATA_LOCAL_STORAGE_ITEM = "userData"; 3 | -------------------------------------------------------------------------------- /apps/mr-b-141107/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | /node_modules 4 | /dist 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "prisma", "test", "dist", "**/*spec.ts", "admin"] 4 | } 5 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/UserCountArgs.ts: -------------------------------------------------------------------------------- 1 | import { UserWhereInput } from "./UserWhereInput"; 2 | 3 | export type UserCountArgs = { 4 | where?: UserWhereInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/CreateUserArgs.ts: -------------------------------------------------------------------------------- 1 | import { UserCreateInput } from "./UserCreateInput"; 2 | 3 | export type CreateUserArgs = { 4 | data: UserCreateInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/JsonFilter.ts: -------------------------------------------------------------------------------- 1 | import { InputJsonValue } from "../types"; 2 | export class JsonFilter { 3 | equals?: InputJsonValue; 4 | not?: InputJsonValue; 5 | } 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/IAuthStrategy.ts: -------------------------------------------------------------------------------- 1 | import { UserInfo } from "./UserInfo"; 2 | 3 | export interface IAuthStrategy { 4 | validate: (...any: any) => Promise; 5 | } 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/CreateOrderArgs.ts: -------------------------------------------------------------------------------- 1 | import { OrderCreateInput } from "./OrderCreateInput"; 2 | 3 | export type CreateOrderArgs = { 4 | data: OrderCreateInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/OrderCountArgs.ts: -------------------------------------------------------------------------------- 1 | import { OrderWhereInput } from "./OrderWhereInput"; 2 | 3 | export type OrderCountArgs = { 4 | where?: OrderWhereInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/AddressCountArgs.ts: -------------------------------------------------------------------------------- 1 | import { AddressWhereInput } from "./AddressWhereInput"; 2 | 3 | export type AddressCountArgs = { 4 | where?: AddressWhereInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/ProductCountArgs.ts: -------------------------------------------------------------------------------- 1 | import { ProductWhereInput } from "./ProductWhereInput"; 2 | 3 | export type ProductCountArgs = { 4 | where?: ProductWhereInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/DeleteUserArgs.ts: -------------------------------------------------------------------------------- 1 | import { UserWhereUniqueInput } from "./UserWhereUniqueInput"; 2 | 3 | export type DeleteUserArgs = { 4 | where: UserWhereUniqueInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/JsonNullableFilter.ts: -------------------------------------------------------------------------------- 1 | import { JsonValue } from "type-fest"; 2 | export class JsonNullableFilter { 3 | equals?: JsonValue | null; 4 | not?: JsonValue | null; 5 | } 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/CreateAddressArgs.ts: -------------------------------------------------------------------------------- 1 | import { AddressCreateInput } from "./AddressCreateInput"; 2 | 3 | export type CreateAddressArgs = { 4 | data: AddressCreateInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/CustomerCountArgs.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereInput } from "./CustomerWhereInput"; 2 | 3 | export type CustomerCountArgs = { 4 | where?: CustomerWhereInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/DeleteOrderArgs.ts: -------------------------------------------------------------------------------- 1 | import { OrderWhereUniqueInput } from "./OrderWhereUniqueInput"; 2 | 3 | export type DeleteOrderArgs = { 4 | where: OrderWhereUniqueInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/CreateProductArgs.ts: -------------------------------------------------------------------------------- 1 | import { ProductCreateInput } from "./ProductCreateInput"; 2 | 3 | export type CreateProductArgs = { 4 | data: ProductCreateInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/CreateCustomerArgs.ts: -------------------------------------------------------------------------------- 1 | import { CustomerCreateInput } from "./CustomerCreateInput"; 2 | 3 | export type CreateCustomerArgs = { 4 | data: CustomerCreateInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/UserFindUniqueArgs.ts: -------------------------------------------------------------------------------- 1 | import { UserWhereUniqueInput } from "./UserWhereUniqueInput"; 2 | 3 | export type UserFindUniqueArgs = { 4 | where: UserWhereUniqueInput; 5 | }; 6 | -------------------------------------------------------------------------------- /Generating audio from text data.py: -------------------------------------------------------------------------------- 1 | from gtts import gTTS 2 | import os 3 | 4 | text="Today is holiday" 5 | output=gTTS(text=text,lang='en',slow=False) 6 | output.save('output.mp3') 7 | os.system('start output.mp3') -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/OrderFindUniqueArgs.ts: -------------------------------------------------------------------------------- 1 | import { OrderWhereUniqueInput } from "./OrderWhereUniqueInput"; 2 | 3 | export type OrderFindUniqueArgs = { 4 | where: OrderWhereUniqueInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/DeleteAddressArgs.ts: -------------------------------------------------------------------------------- 1 | import { AddressWhereUniqueInput } from "./AddressWhereUniqueInput"; 2 | 3 | export type DeleteAddressArgs = { 4 | where: AddressWhereUniqueInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/DeleteProductArgs.ts: -------------------------------------------------------------------------------- 1 | import { ProductWhereUniqueInput } from "./ProductWhereUniqueInput"; 2 | 3 | export type DeleteProductArgs = { 4 | where: ProductWhereUniqueInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/AddressFindUniqueArgs.ts: -------------------------------------------------------------------------------- 1 | import { AddressWhereUniqueInput } from "./AddressWhereUniqueInput"; 2 | 3 | export type AddressFindUniqueArgs = { 4 | where: AddressWhereUniqueInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/DeleteCustomerArgs.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereUniqueInput } from "./CustomerWhereUniqueInput"; 2 | 3 | export type DeleteCustomerArgs = { 4 | where: CustomerWhereUniqueInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/ProductFindUniqueArgs.ts: -------------------------------------------------------------------------------- 1 | import { ProductWhereUniqueInput } from "./ProductWhereUniqueInput"; 2 | 3 | export type ProductFindUniqueArgs = { 4 | where: ProductWhereUniqueInput; 5 | }; 6 | -------------------------------------------------------------------------------- /Text_to_QR.py: -------------------------------------------------------------------------------- 1 | import qrcode 2 | print(f"Enter the text that you want to convert to QRcode : ") 3 | text = str(input("")) 4 | img = qrcode.make(text) 5 | img.save('qrcode.jpg') 6 | print("Your qrcode is save as 'qrcode.jpg'") 7 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/CustomerFindUniqueArgs.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereUniqueInput } from "./CustomerWhereUniqueInput"; 2 | 3 | export type CustomerFindUniqueArgs = { 4 | where: CustomerWhereUniqueInput; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/DateTimeFilter.ts: -------------------------------------------------------------------------------- 1 | export class DateTimeFilter { 2 | equals?: Date; 3 | not?: Date; 4 | in?: Date[]; 5 | notIn?: Date[]; 6 | lt?: Date; 7 | lte?: Date; 8 | gt?: Date; 9 | gte?: Date; 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/IntFilter.ts: -------------------------------------------------------------------------------- 1 | export class IntFilter { 2 | equals?: number; 3 | in?: number[]; 4 | notIn?: number[]; 5 | lt?: number; 6 | lte?: number; 7 | gt?: number; 8 | gte?: number; 9 | not?: number; 10 | } 11 | -------------------------------------------------------------------------------- /python-hangman-Sanyog_Mishra/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/UserListRelationFilter.ts: -------------------------------------------------------------------------------- 1 | import { UserWhereInput } from "./UserWhereInput"; 2 | 3 | export type UserListRelationFilter = { 4 | every?: UserWhereInput; 5 | some?: UserWhereInput; 6 | none?: UserWhereInput; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/FloatFilter.ts: -------------------------------------------------------------------------------- 1 | export class FloatFilter { 2 | equals?: number; 3 | in?: number[]; 4 | notIn?: number[]; 5 | lt?: number; 6 | lte?: number; 7 | gt?: number; 8 | gte?: number; 9 | not?: number; 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/OrderListRelationFilter.ts: -------------------------------------------------------------------------------- 1 | import { OrderWhereInput } from "./OrderWhereInput"; 2 | 3 | export type OrderListRelationFilter = { 4 | every?: OrderWhereInput; 5 | some?: OrderWhereInput; 6 | none?: OrderWhereInput; 7 | }; 8 | -------------------------------------------------------------------------------- /python-hangman-Sanyog_Mishra/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/AddressListRelationFilter.ts: -------------------------------------------------------------------------------- 1 | import { AddressWhereInput } from "./AddressWhereInput"; 2 | 3 | export type AddressListRelationFilter = { 4 | every?: AddressWhereInput; 5 | some?: AddressWhereInput; 6 | none?: AddressWhereInput; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/OrderCreateNestedManyWithoutCustomersInput.ts: -------------------------------------------------------------------------------- 1 | import { OrderWhereUniqueInput } from "../order/OrderWhereUniqueInput"; 2 | 3 | export type OrderCreateNestedManyWithoutCustomersInput = { 4 | connect?: Array; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/OrderCreateNestedManyWithoutProductsInput.ts: -------------------------------------------------------------------------------- 1 | import { OrderWhereUniqueInput } from "../order/OrderWhereUniqueInput"; 2 | 3 | export type OrderCreateNestedManyWithoutProductsInput = { 4 | connect?: Array; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/ProductListRelationFilter.ts: -------------------------------------------------------------------------------- 1 | import { ProductWhereInput } from "./ProductWhereInput"; 2 | 3 | export type ProductListRelationFilter = { 4 | every?: ProductWhereInput; 5 | some?: ProductWhereInput; 6 | none?: ProductWhereInput; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/order/OrderTitle.ts: -------------------------------------------------------------------------------- 1 | import { Order as TOrder } from "../api/order/Order"; 2 | 3 | export const ORDER_TITLE_FIELD = "id"; 4 | 5 | export const OrderTitle = (record: TOrder): string => { 6 | return record.id?.toString() || String(record.id); 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/util/SortOrder.ts: -------------------------------------------------------------------------------- 1 | import { registerEnumType } from "@nestjs/graphql"; 2 | 3 | export enum SortOrder { 4 | Asc = "asc", 5 | Desc = "desc", 6 | } 7 | registerEnumType(SortOrder, { 8 | name: "SortOrder", 9 | description: undefined, 10 | }); 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/UpdateUserArgs.ts: -------------------------------------------------------------------------------- 1 | import { UserWhereUniqueInput } from "./UserWhereUniqueInput"; 2 | import { UserUpdateInput } from "./UserUpdateInput"; 3 | 4 | export type UpdateUserArgs = { 5 | where: UserWhereUniqueInput; 6 | data: UserUpdateInput; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/user/UserTitle.ts: -------------------------------------------------------------------------------- 1 | import { User as TUser } from "../api/user/User"; 2 | 3 | export const USER_TITLE_FIELD = "firstName"; 4 | 5 | export const UserTitle = (record: TUser): string => { 6 | return record.firstName?.toString() || String(record.id); 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/DateTimeNullableFilter.ts: -------------------------------------------------------------------------------- 1 | export class DateTimeNullableFilter { 2 | equals?: Date | null; 3 | in?: Date[] | null; 4 | notIn?: Date[] | null; 5 | lt?: Date; 6 | lte?: Date; 7 | gt?: Date; 8 | gte?: Date; 9 | not?: Date; 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/connectMicroservices.ts: -------------------------------------------------------------------------------- 1 | import { INestApplication } from "@nestjs/common"; 2 | import { ConfigService } from "@nestjs/config"; 3 | 4 | export async function connectMicroservices(app: INestApplication) { 5 | const configService = app.get(ConfigService); 6 | } 7 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/CustomerListRelationFilter.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereInput } from "./CustomerWhereInput"; 2 | 3 | export type CustomerListRelationFilter = { 4 | every?: CustomerWhereInput; 5 | some?: CustomerWhereInput; 6 | none?: CustomerWhereInput; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/IntNullableFilter.ts: -------------------------------------------------------------------------------- 1 | export class IntNullableFilter { 2 | equals?: number | null; 3 | in?: number[] | null; 4 | notIn?: number[] | null; 5 | lt?: number; 6 | lte?: number; 7 | gt?: number; 8 | gte?: number; 9 | not?: number; 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107/.env: -------------------------------------------------------------------------------- 1 | BCRYPT_SALT=10 2 | COMPOSE_PROJECT_NAME=amp_clnkd6x8p0f0ifc01tjv8msk9 3 | PORT=3000 4 | JWT_SECRET_KEY=Change_ME!!! 5 | JWT_EXPIRATION=2d 6 | DB_USER=root 7 | DB_PASSWORD=admin 8 | DB_PORT=3306 9 | DB_NAME=my-db 10 | DB_URL=mysql://root:admin@localhost:3306/my-db -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/ITokenService.ts: -------------------------------------------------------------------------------- 1 | export interface ITokenPayload { 2 | id: string; 3 | username: string; 4 | password: string; 5 | } 6 | 7 | export interface ITokenService { 8 | createToken: ({ id, username, password }: ITokenPayload) => Promise; 9 | } 10 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/UpdateOrderArgs.ts: -------------------------------------------------------------------------------- 1 | import { OrderWhereUniqueInput } from "./OrderWhereUniqueInput"; 2 | import { OrderUpdateInput } from "./OrderUpdateInput"; 3 | 4 | export type UpdateOrderArgs = { 5 | where: OrderWhereUniqueInput; 6 | data: OrderUpdateInput; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/FloatNullableFilter.ts: -------------------------------------------------------------------------------- 1 | export class FloatNullableFilter { 2 | equals?: number | null; 3 | in?: number[] | null; 4 | notIn?: number[] | null; 5 | lt?: number; 6 | lte?: number; 7 | gt?: number; 8 | gte?: number; 9 | not?: number; 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/CustomerCreateNestedManyWithoutAddressesInput.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereUniqueInput } from "../customer/CustomerWhereUniqueInput"; 2 | 3 | export type CustomerCreateNestedManyWithoutAddressesInput = { 4 | connect?: Array; 5 | }; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/product/ProductTitle.ts: -------------------------------------------------------------------------------- 1 | import { Product as TProduct } from "../api/product/Product"; 2 | 3 | export const PRODUCT_TITLE_FIELD = "name"; 4 | 5 | export const ProductTitle = (record: TProduct): string => { 6 | return record.name?.toString() || String(record.id); 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import "@testing-library/jest-dom"; 6 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/prisma/prisma.module.ts: -------------------------------------------------------------------------------- 1 | import { Global, Module } from "@nestjs/common"; 2 | import { PrismaService } from "./prisma.service"; 3 | 4 | @Global() 5 | @Module({ 6 | providers: [PrismaService], 7 | exports: [PrismaService], 8 | }) 9 | export class PrismaModule {} 10 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/util/QueryMode.ts: -------------------------------------------------------------------------------- 1 | import { registerEnumType } from "@nestjs/graphql"; 2 | 3 | export enum QueryMode { 4 | Default = "default", 5 | Insensitive = "insensitive", 6 | } 7 | registerEnumType(QueryMode, { 8 | name: "QueryMode", 9 | description: undefined, 10 | }); 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/UserCreateInput.ts: -------------------------------------------------------------------------------- 1 | import { InputJsonValue } from "../../types"; 2 | 3 | export type UserCreateInput = { 4 | firstName?: string | null; 5 | lastName?: string | null; 6 | password: string; 7 | roles: InputJsonValue; 8 | username: string; 9 | }; 10 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/UserUpdateInput.ts: -------------------------------------------------------------------------------- 1 | import { InputJsonValue } from "../../types"; 2 | 3 | export type UserUpdateInput = { 4 | firstName?: string | null; 5 | lastName?: string | null; 6 | password?: string; 7 | roles?: InputJsonValue; 8 | username?: string; 9 | }; 10 | -------------------------------------------------------------------------------- /factorial.py: -------------------------------------------------------------------------------- 1 | # Function for returning factorial of 'n' using RECURSION 2 | def fact(n): 3 | if(n==1): 4 | return 1 5 | else: 6 | return n*fact(n-1) 7 | 8 | print("Enter a number of your choice : ") 9 | N = int(input()) 10 | result=fact(N) 11 | print("Factorial of ",N," : ",result) 12 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/configuration/nginx.conf: -------------------------------------------------------------------------------- 1 | server_tokens off; 2 | 3 | server { 4 | listen 8080; 5 | server_name localhost; 6 | location / { 7 | root /usr/share/nginx/html; 8 | index index.html index.htm; 9 | try_files $uri /index.html; 10 | } 11 | } -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/address/AddressTitle.ts: -------------------------------------------------------------------------------- 1 | import { Address as TAddress } from "../api/address/Address"; 2 | 3 | export const ADDRESS_TITLE_FIELD = "address_1"; 4 | 5 | export const AddressTitle = (record: TAddress): string => { 6 | return record.address_1?.toString() || String(record.id); 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/User.ts: -------------------------------------------------------------------------------- 1 | import { JsonValue } from "type-fest"; 2 | 3 | export type User = { 4 | createdAt: Date; 5 | firstName: string | null; 6 | id: string; 7 | lastName: string | null; 8 | roles: JsonValue; 9 | updatedAt: Date; 10 | username: string; 11 | }; 12 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/UpdateAddressArgs.ts: -------------------------------------------------------------------------------- 1 | import { AddressWhereUniqueInput } from "./AddressWhereUniqueInput"; 2 | import { AddressUpdateInput } from "./AddressUpdateInput"; 3 | 4 | export type UpdateAddressArgs = { 5 | where: AddressWhereUniqueInput; 6 | data: AddressUpdateInput; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/UpdateProductArgs.ts: -------------------------------------------------------------------------------- 1 | import { ProductWhereUniqueInput } from "./ProductWhereUniqueInput"; 2 | import { ProductUpdateInput } from "./ProductUpdateInput"; 3 | 4 | export type UpdateProductArgs = { 5 | where: ProductWhereUniqueInput; 6 | data: ProductUpdateInput; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/customer/CustomerTitle.ts: -------------------------------------------------------------------------------- 1 | import { Customer as TCustomer } from "../api/customer/Customer"; 2 | 3 | export const CUSTOMER_TITLE_FIELD = "firstName"; 4 | 5 | export const CustomerTitle = (record: TCustomer): string => { 6 | return record.firstName?.toString() || String(record.id); 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/UpdateCustomerArgs.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereUniqueInput } from "./CustomerWhereUniqueInput"; 2 | import { CustomerUpdateInput } from "./CustomerUpdateInput"; 3 | 4 | export type UpdateCustomerArgs = { 5 | where: CustomerWhereUniqueInput; 6 | data: CustomerUpdateInput; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/providers/secrets/secretsManager.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from "@nestjs/common"; 2 | import { SecretsManagerService } from "./secretsManager.service"; 3 | 4 | @Module({ 5 | providers: [SecretsManagerService], 6 | exports: [SecretsManagerService], 7 | }) 8 | export class SecretsManagerModule {} 9 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/Product.ts: -------------------------------------------------------------------------------- 1 | import { Order } from "../order/Order"; 2 | 3 | export type Product = { 4 | createdAt: Date; 5 | description: string | null; 6 | id: string; 7 | itemPrice: number | null; 8 | name: string | null; 9 | orders?: Array; 10 | updatedAt: Date; 11 | }; 12 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/user/RolesOptions.ts: -------------------------------------------------------------------------------- 1 | //@ts-ignore 2 | import { ROLES } from "./roles"; 3 | 4 | declare interface Role { 5 | name: string; 6 | displayName: string; 7 | } 8 | 9 | export const ROLES_OPTIONS = ROLES.map((role: Role) => ({ 10 | value: role.name, 11 | label: role.displayName, 12 | })); 13 | -------------------------------------------------------------------------------- /weather_app/main.py: -------------------------------------------------------------------------------- 1 | from functions import * 2 | from output import * 3 | 4 | print("-------------------------------------") 5 | print("[bold deep_sky_blue1]Weather Forecast App [/bold deep_sky_blue1]") 6 | cityName = input("Enter the City Name: ") 7 | 8 | data = getWeather(cityName) 9 | printOutput(cityName, data) 10 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/token.service.ts: -------------------------------------------------------------------------------- 1 | //@ts-ignore 2 | import { ITokenService } from "./ITokenService"; 3 | // eslint-disable-next-line import/no-unresolved 4 | //@ts-ignore 5 | import { TokenServiceBase } from "./base/token.service.base"; 6 | 7 | export class TokenService extends TokenServiceBase implements ITokenService {} 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/ProductOrderByInput.ts: -------------------------------------------------------------------------------- 1 | import { SortOrder } from "../../util/SortOrder"; 2 | 3 | export type ProductOrderByInput = { 4 | createdAt?: SortOrder; 5 | description?: SortOrder; 6 | id?: SortOrder; 7 | itemPrice?: SortOrder; 8 | name?: SortOrder; 9 | updatedAt?: SortOrder; 10 | }; 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/UserFindManyArgs.ts: -------------------------------------------------------------------------------- 1 | import { UserWhereInput } from "./UserWhereInput"; 2 | import { UserOrderByInput } from "./UserOrderByInput"; 3 | 4 | export type UserFindManyArgs = { 5 | where?: UserWhereInput; 6 | orderBy?: Array; 7 | skip?: number; 8 | take?: number; 9 | }; 10 | -------------------------------------------------------------------------------- /python-hangman-Sanyog_Mishra/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /python-hangman-Sanyog_Mishra/info.txt: -------------------------------------------------------------------------------- 1 | This code aims to imitate the game hangman. 2 | Executing main.py runs the game. 3 | 4 | Note: 1. The game gives hint by giving word lenth. 5 | 2. Life increases by one for every correct guess (even if it repeats in the words), provided lives are already not maximum (=6). 6 | 7 | THANK YOU!! 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/OrderFindManyArgs.ts: -------------------------------------------------------------------------------- 1 | import { OrderWhereInput } from "./OrderWhereInput"; 2 | import { OrderOrderByInput } from "./OrderOrderByInput"; 3 | 4 | export type OrderFindManyArgs = { 5 | where?: OrderWhereInput; 6 | orderBy?: Array; 7 | skip?: number; 8 | take?: number; 9 | }; 10 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/OrderUpdateManyWithoutProductsInput.ts: -------------------------------------------------------------------------------- 1 | import { OrderWhereUniqueInput } from "../order/OrderWhereUniqueInput"; 2 | 3 | export type OrderUpdateManyWithoutProductsInput = { 4 | connect?: Array; 5 | disconnect?: Array; 6 | set?: Array; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/ProductUpdateInput.ts: -------------------------------------------------------------------------------- 1 | import { OrderUpdateManyWithoutProductsInput } from "./OrderUpdateManyWithoutProductsInput"; 2 | 3 | export type ProductUpdateInput = { 4 | description?: string | null; 5 | itemPrice?: number | null; 6 | name?: string | null; 7 | orders?: OrderUpdateManyWithoutProductsInput; 8 | }; 9 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/OrderUpdateManyWithoutCustomersInput.ts: -------------------------------------------------------------------------------- 1 | import { OrderWhereUniqueInput } from "../order/OrderWhereUniqueInput"; 2 | 3 | export type OrderUpdateManyWithoutCustomersInput = { 4 | connect?: Array; 5 | disconnect?: Array; 6 | set?: Array; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/AddressFindManyArgs.ts: -------------------------------------------------------------------------------- 1 | import { AddressWhereInput } from "./AddressWhereInput"; 2 | import { AddressOrderByInput } from "./AddressOrderByInput"; 3 | 4 | export type AddressFindManyArgs = { 5 | where?: AddressWhereInput; 6 | orderBy?: Array; 7 | skip?: number; 8 | take?: number; 9 | }; 10 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/ProductFindManyArgs.ts: -------------------------------------------------------------------------------- 1 | import { ProductWhereInput } from "./ProductWhereInput"; 2 | import { ProductOrderByInput } from "./ProductOrderByInput"; 3 | 4 | export type ProductFindManyArgs = { 5 | where?: ProductWhereInput; 6 | orderBy?: Array; 7 | skip?: number; 8 | take?: number; 9 | }; 10 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/types.ts: -------------------------------------------------------------------------------- 1 | import { JsonValue } from "type-fest"; 2 | 3 | export type Credentials = { 4 | username: string; 5 | password: string; 6 | }; 7 | export type LoginMutateResult = { 8 | login: { 9 | username: string; 10 | accessToken: string; 11 | }; 12 | }; 13 | export type InputJsonValue = Omit; 14 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/CustomerFindManyArgs.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereInput } from "./CustomerWhereInput"; 2 | import { CustomerOrderByInput } from "./CustomerOrderByInput"; 3 | 4 | export type CustomerFindManyArgs = { 5 | where?: CustomerWhereInput; 6 | orderBy?: Array; 7 | skip?: number; 8 | take?: number; 9 | }; 10 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/ProductCreateInput.ts: -------------------------------------------------------------------------------- 1 | import { OrderCreateNestedManyWithoutProductsInput } from "./OrderCreateNestedManyWithoutProductsInput"; 2 | 3 | export type ProductCreateInput = { 4 | description?: string | null; 5 | itemPrice?: number | null; 6 | name?: string | null; 7 | orders?: OrderCreateNestedManyWithoutProductsInput; 8 | }; 9 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/health/health.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from "@nestjs/common"; 2 | import { HealthController } from "./health.controller"; 3 | import { HealthService } from "./health.service"; 4 | 5 | @Module({ 6 | controllers: [HealthController], 7 | providers: [HealthService], 8 | exports: [HealthService], 9 | }) 10 | export class HealthModule {} 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/UserWhereInput.ts: -------------------------------------------------------------------------------- 1 | import { StringNullableFilter } from "../../util/StringNullableFilter"; 2 | import { StringFilter } from "../../util/StringFilter"; 3 | 4 | export type UserWhereInput = { 5 | firstName?: StringNullableFilter; 6 | id?: StringFilter; 7 | lastName?: StringNullableFilter; 8 | username?: StringFilter; 9 | }; 10 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/CustomerUpdateManyWithoutAddressesInput.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereUniqueInput } from "../customer/CustomerWhereUniqueInput"; 2 | 3 | export type CustomerUpdateManyWithoutAddressesInput = { 4 | connect?: Array; 5 | disconnect?: Array; 6 | set?: Array; 7 | }; 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/acl.module.ts: -------------------------------------------------------------------------------- 1 | import { AccessControlModule, RolesBuilder } from "nest-access-control"; 2 | // @ts-ignore 3 | // eslint-disable-next-line import/no-unresolved 4 | import grants from "../grants.json"; 5 | 6 | // eslint-disable-next-line @typescript-eslint/naming-convention 7 | export const ACLModule = AccessControlModule.forRoles(new RolesBuilder(grants)); 8 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/util/MetaQueryPayload.ts: -------------------------------------------------------------------------------- 1 | import { ObjectType, Field } from "@nestjs/graphql"; 2 | import { ApiProperty } from "@nestjs/swagger"; 3 | 4 | @ObjectType() 5 | class MetaQueryPayload { 6 | @ApiProperty({ 7 | required: true, 8 | type: [Number], 9 | }) 10 | @Field(() => Number) 11 | count!: number; 12 | } 13 | export { MetaQueryPayload }; 14 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/AddressOrderByInput.ts: -------------------------------------------------------------------------------- 1 | import { SortOrder } from "../../util/SortOrder"; 2 | 3 | export type AddressOrderByInput = { 4 | address_1?: SortOrder; 5 | address_2?: SortOrder; 6 | city?: SortOrder; 7 | createdAt?: SortOrder; 8 | id?: SortOrder; 9 | state?: SortOrder; 10 | updatedAt?: SortOrder; 11 | zip?: SortOrder; 12 | }; 13 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/user/UserOrderByInput.ts: -------------------------------------------------------------------------------- 1 | import { SortOrder } from "../../util/SortOrder"; 2 | 3 | export type UserOrderByInput = { 4 | createdAt?: SortOrder; 5 | firstName?: SortOrder; 6 | id?: SortOrder; 7 | lastName?: SortOrder; 8 | password?: SortOrder; 9 | roles?: SortOrder; 10 | updatedAt?: SortOrder; 11 | username?: SortOrder; 12 | }; 13 | -------------------------------------------------------------------------------- /Bubble_Sort.py: -------------------------------------------------------------------------------- 1 | def bubbleSort(arr): 2 | n = len(arr) 3 | swapped = False 4 | for i in range(n-1): 5 | for j in range(0, n-i-1): 6 | if arr[j] > arr[j + 1]: 7 | swapped = True 8 | arr[j], arr[j + 1] = arr[j + 1], arr[j] 9 | if not swapped: 10 | return 11 | 12 | 13 | arr = list(map(int,input("Enter the arr : ").split())) 14 | bubbleSort(arr) 15 | print(ar) 16 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/Address.ts: -------------------------------------------------------------------------------- 1 | import { Customer } from "../customer/Customer"; 2 | 3 | export type Address = { 4 | address_1: string | null; 5 | address_2: string | null; 6 | city: string | null; 7 | createdAt: Date; 8 | customers?: Array; 9 | id: string; 10 | state: string | null; 11 | updatedAt: Date; 12 | zip: number | null; 13 | }; 14 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/CustomerOrderByInput.ts: -------------------------------------------------------------------------------- 1 | import { SortOrder } from "../../util/SortOrder"; 2 | 3 | export type CustomerOrderByInput = { 4 | addressId?: SortOrder; 5 | createdAt?: SortOrder; 6 | email?: SortOrder; 7 | firstName?: SortOrder; 8 | id?: SortOrder; 9 | lastName?: SortOrder; 10 | phone?: SortOrder; 11 | updatedAt?: SortOrder; 12 | }; 13 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/OrderOrderByInput.ts: -------------------------------------------------------------------------------- 1 | import { SortOrder } from "../../util/SortOrder"; 2 | 3 | export type OrderOrderByInput = { 4 | createdAt?: SortOrder; 5 | customerId?: SortOrder; 6 | discount?: SortOrder; 7 | id?: SortOrder; 8 | productId?: SortOrder; 9 | quantity?: SortOrder; 10 | totalPrice?: SortOrder; 11 | updatedAt?: SortOrder; 12 | }; 13 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/Components/Pagination.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Pagination as RAPagination, PaginationProps } from "react-admin"; 3 | 4 | const PAGINATION_OPTIONS = [10, 25, 50, 100, 200]; 5 | 6 | const Pagination = (props: PaginationProps) => ( 7 | 8 | ); 9 | 10 | export default Pagination; 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/order.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@nestjs/common"; 2 | import { PrismaService } from "../prisma/prisma.service"; 3 | import { OrderServiceBase } from "./base/order.service.base"; 4 | 5 | @Injectable() 6 | export class OrderService extends OrderServiceBase { 7 | constructor(protected readonly prisma: PrismaService) { 8 | super(prisma); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/health/health.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@nestjs/common"; 2 | import { PrismaService } from "../prisma/prisma.service"; 3 | import { HealthServiceBase } from "./base/health.service.base"; 4 | 5 | @Injectable() 6 | export class HealthService extends HealthServiceBase { 7 | constructor(protected readonly prisma: PrismaService) { 8 | super(prisma); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/StringFilter.ts: -------------------------------------------------------------------------------- 1 | import { QueryMode } from "./QueryMode"; 2 | 3 | export class StringFilter { 4 | equals?: string; 5 | in?: string[]; 6 | notIn?: string[]; 7 | lt?: string; 8 | lte?: string; 9 | gt?: string; 10 | gte?: string; 11 | contains?: string; 12 | startsWith?: string; 13 | endsWith?: string; 14 | mode?: QueryMode; 15 | not?: string; 16 | } 17 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/address.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@nestjs/common"; 2 | import { PrismaService } from "../prisma/prisma.service"; 3 | import { AddressServiceBase } from "./base/address.service.base"; 4 | 5 | @Injectable() 6 | export class AddressService extends AddressServiceBase { 7 | constructor(protected readonly prisma: PrismaService) { 8 | super(prisma); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/product.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@nestjs/common"; 2 | import { PrismaService } from "../prisma/prisma.service"; 3 | import { ProductServiceBase } from "./base/product.service.base"; 4 | 5 | @Injectable() 6 | export class ProductService extends ProductServiceBase { 7 | constructor(protected readonly prisma: PrismaService) { 8 | super(prisma); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Area_of_Triangle.py: -------------------------------------------------------------------------------- 1 | print("Calculate the area of triangle through sides \n") 2 | s1 = float(input("Enter the value of A :")) 3 | s2 = float(input("Enter the value of B :")) 4 | s3 = float(input("Enter the value of C :")) 5 | def Area(a,b,c): 6 | sp = (a + b + c)/2 7 | area = (sp)*(sp-a)*(sp-b)*(sp-c) 8 | f_area = round((area**0.5),2) 9 | print(f"{f_area}"+" square units") 10 | Area(s1,s2,s3) -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/Order.ts: -------------------------------------------------------------------------------- 1 | import { Customer } from "../customer/Customer"; 2 | import { Product } from "../product/Product"; 3 | 4 | export type Order = { 5 | createdAt: Date; 6 | customer?: Customer | null; 7 | discount: number | null; 8 | id: string; 9 | product?: Product | null; 10 | quantity: number | null; 11 | totalPrice: number | null; 12 | updatedAt: Date; 13 | }; 14 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/customer.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@nestjs/common"; 2 | import { PrismaService } from "../prisma/prisma.service"; 3 | import { CustomerServiceBase } from "./base/customer.service.base"; 4 | 5 | @Injectable() 6 | export class CustomerService extends CustomerServiceBase { 7 | constructor(protected readonly prisma: PrismaService) { 8 | super(prisma); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/AddressUpdateInput.ts: -------------------------------------------------------------------------------- 1 | import { CustomerUpdateManyWithoutAddressesInput } from "./CustomerUpdateManyWithoutAddressesInput"; 2 | 3 | export type AddressUpdateInput = { 4 | address_1?: string | null; 5 | address_2?: string | null; 6 | city?: string | null; 7 | customers?: CustomerUpdateManyWithoutAddressesInput; 8 | state?: string | null; 9 | zip?: number | null; 10 | }; 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/pages/Dashboard.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import Card from "@material-ui/core/Card"; 3 | import CardContent from "@material-ui/core/CardContent"; 4 | import { Title } from "react-admin"; 5 | const Dashboard = () => ( 6 | 7 | 8 | <CardContent>Welcome</CardContent> 9 | </Card> 10 | ); 11 | 12 | export default Dashboard; 13 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/Customer.ts: -------------------------------------------------------------------------------- 1 | import { Address } from "../address/Address"; 2 | import { Order } from "../order/Order"; 3 | 4 | export type Customer = { 5 | address?: Address | null; 6 | createdAt: Date; 7 | email: string | null; 8 | firstName: string | null; 9 | id: string; 10 | lastName: string | null; 11 | orders?: Array<Order>; 12 | phone: string | null; 13 | updatedAt: Date; 14 | }; 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/health/health.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller } from "@nestjs/common"; 2 | import { HealthControllerBase } from "./base/health.controller.base"; 3 | import { HealthService } from "./health.service"; 4 | 5 | @Controller("_health") 6 | export class HealthController extends HealthControllerBase { 7 | constructor(protected readonly healthService: HealthService) { 8 | super(healthService); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/util/StringNullableFilter.ts: -------------------------------------------------------------------------------- 1 | import { QueryMode } from "./QueryMode"; 2 | export class StringNullableFilter { 3 | equals?: string | null; 4 | in?: string[] | null; 5 | notIn?: string[] | null; 6 | lt?: string; 7 | lte?: string; 8 | gt?: string; 9 | gte?: string; 10 | contains?: string; 11 | startsWith?: string; 12 | endsWith?: string; 13 | mode?: QueryMode; 14 | not?: string; 15 | } 16 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/LoginArgs.ts: -------------------------------------------------------------------------------- 1 | import { ArgsType, Field } from "@nestjs/graphql"; 2 | import { ValidateNested } from "class-validator"; 3 | import { Type } from "class-transformer"; 4 | import { Credentials } from "./Credentials"; 5 | 6 | @ArgsType() 7 | export class LoginArgs { 8 | @Field(() => Credentials, { nullable: false }) 9 | @Type(() => Credentials) 10 | @ValidateNested() 11 | credentials!: Credentials; 12 | } 13 | -------------------------------------------------------------------------------- /python-hangman-Sanyog_Mishra/.idea/hangman.iml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <module type="PYTHON_MODULE" version="4"> 3 | <component name="NewModuleRootManager"> 4 | <content url="file://$MODULE_DIR$"> 5 | <excludeFolder url="file://$MODULE_DIR$/venv" /> 6 | </content> 7 | <orderEntry type="inheritedJdk" /> 8 | <orderEntry type="sourceFolder" forTests="false" /> 9 | </component> 10 | </module> -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/AddressCreateInput.ts: -------------------------------------------------------------------------------- 1 | import { CustomerCreateNestedManyWithoutAddressesInput } from "./CustomerCreateNestedManyWithoutAddressesInput"; 2 | 3 | export type AddressCreateInput = { 4 | address_1?: string | null; 5 | address_2?: string | null; 6 | city?: string | null; 7 | customers?: CustomerCreateNestedManyWithoutAddressesInput; 8 | state?: string | null; 9 | zip?: number | null; 10 | }; 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/UserInfo.ts: -------------------------------------------------------------------------------- 1 | import { Field, ObjectType } from "@nestjs/graphql"; 2 | import { User } from "../user/base/User"; 3 | 4 | @ObjectType() 5 | export class UserInfo implements Partial<User> { 6 | @Field(() => String) 7 | id!: string; 8 | @Field(() => String) 9 | username!: string; 10 | @Field(() => [String]) 11 | roles!: string[]; 12 | @Field(() => String, { nullable: true }) 13 | accessToken?: string; 14 | } 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/providers/secrets/secretsManager.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@nestjs/common"; 2 | import { ConfigService } from "@nestjs/config"; 3 | import { SecretsManagerServiceBase } from "./base/secretsManager.service.base"; 4 | 5 | @Injectable() 6 | export class SecretsManagerService extends SecretsManagerServiceBase { 7 | constructor(protected readonly configService: ConfigService) { 8 | super(configService); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/OrderCreateInput.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereUniqueInput } from "../customer/CustomerWhereUniqueInput"; 2 | import { ProductWhereUniqueInput } from "../product/ProductWhereUniqueInput"; 3 | 4 | export type OrderCreateInput = { 5 | customer?: CustomerWhereUniqueInput | null; 6 | discount?: number | null; 7 | product?: ProductWhereUniqueInput | null; 8 | quantity?: number | null; 9 | totalPrice?: number | null; 10 | }; 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/OrderUpdateInput.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereUniqueInput } from "../customer/CustomerWhereUniqueInput"; 2 | import { ProductWhereUniqueInput } from "../product/ProductWhereUniqueInput"; 3 | 4 | export type OrderUpdateInput = { 5 | customer?: CustomerWhereUniqueInput | null; 6 | discount?: number | null; 7 | product?: ProductWhereUniqueInput | null; 8 | quantity?: number | null; 9 | totalPrice?: number | null; 10 | }; 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/errors.ts: -------------------------------------------------------------------------------- 1 | import * as common from "@nestjs/common"; 2 | import { ApiProperty } from "@nestjs/swagger"; 3 | 4 | export class ForbiddenException extends common.ForbiddenException { 5 | @ApiProperty() 6 | statusCode!: number; 7 | @ApiProperty() 8 | message!: string; 9 | } 10 | 11 | export class NotFoundException extends common.NotFoundException { 12 | @ApiProperty() 13 | statusCode!: number; 14 | @ApiProperty() 15 | message!: string; 16 | } 17 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/health/base/health.service.base.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@nestjs/common"; 2 | import { PrismaService } from "../../prisma/prisma.service"; 3 | 4 | @Injectable() 5 | export class HealthServiceBase { 6 | constructor(protected readonly prisma: PrismaService) {} 7 | async isDbReady(): Promise<boolean> { 8 | try { 9 | await this.prisma.$queryRaw`SELECT 1`; 10 | return true; 11 | } catch (error) { 12 | return false; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/decorators/public.decorator.ts: -------------------------------------------------------------------------------- 1 | import { applyDecorators, SetMetadata } from "@nestjs/common"; 2 | 3 | export const IS_PUBLIC_KEY = "isPublic"; 4 | 5 | const PublicAuthMiddleware = SetMetadata(IS_PUBLIC_KEY, true); 6 | const PublicAuthSwagger = SetMetadata("swagger/apiSecurity", ["isPublic"]); 7 | 8 | // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types 9 | export const Public = () => 10 | applyDecorators(PublicAuthMiddleware, PublicAuthSwagger); 11 | -------------------------------------------------------------------------------- /apps/mr-b-141107/scripts/customSeed.ts: -------------------------------------------------------------------------------- 1 | import { PrismaClient } from "@prisma/client"; 2 | 3 | export async function customSeed() { 4 | const client = new PrismaClient(); 5 | const username = "admin"; 6 | 7 | //replace this sample code to populate your database 8 | //with data that is required for your service to start 9 | await client.user.update({ 10 | where: { username: username }, 11 | data: { 12 | username, 13 | }, 14 | }); 15 | 16 | client.$disconnect(); 17 | } 18 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/prisma/prisma.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, OnModuleInit, INestApplication } from "@nestjs/common"; 2 | import { PrismaClient } from "@prisma/client"; 3 | 4 | @Injectable() 5 | export class PrismaService extends PrismaClient implements OnModuleInit { 6 | async onModuleInit() { 7 | await this.$connect(); 8 | } 9 | 10 | async enableShutdownHooks(app: INestApplication) { 11 | this.$on("beforeExit", async () => { 12 | await app.close(); 13 | }); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/CustomerUpdateInput.ts: -------------------------------------------------------------------------------- 1 | import { AddressWhereUniqueInput } from "../address/AddressWhereUniqueInput"; 2 | import { OrderUpdateManyWithoutCustomersInput } from "./OrderUpdateManyWithoutCustomersInput"; 3 | 4 | export type CustomerUpdateInput = { 5 | address?: AddressWhereUniqueInput | null; 6 | email?: string | null; 7 | firstName?: string | null; 8 | lastName?: string | null; 9 | orders?: OrderUpdateManyWithoutCustomersInput; 10 | phone?: string | null; 11 | }; 12 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/abac.util.ts: -------------------------------------------------------------------------------- 1 | import { Permission } from "accesscontrol"; 2 | 3 | /** 4 | * @returns attributes not allowed to appear on given data according to given 5 | * attributeMatchers 6 | */ 7 | export function getInvalidAttributes( 8 | permission: Permission, 9 | // eslint-disable-next-line @typescript-eslint/ban-types 10 | data: Object 11 | ): string[] { 12 | const filteredData = permission.filter(data); 13 | return Object.keys(data).filter((key) => !(key in filteredData)); 14 | } 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/gqlAC.guard.ts: -------------------------------------------------------------------------------- 1 | import { ExecutionContext } from "@nestjs/common"; 2 | import { GqlExecutionContext } from "@nestjs/graphql"; 3 | import { ACGuard } from "nest-access-control"; 4 | 5 | export class GqlACGuard<User extends any = any> extends ACGuard<User> { 6 | async getUser(context: ExecutionContext): Promise<User> { 7 | const ctx = GqlExecutionContext.create(context); 8 | const request = ctx.getContext<{ req: { user: User } }>().req; 9 | return request.user; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ScreenshotTaker.py: -------------------------------------------------------------------------------- 1 | import pyautogui 2 | import tkinter as tk 3 | from tkinter.filedialog import * 4 | 5 | root=tk.Tk() 6 | 7 | canvas1=tk.Canvas(root,width=300,height=300) 8 | canvas1.pack() 9 | 10 | def takeScreenshot(): 11 | myScreenshot=pyautogui.screenshot() 12 | save_path=asksaveasfilename() 13 | myScreenshot.save(save_path+"_screenshot.png") 14 | 15 | myButton=tk.Button(text="Take Screenshot", command=takeScreenshot,font=10) 16 | canvas1.create_window(150,150,window=myButton) 17 | 18 | root.mainloop() 19 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/CustomerCreateInput.ts: -------------------------------------------------------------------------------- 1 | import { AddressWhereUniqueInput } from "../address/AddressWhereUniqueInput"; 2 | import { OrderCreateNestedManyWithoutCustomersInput } from "./OrderCreateNestedManyWithoutCustomersInput"; 3 | 4 | export type CustomerCreateInput = { 5 | address?: AddressWhereUniqueInput | null; 6 | email?: string | null; 7 | firstName?: string | null; 8 | lastName?: string | null; 9 | orders?: OrderCreateNestedManyWithoutCustomersInput; 10 | phone?: string | null; 11 | }; 12 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/jwt/jwt.strategy.ts: -------------------------------------------------------------------------------- 1 | import { Inject, Injectable } from "@nestjs/common"; 2 | import { JWT_SECRET_KEY } from "../../constants"; 3 | import { JwtStrategyBase } from "./base/jwt.strategy.base"; 4 | import { UserService } from "../../user/user.service"; 5 | 6 | @Injectable() 7 | export class JwtStrategy extends JwtStrategyBase { 8 | constructor( 9 | @Inject(JWT_SECRET_KEY) secretOrKey: string, 10 | protected readonly userService: UserService 11 | ) { 12 | super(secretOrKey, userService); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /spirograph.py: -------------------------------------------------------------------------------- 1 | import turtle as my_turtle 2 | import random 3 | t=my_turtle.Turtle() 4 | my_turtle.colormode(255) 5 | def random_color(): 6 | r=random.randint(0,255) 7 | g=random.randint(0,255) 8 | b=random.randint(0,255) 9 | random_color=(r,g,b) 10 | return random_color 11 | t.speed("fastest") 12 | def draw_spirograph(size_of_gap): 13 | for _ in range(int(360 / size_of_gap)): 14 | t.color(random_color()) 15 | t.circle(100) 16 | t.setheading(t.heading() + size_of_gap) 17 | 18 | draw_spirograph(5) 19 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@nestjs/common"; 2 | import { PrismaService } from "../prisma/prisma.service"; 3 | import { PasswordService } from "../auth/password.service"; 4 | import { UserServiceBase } from "./base/user.service.base"; 5 | 6 | @Injectable() 7 | export class UserService extends UserServiceBase { 8 | constructor( 9 | protected readonly prisma: PrismaService, 10 | protected readonly passwordService: PasswordService 11 | ) { 12 | super(prisma, passwordService); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/product/ProductWhereInput.ts: -------------------------------------------------------------------------------- 1 | import { StringNullableFilter } from "../../util/StringNullableFilter"; 2 | import { StringFilter } from "../../util/StringFilter"; 3 | import { FloatNullableFilter } from "../../util/FloatNullableFilter"; 4 | import { OrderListRelationFilter } from "../order/OrderListRelationFilter"; 5 | 6 | export type ProductWhereInput = { 7 | description?: StringNullableFilter; 8 | id?: StringFilter; 9 | itemPrice?: FloatNullableFilter; 10 | name?: StringNullableFilter; 11 | orders?: OrderListRelationFilter; 12 | }; 13 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/reportWebVitals.ts: -------------------------------------------------------------------------------- 1 | import { ReportHandler } from "web-vitals"; 2 | 3 | const reportWebVitals = (onPerfEntry?: ReportHandler): void => { 4 | if (onPerfEntry && onPerfEntry instanceof Function) { 5 | void import("web-vitals").then( 6 | ({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 7 | getCLS(onPerfEntry); 8 | getFID(onPerfEntry); 9 | getFCP(onPerfEntry); 10 | getLCP(onPerfEntry); 11 | getTTFB(onPerfEntry); 12 | } 13 | ); 14 | } 15 | }; 16 | 17 | export default reportWebVitals; 18 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/auth.controller.ts: -------------------------------------------------------------------------------- 1 | import { Body, Controller, Post } from "@nestjs/common"; 2 | import { ApiTags } from "@nestjs/swagger"; 3 | import { AuthService } from "./auth.service"; 4 | import { Credentials } from "../auth/Credentials"; 5 | import { UserInfo } from "./UserInfo"; 6 | 7 | @ApiTags("auth") 8 | @Controller() 9 | export class AuthController { 10 | constructor(private readonly authService: AuthService) {} 11 | @Post("login") 12 | async login(@Body() body: Credentials): Promise<UserInfo> { 13 | return this.authService.login(body); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/Credentials.ts: -------------------------------------------------------------------------------- 1 | import { ApiProperty } from "@nestjs/swagger"; 2 | import { InputType, Field } from "@nestjs/graphql"; 3 | import { IsString } from "class-validator"; 4 | 5 | @InputType() 6 | export class Credentials { 7 | @ApiProperty({ 8 | required: true, 9 | type: String, 10 | }) 11 | @IsString() 12 | @Field(() => String, { nullable: false }) 13 | username!: string; 14 | @ApiProperty({ 15 | required: true, 16 | type: String, 17 | }) 18 | @IsString() 19 | @Field(() => String, { nullable: false }) 20 | password!: string; 21 | } 22 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/user.module.ts: -------------------------------------------------------------------------------- 1 | import { Module, forwardRef } from "@nestjs/common"; 2 | import { AuthModule } from "../auth/auth.module"; 3 | import { UserModuleBase } from "./base/user.module.base"; 4 | import { UserService } from "./user.service"; 5 | import { UserController } from "./user.controller"; 6 | import { UserResolver } from "./user.resolver"; 7 | 8 | @Module({ 9 | imports: [UserModuleBase, forwardRef(() => AuthModule)], 10 | controllers: [UserController], 11 | providers: [UserService, UserResolver], 12 | exports: [UserService], 13 | }) 14 | export class UserModule {} 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/order.module.ts: -------------------------------------------------------------------------------- 1 | import { Module, forwardRef } from "@nestjs/common"; 2 | import { AuthModule } from "../auth/auth.module"; 3 | import { OrderModuleBase } from "./base/order.module.base"; 4 | import { OrderService } from "./order.service"; 5 | import { OrderController } from "./order.controller"; 6 | import { OrderResolver } from "./order.resolver"; 7 | 8 | @Module({ 9 | imports: [OrderModuleBase, forwardRef(() => AuthModule)], 10 | controllers: [OrderController], 11 | providers: [OrderService, OrderResolver], 12 | exports: [OrderService], 13 | }) 14 | export class OrderModule {} 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "MrB141107", 3 | "name": "MrB141107", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/jwt/jwtSecretFactory.ts: -------------------------------------------------------------------------------- 1 | import { JWT_SECRET_KEY } from "../../constants"; 2 | import { SecretsManagerService } from "../../providers/secrets/secretsManager.service"; 3 | 4 | export const jwtSecretFactory = { 5 | provide: JWT_SECRET_KEY, 6 | useFactory: async ( 7 | secretsService: SecretsManagerService 8 | ): Promise<string> => { 9 | const secret = await secretsService.getSecret<string>(JWT_SECRET_KEY); 10 | if (secret) { 11 | return secret; 12 | } 13 | throw new Error("jwtSecretFactory missing secret"); 14 | }, 15 | inject: [SecretsManagerService], 16 | }; 17 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/gqlDefaultAuth.guard.ts: -------------------------------------------------------------------------------- 1 | import { ExecutionContext } from "@nestjs/common"; 2 | import { GqlExecutionContext } from "@nestjs/graphql"; 3 | import type { Request } from "express"; 4 | // @ts-ignore 5 | // eslint-disable-next-line 6 | import { DefaultAuthGuard } from "./defaultAuth.guard"; 7 | 8 | export class GqlDefaultAuthGuard extends DefaultAuthGuard { 9 | // This method is required for the interface - do not delete it. 10 | getRequest(context: ExecutionContext): Request { 11 | const ctx = GqlExecutionContext.create(context); 12 | return ctx.getContext<{ req: Request }>().req; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Selection_Sort.py: -------------------------------------------------------------------------------- 1 | def selectionSort(array, size): 2 | 3 | for step in range(size): 4 | min_idx = step 5 | 6 | for i in range(step + 1, size): 7 | 8 | # to sort in descending order, change > to < in this line 9 | # select the minimum element in each loop 10 | if array[i] < array[min_idx]: 11 | min_idx = i 12 | 13 | # put min at the correct position 14 | (array[step], array[min_idx]) = (array[min_idx], array[step]) 15 | 16 | arr = list(map(int,input("Enter the arr : ").split())) 17 | selectionSort(arr,len(arr)) 18 | print(arr) 19 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/tests/auth/constants.ts: -------------------------------------------------------------------------------- 1 | import { Credentials } from "../../auth/Credentials"; 2 | import { UserInfo } from "../../auth/UserInfo"; 3 | 4 | export const VALID_ID = "1"; 5 | 6 | export const TEST_USER: UserInfo = { 7 | id: "cl7qmjh4h0000tothyjqapgj5", 8 | roles: ["User"], 9 | username: "ofek", 10 | }; 11 | export const SIGN_TOKEN = "SIGN_TOKEN"; 12 | export const VALID_CREDENTIALS: Credentials = { 13 | username: "Valid User", 14 | password: "Valid User Password", 15 | }; 16 | export const INVALID_CREDENTIALS: Credentials = { 17 | username: "Invalid User", 18 | password: "Invalid User Password", 19 | }; 20 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/address.module.ts: -------------------------------------------------------------------------------- 1 | import { Module, forwardRef } from "@nestjs/common"; 2 | import { AuthModule } from "../auth/auth.module"; 3 | import { AddressModuleBase } from "./base/address.module.base"; 4 | import { AddressService } from "./address.service"; 5 | import { AddressController } from "./address.controller"; 6 | import { AddressResolver } from "./address.resolver"; 7 | 8 | @Module({ 9 | imports: [AddressModuleBase, forwardRef(() => AuthModule)], 10 | controllers: [AddressController], 11 | providers: [AddressService, AddressResolver], 12 | exports: [AddressService], 13 | }) 14 | export class AddressModule {} 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/product.module.ts: -------------------------------------------------------------------------------- 1 | import { Module, forwardRef } from "@nestjs/common"; 2 | import { AuthModule } from "../auth/auth.module"; 3 | import { ProductModuleBase } from "./base/product.module.base"; 4 | import { ProductService } from "./product.service"; 5 | import { ProductController } from "./product.controller"; 6 | import { ProductResolver } from "./product.resolver"; 7 | 8 | @Module({ 9 | imports: [ProductModuleBase, forwardRef(() => AuthModule)], 10 | controllers: [ProductController], 11 | providers: [ProductService, ProductResolver], 12 | exports: [ProductService], 13 | }) 14 | export class ProductModule {} 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/address/AddressWhereInput.ts: -------------------------------------------------------------------------------- 1 | import { StringNullableFilter } from "../../util/StringNullableFilter"; 2 | import { CustomerListRelationFilter } from "../customer/CustomerListRelationFilter"; 3 | import { StringFilter } from "../../util/StringFilter"; 4 | import { IntNullableFilter } from "../../util/IntNullableFilter"; 5 | 6 | export type AddressWhereInput = { 7 | address_1?: StringNullableFilter; 8 | address_2?: StringNullableFilter; 9 | city?: StringNullableFilter; 10 | customers?: CustomerListRelationFilter; 11 | id?: StringFilter; 12 | state?: StringNullableFilter; 13 | zip?: IntNullableFilter; 14 | }; 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "esModuleInterop": true, 8 | "allowSyntheticDefaultImports": true, 9 | "forceConsistentCasingInFileNames": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "noEmit": true, 16 | "jsx": "react-jsx", 17 | "strict": true 18 | }, 19 | "include": ["src"], 20 | "exclude": ["./node_modules"] 21 | } 22 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/providers/secrets/base/secretsManager.service.base.ts: -------------------------------------------------------------------------------- 1 | import { ConfigService } from "@nestjs/config"; 2 | 3 | export interface ISecretsManager { 4 | getSecret: (key: string) => Promise<any | null>; 5 | } 6 | 7 | export class SecretsManagerServiceBase implements ISecretsManager { 8 | constructor(protected readonly configService: ConfigService) {} 9 | async getSecret<T>(key: string): Promise<T | null> { 10 | if (!key) { 11 | throw new Error("Didn't got the key"); 12 | } 13 | const value = this.configService.get(key); 14 | if (value) { 15 | return value; 16 | } 17 | return null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/customer/CustomerWhereInput.ts: -------------------------------------------------------------------------------- 1 | import { AddressWhereUniqueInput } from "../address/AddressWhereUniqueInput"; 2 | import { StringNullableFilter } from "../../util/StringNullableFilter"; 3 | import { StringFilter } from "../../util/StringFilter"; 4 | import { OrderListRelationFilter } from "../order/OrderListRelationFilter"; 5 | 6 | export type CustomerWhereInput = { 7 | address?: AddressWhereUniqueInput; 8 | email?: StringNullableFilter; 9 | firstName?: StringNullableFilter; 10 | id?: StringFilter; 11 | lastName?: StringNullableFilter; 12 | orders?: OrderListRelationFilter; 13 | phone?: StringNullableFilter; 14 | }; 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/customer.module.ts: -------------------------------------------------------------------------------- 1 | import { Module, forwardRef } from "@nestjs/common"; 2 | import { AuthModule } from "../auth/auth.module"; 3 | import { CustomerModuleBase } from "./base/customer.module.base"; 4 | import { CustomerService } from "./customer.service"; 5 | import { CustomerController } from "./customer.controller"; 6 | import { CustomerResolver } from "./customer.resolver"; 7 | 8 | @Module({ 9 | imports: [CustomerModuleBase, forwardRef(() => AuthModule)], 10 | controllers: [CustomerController], 11 | providers: [CustomerService, CustomerResolver], 12 | exports: [CustomerService], 13 | }) 14 | export class CustomerModule {} 15 | -------------------------------------------------------------------------------- /DFS_Undirected_graph.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | def dfs(graphs,start,path,visited): 3 | visited[start]=True 4 | path.append(start) 5 | for neighbour in graphs[start]: 6 | if visited[neighbour]==False: 7 | dfs(graphs,neighbour,path,visited) 8 | return path 9 | graphs=defaultdict(list) 10 | v,e=map(int,input().split()) 11 | for i in range(e): 12 | u,v=map(str,input().split()) 13 | graphs[u].append(v) 14 | graphs[v].append(u) 15 | for v in graphs: 16 | print(v,graphs[v]) 17 | path=[] 18 | visited=defaultdict(bool) 19 | start='A' 20 | dfs_path=dfs(graphs,start,path,visited) 21 | print(dfs_path) 22 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | #root { 11 | height: 100vh; 12 | } 13 | 14 | code { 15 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 16 | monospace; 17 | } 18 | 19 | .amp-breadcrumbs { 20 | padding: var(--default-spacing); 21 | } 22 | 23 | .entity-id { 24 | color: var(--primary); 25 | text-decoration: underline; 26 | } 27 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import "./index.css"; 4 | // @ts-ignore 5 | // eslint-disable-next-line import/no-unresolved 6 | import App from "./App"; 7 | import reportWebVitals from "./reportWebVitals"; 8 | 9 | ReactDOM.render( 10 | <React.StrictMode> 11 | <App /> 12 | </React.StrictMode>, 13 | document.getElementById("root") 14 | ); 15 | 16 | // If you want to start measuring performance in your app, pass a function 17 | // to log results (for example: reportWebVitals(console.log)) 18 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 19 | reportWebVitals(); 20 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/api/order/OrderWhereInput.ts: -------------------------------------------------------------------------------- 1 | import { CustomerWhereUniqueInput } from "../customer/CustomerWhereUniqueInput"; 2 | import { FloatNullableFilter } from "../../util/FloatNullableFilter"; 3 | import { StringFilter } from "../../util/StringFilter"; 4 | import { ProductWhereUniqueInput } from "../product/ProductWhereUniqueInput"; 5 | import { IntNullableFilter } from "../../util/IntNullableFilter"; 6 | 7 | export type OrderWhereInput = { 8 | customer?: CustomerWhereUniqueInput; 9 | discount?: FloatNullableFilter; 10 | id?: StringFilter; 11 | product?: ProductWhereUniqueInput; 12 | quantity?: IntNullableFilter; 13 | totalPrice?: IntNullableFilter; 14 | }; 15 | -------------------------------------------------------------------------------- /apps/mr-b-141107/docker-compose.dev.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | db: 4 | image: mysql 5 | command: --default-authentication-plugin=mysql_native_password 6 | restart: always 7 | ports: 8 | - ${DB_PORT}:3306 9 | environment: 10 | MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} 11 | healthcheck: 12 | test: 13 | - CMD 14 | - mysqladmin 15 | - ping 16 | - -h 17 | - localhost 18 | - -u 19 | - ${DB_USER} 20 | timeout: 45s 21 | interval: 10s 22 | retries: 10 23 | adminer: 24 | image: adminer 25 | restart: always 26 | ports: 27 | - 1234:8080 28 | volumes: 29 | mysql: ~ 30 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/user.controller.ts: -------------------------------------------------------------------------------- 1 | import * as common from "@nestjs/common"; 2 | import * as swagger from "@nestjs/swagger"; 3 | import * as nestAccessControl from "nest-access-control"; 4 | import { UserService } from "./user.service"; 5 | import { UserControllerBase } from "./base/user.controller.base"; 6 | 7 | @swagger.ApiTags("users") 8 | @common.Controller("users") 9 | export class UserController extends UserControllerBase { 10 | constructor( 11 | protected readonly service: UserService, 12 | @nestAccessControl.InjectRolesBuilder() 13 | protected readonly rolesBuilder: nestAccessControl.RolesBuilder 14 | ) { 15 | super(service, rolesBuilder); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apps/mr-b-141107/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "module": "commonjs", 5 | "declaration": false, 6 | "removeComments": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "target": "es2017", 10 | "lib": ["ES2020"], 11 | "sourceMap": true, 12 | "outDir": "./dist", 13 | "incremental": true, 14 | "esModuleInterop": true, 15 | "allowSyntheticDefaultImports": true, 16 | "resolveJsonModule": true, 17 | "skipLibCheck": true, 18 | "strict": true, 19 | "paths": { 20 | "@app/custom-validators": ["src/validators"] 21 | } 22 | }, 23 | "include": ["src"] 24 | } 25 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/order.controller.ts: -------------------------------------------------------------------------------- 1 | import * as common from "@nestjs/common"; 2 | import * as swagger from "@nestjs/swagger"; 3 | import * as nestAccessControl from "nest-access-control"; 4 | import { OrderService } from "./order.service"; 5 | import { OrderControllerBase } from "./base/order.controller.base"; 6 | 7 | @swagger.ApiTags("orders") 8 | @common.Controller("orders") 9 | export class OrderController extends OrderControllerBase { 10 | constructor( 11 | protected readonly service: OrderService, 12 | @nestAccessControl.InjectRolesBuilder() 13 | protected readonly rolesBuilder: nestAccessControl.RolesBuilder 14 | ) { 15 | super(service, rolesBuilder); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /hs_battlegrounds/run.py: -------------------------------------------------------------------------------- 1 | from base_game import Game 2 | from base_board import Board 3 | from base_card import Card 4 | from hs_cards import get_cards 5 | 6 | if __name__ == '__main__': 7 | cards = get_cards() # dict of classes 8 | 9 | board_top = [cards['Annoy-o-Tron'](), 10 | cards['Dozy Whelp'](), 11 | cards['Micro Mummy']()] 12 | 13 | board_btm = [cards['Annoy-o-Tron'](), 14 | cards['Dozy Whelp'](), 15 | cards['Micro Mummy']()] 16 | 17 | board = Board(top=board_top, bottom=board_btm) 18 | game = Game(board=board) 19 | game.run() 20 | 21 | ''' 22 | # Simple run 23 | game = Game() 24 | game.run() 25 | ''' 26 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/address.controller.ts: -------------------------------------------------------------------------------- 1 | import * as common from "@nestjs/common"; 2 | import * as swagger from "@nestjs/swagger"; 3 | import * as nestAccessControl from "nest-access-control"; 4 | import { AddressService } from "./address.service"; 5 | import { AddressControllerBase } from "./base/address.controller.base"; 6 | 7 | @swagger.ApiTags("addresses") 8 | @common.Controller("addresses") 9 | export class AddressController extends AddressControllerBase { 10 | constructor( 11 | protected readonly service: AddressService, 12 | @nestAccessControl.InjectRolesBuilder() 13 | protected readonly rolesBuilder: nestAccessControl.RolesBuilder 14 | ) { 15 | super(service, rolesBuilder); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/product.controller.ts: -------------------------------------------------------------------------------- 1 | import * as common from "@nestjs/common"; 2 | import * as swagger from "@nestjs/swagger"; 3 | import * as nestAccessControl from "nest-access-control"; 4 | import { ProductService } from "./product.service"; 5 | import { ProductControllerBase } from "./base/product.controller.base"; 6 | 7 | @swagger.ApiTags("products") 8 | @common.Controller("products") 9 | export class ProductController extends ProductControllerBase { 10 | constructor( 11 | protected readonly service: ProductService, 12 | @nestAccessControl.InjectRolesBuilder() 13 | protected readonly rolesBuilder: nestAccessControl.RolesBuilder 14 | ) { 15 | super(service, rolesBuilder); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/customer.controller.ts: -------------------------------------------------------------------------------- 1 | import * as common from "@nestjs/common"; 2 | import * as swagger from "@nestjs/swagger"; 3 | import * as nestAccessControl from "nest-access-control"; 4 | import { CustomerService } from "./customer.service"; 5 | import { CustomerControllerBase } from "./base/customer.controller.base"; 6 | 7 | @swagger.ApiTags("customers") 8 | @common.Controller("customers") 9 | export class CustomerController extends CustomerControllerBase { 10 | constructor( 11 | protected readonly service: CustomerService, 12 | @nestAccessControl.InjectRolesBuilder() 13 | protected readonly rolesBuilder: nestAccessControl.RolesBuilder 14 | ) { 15 | super(service, rolesBuilder); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/base/order.module.base.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { Module } from "@nestjs/common"; 13 | import { MorganModule } from "nest-morgan"; 14 | import { ACLModule } from "../../auth/acl.module"; 15 | @Module({ 16 | imports: [ACLModule, MorganModule], 17 | exports: [ACLModule, MorganModule], 18 | }) 19 | export class OrderModuleBase {} 20 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/base/user.module.base.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { Module } from "@nestjs/common"; 13 | import { MorganModule } from "nest-morgan"; 14 | import { ACLModule } from "../../auth/acl.module"; 15 | @Module({ 16 | imports: [ACLModule, MorganModule], 17 | exports: [ACLModule, MorganModule], 18 | }) 19 | export class UserModuleBase {} 20 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/base/address.module.base.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { Module } from "@nestjs/common"; 13 | import { MorganModule } from "nest-morgan"; 14 | import { ACLModule } from "../../auth/acl.module"; 15 | @Module({ 16 | imports: [ACLModule, MorganModule], 17 | exports: [ACLModule, MorganModule], 18 | }) 19 | export class AddressModuleBase {} 20 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/base/customer.module.base.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { Module } from "@nestjs/common"; 13 | import { MorganModule } from "nest-morgan"; 14 | import { ACLModule } from "../../auth/acl.module"; 15 | @Module({ 16 | imports: [ACLModule, MorganModule], 17 | exports: [ACLModule, MorganModule], 18 | }) 19 | export class CustomerModuleBase {} 20 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/base/product.module.base.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { Module } from "@nestjs/common"; 13 | import { MorganModule } from "nest-morgan"; 14 | import { ACLModule } from "../../auth/acl.module"; 15 | @Module({ 16 | imports: [ACLModule, MorganModule], 17 | exports: [ACLModule, MorganModule], 18 | }) 19 | export class ProductModuleBase {} 20 | -------------------------------------------------------------------------------- /Youtube_Video_Downloader.py: -------------------------------------------------------------------------------- 1 | # Import Pytube 2 | import pytube # pip install pytube 3 | 4 | # Import YouTube from PyTube 5 | from pytube import YouTube 6 | 7 | # Getting URL from the User 8 | video_url = input("Enter The Url of Video You Want To Download") 9 | 10 | # Getting Video Using PyTube 11 | youtube = pytube.YouTube(video_url) 12 | video = youtube.streams.first() 13 | 14 | # Downloading Video to Downloading Folder( Remember to Change the Path Here :) 15 | video.download('C:\Users\YourUser\Downloads') 16 | 17 | # Print the Info About Dowloading Status 18 | print("Downloding....") 19 | print("Downloding...") 20 | print("Downloding....") 21 | print("Downloding...") 22 | print("Downloding..") 23 | print("Downloding.") 24 | print("Done Video Downloaded Successfully") -------------------------------------------------------------------------------- /apps/mr-b-141107/src/prisma.util.spec.ts: -------------------------------------------------------------------------------- 1 | import { 2 | isRecordNotFoundError, 3 | PRISMA_QUERY_INTERPRETATION_ERROR, 4 | } from "./prisma.util"; 5 | 6 | describe("isRecordNotFoundError", () => { 7 | test("returns true for record not found error", () => { 8 | expect( 9 | isRecordNotFoundError( 10 | Object.assign( 11 | new Error(`Error occurred during query execution: 12 | InterpretationError("Error for binding '0': RecordNotFound("Record to update not found.")")`), 13 | { 14 | code: PRISMA_QUERY_INTERPRETATION_ERROR, 15 | } 16 | ) 17 | ) 18 | ).toBe(true); 19 | }); 20 | test("returns false for any other error", () => { 21 | expect(isRecordNotFoundError(new Error())).toBe(false); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/util/BooleanFilter.ts: -------------------------------------------------------------------------------- 1 | import { Field, InputType } from "@nestjs/graphql"; 2 | import { ApiProperty } from "@nestjs/swagger"; 3 | import { IsOptional } from "class-validator"; 4 | import { Type } from "class-transformer"; 5 | 6 | @InputType({ 7 | isAbstract: true, 8 | description: undefined, 9 | }) 10 | export class BooleanFilter { 11 | @ApiProperty({ 12 | required: false, 13 | type: Boolean, 14 | }) 15 | @IsOptional() 16 | @Field(() => Boolean, { 17 | nullable: true, 18 | }) 19 | @Type(() => Boolean) 20 | equals?: boolean; 21 | 22 | @ApiProperty({ 23 | required: false, 24 | type: Boolean, 25 | }) 26 | @IsOptional() 27 | @Field(() => Boolean, { 28 | nullable: true, 29 | }) 30 | @Type(() => Boolean) 31 | not?: boolean; 32 | } 33 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/health/base/health.controller.base.ts: -------------------------------------------------------------------------------- 1 | import { Get, HttpStatus, Res } from "@nestjs/common"; 2 | import { Response } from "express"; 3 | import { HealthService } from "../health.service"; 4 | 5 | export class HealthControllerBase { 6 | constructor(protected readonly healthService: HealthService) {} 7 | @Get("live") 8 | healthLive(@Res() response: Response): Response<void> { 9 | return response.status(HttpStatus.NO_CONTENT).send(); 10 | } 11 | @Get("ready") 12 | async healthReady(@Res() response: Response): Promise<Response<void>> { 13 | const dbConnection = await this.healthService.isDbReady(); 14 | if (!dbConnection) { 15 | return response.status(HttpStatus.NOT_FOUND).send(); 16 | } 17 | return response.status(HttpStatus.NO_CONTENT).send(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/util/BooleanNullableFilter.ts: -------------------------------------------------------------------------------- 1 | import { Field, InputType } from "@nestjs/graphql"; 2 | import { ApiProperty } from "@nestjs/swagger"; 3 | import { IsOptional } from "class-validator"; 4 | import { Type } from "class-transformer"; 5 | @InputType({ 6 | isAbstract: true, 7 | description: undefined, 8 | }) 9 | export class BooleanNullableFilter { 10 | @ApiProperty({ 11 | required: false, 12 | type: Boolean, 13 | }) 14 | @IsOptional() 15 | @Field(() => Boolean, { 16 | nullable: true, 17 | }) 18 | @Type(() => Boolean) 19 | equals?: boolean | null; 20 | 21 | @ApiProperty({ 22 | required: false, 23 | type: Boolean, 24 | }) 25 | @IsOptional() 26 | @Field(() => Boolean, { 27 | nullable: true, 28 | }) 29 | @Type(() => Boolean) 30 | not?: boolean | null; 31 | } 32 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/user/UserShow.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { 3 | Show, 4 | SimpleShowLayout, 5 | ShowProps, 6 | DateField, 7 | TextField, 8 | } from "react-admin"; 9 | 10 | export const UserShow = (props: ShowProps): React.ReactElement => { 11 | return ( 12 | <Show {...props}> 13 | <SimpleShowLayout> 14 | <DateField source="createdAt" label="Created At" /> 15 | <TextField label="First Name" source="firstName" /> 16 | <TextField label="ID" source="id" /> 17 | <TextField label="Last Name" source="lastName" /> 18 | <TextField label="Roles" source="roles" /> 19 | <DateField source="updatedAt" label="Updated At" /> 20 | <TextField label="Username" source="username" /> 21 | </SimpleShowLayout> 22 | </Show> 23 | ); 24 | }; 25 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/gqlUserRoles.decorator.ts: -------------------------------------------------------------------------------- 1 | import { createParamDecorator, ExecutionContext } from "@nestjs/common"; 2 | import { GqlExecutionContext } from "@nestjs/graphql"; 3 | 4 | /** 5 | * Access the user roles from the request object i.e `req.user.roles`. 6 | * 7 | * You can pass an optional property key to the decorator to get it from the user object 8 | * e.g `@UserRoles('permissions')` will return the `req.user.permissions` instead. 9 | */ 10 | export const UserRoles = createParamDecorator( 11 | (data: string, context: ExecutionContext) => { 12 | const ctx = GqlExecutionContext.create(context); 13 | const request = ctx.getContext<{ req: { user: any } }>().req; 14 | if (!request.user) { 15 | return null; 16 | } 17 | return data ? request.user[data] : request.user.roles; 18 | } 19 | ); 20 | -------------------------------------------------------------------------------- /rock_paper,,scissor.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | def game(): 4 | choices = ["rock", "paper", "scissors"] 5 | computer_choice = random.choice(choices) 6 | user_choice = input("Enter rock, paper, or scissors: ").lower() 7 | 8 | if user_choice not in choices: 9 | print("Invalid choice. Please choose rock, paper, or scissors.") 10 | elif user_choice == computer_choice: 11 | print(f"Computer chose {computer_choice}. It's a draw!") 12 | elif (user_choice == "rock" and computer_choice == "scissors") or \ 13 | (user_choice == "paper" and computer_choice == "rock") or \ 14 | (user_choice == "scissors" and computer_choice == "paper"): 15 | print(f"Computer chose {computer_choice}. You win!") 16 | else: 17 | print(f"Computer chose {computer_choice}. You lose!") 18 | 19 | game() 20 | -------------------------------------------------------------------------------- /Password_Generator.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | if __name__ == "__main__": 4 | s1 = ['a','b','c','d','e','f','g','h','i','j','k','l','m','o','p','q','r','s','t','u','v','w','x','y','z'] 5 | s2 = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] 6 | s3 = ['1','2','3','4','5','6','7','8','9','0'] 7 | s4 = ['!','@','#','$','%','^','&','*','(',')','_','+','{','}','|','[',']','"',';','<','>','?','/',','] 8 | 9 | passLen = int(input("Enter Your password lenght: ")) 10 | s = [] 11 | s.extend(s1) 12 | s.extend(s2) 13 | s.extend(s3) 14 | s.extend(s4) 15 | a =0 16 | print("Choose any one of the 5 passwords given below!") 17 | print("") 18 | while a<5: 19 | random.shuffle(s) 20 | print("\t","".join(s[0:passLen])) 21 | a=a+1 22 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/defaultAuth.guard.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from "rxjs"; 2 | import { ExecutionContext, Injectable } from "@nestjs/common"; 3 | import { Reflector } from "@nestjs/core"; 4 | import { IS_PUBLIC_KEY } from "../decorators/public.decorator"; 5 | import { JwtAuthGuard } from "./jwt/jwtAuth.guard"; 6 | 7 | @Injectable() 8 | export class DefaultAuthGuard extends JwtAuthGuard { 9 | constructor(private readonly reflector: Reflector) { 10 | super(); 11 | } 12 | 13 | canActivate( 14 | context: ExecutionContext 15 | ): boolean | Promise<boolean> | Observable<any> { 16 | const isPublic = this.reflector.get<boolean>( 17 | IS_PUBLIC_KEY, 18 | context.getHandler() 19 | ); 20 | 21 | if (isPublic) { 22 | return true; 23 | } 24 | 25 | return super.canActivate(context); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/util/JsonFilter.ts: -------------------------------------------------------------------------------- 1 | import { Field, InputType } from "@nestjs/graphql"; 2 | import { ApiProperty } from "@nestjs/swagger"; 3 | import { IsOptional } from "class-validator"; 4 | import { GraphQLJSONObject } from "graphql-type-json"; 5 | import { InputJsonValue } from "../types"; 6 | 7 | @InputType({ 8 | isAbstract: true, 9 | description: undefined, 10 | }) 11 | export class JsonFilter { 12 | @ApiProperty({ 13 | required: false, 14 | type: GraphQLJSONObject, 15 | }) 16 | @IsOptional() 17 | @Field(() => GraphQLJSONObject, { 18 | nullable: true, 19 | }) 20 | equals?: InputJsonValue; 21 | 22 | @ApiProperty({ 23 | required: false, 24 | type: GraphQLJSONObject, 25 | }) 26 | @IsOptional() 27 | @Field(() => GraphQLJSONObject, { 28 | nullable: true, 29 | }) 30 | not?: InputJsonValue; 31 | } 32 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/util/JsonNullableFilter.ts: -------------------------------------------------------------------------------- 1 | import type { JsonValue } from "type-fest"; 2 | import { Field, InputType } from "@nestjs/graphql"; 3 | import { ApiProperty } from "@nestjs/swagger"; 4 | import { IsOptional } from "class-validator"; 5 | import { GraphQLJSONObject } from "graphql-type-json"; 6 | 7 | @InputType({ 8 | isAbstract: true, 9 | description: undefined, 10 | }) 11 | export class JsonNullableFilter { 12 | @ApiProperty({ 13 | required: false, 14 | type: GraphQLJSONObject, 15 | }) 16 | @IsOptional() 17 | @Field(() => GraphQLJSONObject, { 18 | nullable: true, 19 | }) 20 | equals?: JsonValue; 21 | 22 | @ApiProperty({ 23 | required: false, 24 | type: GraphQLJSONObject, 25 | }) 26 | @IsOptional() 27 | @Field(() => GraphQLJSONObject, { 28 | nullable: true, 29 | }) 30 | not?: JsonValue; 31 | } 32 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/theme/theme.ts: -------------------------------------------------------------------------------- 1 | import { defaultTheme } from "react-admin"; 2 | import { createTheme, ThemeOptions } from "@material-ui/core/styles"; 3 | import { merge } from "lodash"; 4 | import createPalette from "@material-ui/core/styles/createPalette"; 5 | 6 | const palette = createPalette( 7 | merge({}, defaultTheme.palette, { 8 | primary: { 9 | main: "#20a4f3", 10 | }, 11 | secondary: { 12 | main: "#7950ed", 13 | }, 14 | error: { 15 | main: "#e93c51", 16 | }, 17 | warning: { 18 | main: "#f6aa50", 19 | }, 20 | info: { 21 | main: "#144bc1", 22 | }, 23 | success: { 24 | main: "#31c587", 25 | }, 26 | }) 27 | ); 28 | 29 | const themeOptions: ThemeOptions = { 30 | palette, 31 | }; 32 | 33 | export const theme = createTheme(merge({}, defaultTheme, themeOptions)); 34 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/user.resolver.ts: -------------------------------------------------------------------------------- 1 | import * as graphql from "@nestjs/graphql"; 2 | import * as nestAccessControl from "nest-access-control"; 3 | import * as gqlACGuard from "../auth/gqlAC.guard"; 4 | import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; 5 | import * as common from "@nestjs/common"; 6 | import { UserResolverBase } from "./base/user.resolver.base"; 7 | import { User } from "./base/User"; 8 | import { UserService } from "./user.service"; 9 | 10 | @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) 11 | @graphql.Resolver(() => User) 12 | export class UserResolver extends UserResolverBase { 13 | constructor( 14 | protected readonly service: UserService, 15 | @nestAccessControl.InjectRolesBuilder() 16 | protected readonly rolesBuilder: nestAccessControl.RolesBuilder 17 | ) { 18 | super(service, rolesBuilder); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /joke_bot.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import ttkbootstrap as tb 3 | from ttkbootstrap.constants import * 4 | 5 | def get_joke(label_text): 6 | url = "https://icanhazdadjoke.com" 7 | headers = {'Accept': 'application/json'} 8 | joke_time = requests.get(url, headers=headers).json().get('joke') 9 | label_text.set(joke_time) 10 | print(joke_time) 11 | 12 | def start(master) -> None: 13 | label_text = tb.StringVar() 14 | label = tb.Label(master, textvariable=label_text, font=("Poppins", 16), bootstyle='default') 15 | label.pack(padx=5, pady=10) 16 | btn = tb.Button(master, text="Get Joke!", command=lambda: get_joke(label_text)) 17 | btn.pack(padx=5, pady=10) 18 | 19 | if __name__ == '__main__': 20 | app = tb.Window(themename='darkly') 21 | app.title('Joke App') 22 | app.geometry('1280x900') 23 | start(app) 24 | app.mainloop() 25 | 26 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/order.resolver.ts: -------------------------------------------------------------------------------- 1 | import * as graphql from "@nestjs/graphql"; 2 | import * as nestAccessControl from "nest-access-control"; 3 | import * as gqlACGuard from "../auth/gqlAC.guard"; 4 | import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; 5 | import * as common from "@nestjs/common"; 6 | import { OrderResolverBase } from "./base/order.resolver.base"; 7 | import { Order } from "./base/Order"; 8 | import { OrderService } from "./order.service"; 9 | 10 | @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) 11 | @graphql.Resolver(() => Order) 12 | export class OrderResolver extends OrderResolverBase { 13 | constructor( 14 | protected readonly service: OrderService, 15 | @nestAccessControl.InjectRolesBuilder() 16 | protected readonly rolesBuilder: nestAccessControl.RolesBuilder 17 | ) { 18 | super(service, rolesBuilder); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/user/UserEdit.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { 3 | Edit, 4 | SimpleForm, 5 | EditProps, 6 | TextInput, 7 | PasswordInput, 8 | SelectArrayInput, 9 | } from "react-admin"; 10 | import { ROLES_OPTIONS } from "../user/RolesOptions"; 11 | 12 | export const UserEdit = (props: EditProps): React.ReactElement => { 13 | return ( 14 | <Edit {...props}> 15 | <SimpleForm> 16 | <TextInput label="First Name" source="firstName" /> 17 | <TextInput label="Last Name" source="lastName" /> 18 | <PasswordInput label="Password" source="password" /> 19 | <SelectArrayInput 20 | source="roles" 21 | choices={ROLES_OPTIONS} 22 | optionText="label" 23 | optionValue="value" 24 | /> 25 | <TextInput label="Username" source="username" /> 26 | </SimpleForm> 27 | </Edit> 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/swagger.ts: -------------------------------------------------------------------------------- 1 | import { DocumentBuilder, SwaggerCustomOptions } from "@nestjs/swagger"; 2 | 3 | export const swaggerPath = "api"; 4 | 5 | export const swaggerDocumentOptions = new DocumentBuilder() 6 | .setTitle("MrB141107") 7 | .setDescription( 8 | 'Sample service for e-commerce\n\n## Congratulations! Your service resource is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your service resource comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)' 9 | ) 10 | .addBearerAuth() 11 | .build(); 12 | 13 | export const swaggerSetupOptions: SwaggerCustomOptions = { 14 | swaggerOptions: { 15 | persistAuthorization: true, 16 | }, 17 | customCssUrl: "../swagger/swagger.css", 18 | customfavIcon: "../swagger/favicon.png", 19 | customSiteTitle: "MrB141107", 20 | }; 21 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/base/UserWhereUniqueInput.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { InputType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { IsString } from "class-validator"; 15 | 16 | @InputType() 17 | class UserWhereUniqueInput { 18 | @ApiProperty({ 19 | required: true, 20 | type: String, 21 | }) 22 | @IsString() 23 | @Field(() => String) 24 | id!: string; 25 | } 26 | 27 | export { UserWhereUniqueInput as UserWhereUniqueInput }; 28 | -------------------------------------------------------------------------------- /Longest_common_prefix.py: -------------------------------------------------------------------------------- 1 | #https://leetcode.com/problems/longest-common-prefix/ 2 | class Solution(object): 3 | def are_equal(self, strs, index): 4 | for i in range(1, len(strs)): 5 | if index >= len(strs[i]) or strs[i][index] != strs[0][index]: 6 | return False 7 | return True 8 | 9 | def longestCommonPrefix(self, strs): 10 | """ 11 | :type strs: List[str] 12 | :rtype: str 13 | """ 14 | if not strs: 15 | return "" 16 | 17 | min_length = len(strs[0]) 18 | for i in range(1, len(strs)): 19 | min_length = min(min_length, len(strs[i])) 20 | 21 | longest_prefix = "" 22 | for i in range(min_length): 23 | if self.are_equal(strs, i): 24 | longest_prefix += strs[0][i] 25 | else: 26 | break 27 | 28 | return longest_prefix 29 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/address.resolver.ts: -------------------------------------------------------------------------------- 1 | import * as graphql from "@nestjs/graphql"; 2 | import * as nestAccessControl from "nest-access-control"; 3 | import * as gqlACGuard from "../auth/gqlAC.guard"; 4 | import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; 5 | import * as common from "@nestjs/common"; 6 | import { AddressResolverBase } from "./base/address.resolver.base"; 7 | import { Address } from "./base/Address"; 8 | import { AddressService } from "./address.service"; 9 | 10 | @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) 11 | @graphql.Resolver(() => Address) 12 | export class AddressResolver extends AddressResolverBase { 13 | constructor( 14 | protected readonly service: AddressService, 15 | @nestAccessControl.InjectRolesBuilder() 16 | protected readonly rolesBuilder: nestAccessControl.RolesBuilder 17 | ) { 18 | super(service, rolesBuilder); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/base/OrderWhereUniqueInput.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { InputType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { IsString } from "class-validator"; 15 | 16 | @InputType() 17 | class OrderWhereUniqueInput { 18 | @ApiProperty({ 19 | required: true, 20 | type: String, 21 | }) 22 | @IsString() 23 | @Field(() => String) 24 | id!: string; 25 | } 26 | 27 | export { OrderWhereUniqueInput as OrderWhereUniqueInput }; 28 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/product.resolver.ts: -------------------------------------------------------------------------------- 1 | import * as graphql from "@nestjs/graphql"; 2 | import * as nestAccessControl from "nest-access-control"; 3 | import * as gqlACGuard from "../auth/gqlAC.guard"; 4 | import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; 5 | import * as common from "@nestjs/common"; 6 | import { ProductResolverBase } from "./base/product.resolver.base"; 7 | import { Product } from "./base/Product"; 8 | import { ProductService } from "./product.service"; 9 | 10 | @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) 11 | @graphql.Resolver(() => Product) 12 | export class ProductResolver extends ProductResolverBase { 13 | constructor( 14 | protected readonly service: ProductService, 15 | @nestAccessControl.InjectRolesBuilder() 16 | protected readonly rolesBuilder: nestAccessControl.RolesBuilder 17 | ) { 18 | super(service, rolesBuilder); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/base/AddressWhereUniqueInput.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { InputType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { IsString } from "class-validator"; 15 | 16 | @InputType() 17 | class AddressWhereUniqueInput { 18 | @ApiProperty({ 19 | required: true, 20 | type: String, 21 | }) 22 | @IsString() 23 | @Field(() => String) 24 | id!: string; 25 | } 26 | 27 | export { AddressWhereUniqueInput as AddressWhereUniqueInput }; 28 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/customer.resolver.ts: -------------------------------------------------------------------------------- 1 | import * as graphql from "@nestjs/graphql"; 2 | import * as nestAccessControl from "nest-access-control"; 3 | import * as gqlACGuard from "../auth/gqlAC.guard"; 4 | import { GqlDefaultAuthGuard } from "../auth/gqlDefaultAuth.guard"; 5 | import * as common from "@nestjs/common"; 6 | import { CustomerResolverBase } from "./base/customer.resolver.base"; 7 | import { Customer } from "./base/Customer"; 8 | import { CustomerService } from "./customer.service"; 9 | 10 | @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) 11 | @graphql.Resolver(() => Customer) 12 | export class CustomerResolver extends CustomerResolverBase { 13 | constructor( 14 | protected readonly service: CustomerService, 15 | @nestAccessControl.InjectRolesBuilder() 16 | protected readonly rolesBuilder: nestAccessControl.RolesBuilder 17 | ) { 18 | super(service, rolesBuilder); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/base/ProductWhereUniqueInput.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { InputType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { IsString } from "class-validator"; 15 | 16 | @InputType() 17 | class ProductWhereUniqueInput { 18 | @ApiProperty({ 19 | required: true, 20 | type: String, 21 | }) 22 | @IsString() 23 | @Field(() => String) 24 | id!: string; 25 | } 26 | 27 | export { ProductWhereUniqueInput as ProductWhereUniqueInput }; 28 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/product/ProductList.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { List, Datagrid, ListProps, DateField, TextField } from "react-admin"; 3 | import Pagination from "../Components/Pagination"; 4 | 5 | export const ProductList = (props: ListProps): React.ReactElement => { 6 | return ( 7 | <List 8 | {...props} 9 | bulkActionButtons={false} 10 | title={"Products"} 11 | perPage={50} 12 | pagination={<Pagination />} 13 | > 14 | <Datagrid rowClick="show"> 15 | <DateField source="createdAt" label="Created At" /> 16 | <TextField label="Description" source="description" /> 17 | <TextField label="ID" source="id" /> 18 | <TextField label="Item Price" source="itemPrice" /> 19 | <TextField label="Name" source="name" /> 20 | <DateField source="updatedAt" label="Updated At" /> 21 | </Datagrid> 22 | </List> 23 | ); 24 | }; 25 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/base/CustomerWhereUniqueInput.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { InputType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { IsString } from "class-validator"; 15 | 16 | @InputType() 17 | class CustomerWhereUniqueInput { 18 | @ApiProperty({ 19 | required: true, 20 | type: String, 21 | }) 22 | @IsString() 23 | @Field(() => String) 24 | id!: string; 25 | } 26 | 27 | export { CustomerWhereUniqueInput as CustomerWhereUniqueInput }; 28 | -------------------------------------------------------------------------------- /snake_game/constants.py: -------------------------------------------------------------------------------- 1 | GAME_ICON_FILENAME = 'snake_game/images/game_logo.jpg' 2 | GAME_TITLE = "Snake Voyage" 3 | APPLE_WIDTH = 20 4 | APPLE_HEIGHT = 20 5 | SNAKE_HEIGHT = 20 6 | SNAKE_WIDTH =20 7 | DEFAULT_SNAKE_SPEED = 0.2 8 | GAME_WINDOW_WIDTH = 600 9 | GAME_WINDOW_HEIGHT = 400 10 | FIXED_SNAKE_LENGTH = 6 11 | SURFACE_EXTREME_X_COORDINATE = 565 12 | SURFACE_START_X_COORDINATE = 0 13 | SURFACE_EXTREME_Y_COORDINATE = 470 14 | SURFACE_START_Y_COORDINATE = 35 15 | DEFAULT_SNAKE_X_COORDINATE= 100 16 | DEFAULT_SNAKE_Y_COORDINATE = 100 17 | SCORE_AREA_COLOR = (78, 84, 150) 18 | SCORE_TEXT_COLOR = (190, 195, 250) 19 | SCORE_TEXT_COORDINATES = (0, 0) 20 | DIRECTIONS = { 21 | "D" :'down', 22 | "U" : 'up', 23 | "L" : 'left', 24 | "R" :'right' 25 | } 26 | DEFAULT_APPLE_X_COORDINATE = 100 27 | DEFAULT_APPLE_Y_COORDINATE = 100 28 | SNAKE_COLOR = (115, 219, 132) 29 | APPLE_COLOR = (220, 53, 69) 30 | SCREEN_BACKGROUND_COLOR = (61, 62, 98) -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/user/UserCreate.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { 4 | Create, 5 | SimpleForm, 6 | CreateProps, 7 | TextInput, 8 | PasswordInput, 9 | SelectArrayInput, 10 | } from "react-admin"; 11 | 12 | import { ROLES_OPTIONS } from "../user/RolesOptions"; 13 | 14 | export const UserCreate = (props: CreateProps): React.ReactElement => { 15 | return ( 16 | <Create {...props}> 17 | <SimpleForm> 18 | <TextInput label="First Name" source="firstName" /> 19 | <TextInput label="Last Name" source="lastName" /> 20 | <PasswordInput label="Password" source="password" /> 21 | <SelectArrayInput 22 | source="roles" 23 | choices={ROLES_OPTIONS} 24 | optionText="label" 25 | optionValue="value" 26 | /> 27 | <TextInput label="Username" source="username" /> 28 | </SimpleForm> 29 | </Create> 30 | ); 31 | }; 32 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/auth.resolver.ts: -------------------------------------------------------------------------------- 1 | import * as common from "@nestjs/common"; 2 | import { Args, Mutation, Query, Resolver } from "@nestjs/graphql"; 3 | import * as gqlACGuard from "../auth/gqlAC.guard"; 4 | import { AuthService } from "./auth.service"; 5 | import { GqlDefaultAuthGuard } from "./gqlDefaultAuth.guard"; 6 | import { UserData } from "./userData.decorator"; 7 | import { LoginArgs } from "./LoginArgs"; 8 | import { UserInfo } from "./UserInfo"; 9 | 10 | @Resolver(UserInfo) 11 | export class AuthResolver { 12 | constructor(private readonly authService: AuthService) {} 13 | @Mutation(() => UserInfo) 14 | async login(@Args() args: LoginArgs): Promise<UserInfo> { 15 | return this.authService.login(args.credentials); 16 | } 17 | 18 | @Query(() => UserInfo) 19 | @common.UseGuards(GqlDefaultAuthGuard, gqlACGuard.GqlACGuard) 20 | async userInfo(@UserData() entityInfo: UserInfo): Promise<UserInfo> { 21 | return entityInfo; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/user/UserList.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { List, Datagrid, ListProps, DateField, TextField } from "react-admin"; 3 | import Pagination from "../Components/Pagination"; 4 | 5 | export const UserList = (props: ListProps): React.ReactElement => { 6 | return ( 7 | <List 8 | {...props} 9 | bulkActionButtons={false} 10 | title={"Users"} 11 | perPage={50} 12 | pagination={<Pagination />} 13 | > 14 | <Datagrid rowClick="show"> 15 | <DateField source="createdAt" label="Created At" /> 16 | <TextField label="First Name" source="firstName" /> 17 | <TextField label="ID" source="id" /> 18 | <TextField label="Last Name" source="lastName" /> 19 | <TextField label="Roles" source="roles" /> 20 | <DateField source="updatedAt" label="Updated At" /> 21 | <TextField label="Username" source="username" /> 22 | </Datagrid> 23 | </List> 24 | ); 25 | }; 26 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/data-provider/graphqlDataProvider.ts: -------------------------------------------------------------------------------- 1 | import buildGraphQLProvider from "ra-data-graphql-amplication"; 2 | import { ApolloClient, InMemoryCache, createHttpLink } from "@apollo/client"; 3 | import { setContext } from "@apollo/client/link/context"; 4 | import { CREDENTIALS_LOCAL_STORAGE_ITEM } from "../constants"; 5 | 6 | const httpLink = createHttpLink({ 7 | uri: `${process.env.REACT_APP_SERVER_URL}/graphql`, 8 | }); 9 | 10 | // eslint-disable-next-line @typescript-eslint/naming-convention 11 | const authLink = setContext((_, { headers }) => { 12 | const token = localStorage.getItem(CREDENTIALS_LOCAL_STORAGE_ITEM); 13 | return { 14 | headers: { 15 | ...headers, 16 | authorization: token ? token : "", 17 | }, 18 | }; 19 | }); 20 | 21 | export const apolloClient = new ApolloClient({ 22 | cache: new InMemoryCache(), 23 | link: authLink.concat(httpLink), 24 | }); 25 | 26 | export default buildGraphQLProvider({ 27 | client: apolloClient, 28 | }); 29 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/base/UserCountArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { UserWhereInput } from "./UserWhereInput"; 15 | import { Type } from "class-transformer"; 16 | 17 | @ArgsType() 18 | class UserCountArgs { 19 | @ApiProperty({ 20 | required: false, 21 | type: () => UserWhereInput, 22 | }) 23 | @Field(() => UserWhereInput, { nullable: true }) 24 | @Type(() => UserWhereInput) 25 | where?: UserWhereInput; 26 | } 27 | 28 | export { UserCountArgs as UserCountArgs }; 29 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/validators/is-json-value-validator.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ValidationArguments, 3 | registerDecorator, 4 | ValidationOptions, 5 | } from "class-validator"; 6 | import isJSONValidator from "validator/lib/isJSON"; 7 | 8 | export function IsJSONValue(validationOptions?: ValidationOptions) { 9 | return function (object: Record<string, any>, propertyName: string) { 10 | registerDecorator({ 11 | name: "IsJSONValue", 12 | target: object.constructor, 13 | propertyName: propertyName, 14 | options: validationOptions, 15 | validator: { 16 | validate(value: any, args: ValidationArguments) { 17 | if (typeof value === "string") { 18 | return isJSONValidator(value); 19 | } 20 | 21 | return isJSONValidator(JSON.stringify(value)); 22 | }, 23 | defaultMessage(args: ValidationArguments): string { 24 | return `${args.property} must be a valid json`; 25 | }, 26 | }, 27 | }); 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/base/OrderCountArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { OrderWhereInput } from "./OrderWhereInput"; 15 | import { Type } from "class-transformer"; 16 | 17 | @ArgsType() 18 | class OrderCountArgs { 19 | @ApiProperty({ 20 | required: false, 21 | type: () => OrderWhereInput, 22 | }) 23 | @Field(() => OrderWhereInput, { nullable: true }) 24 | @Type(() => OrderWhereInput) 25 | where?: OrderWhereInput; 26 | } 27 | 28 | export { OrderCountArgs as OrderCountArgs }; 29 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/address/AddressList.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { List, Datagrid, ListProps, TextField, DateField } from "react-admin"; 3 | import Pagination from "../Components/Pagination"; 4 | 5 | export const AddressList = (props: ListProps): React.ReactElement => { 6 | return ( 7 | <List 8 | {...props} 9 | bulkActionButtons={false} 10 | title={"Addresses"} 11 | perPage={50} 12 | pagination={<Pagination />} 13 | > 14 | <Datagrid rowClick="show"> 15 | <TextField label="Address 1" source="address_1" /> 16 | <TextField label="Address 2" source="address_2" /> 17 | <TextField label="City" source="city" /> 18 | <DateField source="createdAt" label="Created At" /> 19 | <TextField label="ID" source="id" /> 20 | <TextField label="State" source="state" /> 21 | <DateField source="updatedAt" label="Updated At" /> 22 | <TextField label="Zip" source="zip" /> 23 | </Datagrid> 24 | </List> 25 | ); 26 | }; 27 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/base/AddressCountArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { AddressWhereInput } from "./AddressWhereInput"; 15 | import { Type } from "class-transformer"; 16 | 17 | @ArgsType() 18 | class AddressCountArgs { 19 | @ApiProperty({ 20 | required: false, 21 | type: () => AddressWhereInput, 22 | }) 23 | @Field(() => AddressWhereInput, { nullable: true }) 24 | @Type(() => AddressWhereInput) 25 | where?: AddressWhereInput; 26 | } 27 | 28 | export { AddressCountArgs as AddressCountArgs }; 29 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/base/ProductCountArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { ProductWhereInput } from "./ProductWhereInput"; 15 | import { Type } from "class-transformer"; 16 | 17 | @ArgsType() 18 | class ProductCountArgs { 19 | @ApiProperty({ 20 | required: false, 21 | type: () => ProductWhereInput, 22 | }) 23 | @Field(() => ProductWhereInput, { nullable: true }) 24 | @Type(() => ProductWhereInput) 25 | where?: ProductWhereInput; 26 | } 27 | 28 | export { ProductCountArgs as ProductCountArgs }; 29 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/auth.ts: -------------------------------------------------------------------------------- 1 | import { EventEmitter } from "events"; 2 | import { CREDENTIALS_LOCAL_STORAGE_ITEM } from "./constants"; 3 | import { Credentials } from "./types"; 4 | 5 | const eventEmitter = new EventEmitter(); 6 | 7 | export function isAuthenticated(): boolean { 8 | return Boolean(getCredentials()); 9 | } 10 | 11 | export function listen(listener: (authenticated: boolean) => void): void { 12 | eventEmitter.on("change", () => { 13 | listener(isAuthenticated()); 14 | }); 15 | } 16 | 17 | export function setCredentials(credentials: Credentials) { 18 | localStorage.setItem( 19 | CREDENTIALS_LOCAL_STORAGE_ITEM, 20 | JSON.stringify(credentials) 21 | ); 22 | } 23 | 24 | export function getCredentials(): Credentials | null { 25 | const raw = localStorage.getItem(CREDENTIALS_LOCAL_STORAGE_ITEM); 26 | if (raw === null) { 27 | return null; 28 | } 29 | return JSON.parse(raw); 30 | } 31 | 32 | export function removeCredentials(): void { 33 | localStorage.removeItem(CREDENTIALS_LOCAL_STORAGE_ITEM); 34 | } 35 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/base/CustomerCountArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { CustomerWhereInput } from "./CustomerWhereInput"; 15 | import { Type } from "class-transformer"; 16 | 17 | @ArgsType() 18 | class CustomerCountArgs { 19 | @ApiProperty({ 20 | required: false, 21 | type: () => CustomerWhereInput, 22 | }) 23 | @Field(() => CustomerWhereInput, { nullable: true }) 24 | @Type(() => CustomerWhereInput) 25 | where?: CustomerWhereInput; 26 | } 27 | 28 | export { CustomerCountArgs as CustomerCountArgs }; 29 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/base/token.service.base.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-unresolved */ 2 | import { Injectable } from "@nestjs/common"; 3 | import { JwtService } from "@nestjs/jwt"; 4 | import { INVALID_PASSWORD_ERROR, INVALID_USERNAME_ERROR } from "../constants"; 5 | import { ITokenService, ITokenPayload } from "../ITokenService"; 6 | /** 7 | * TokenServiceBase is a jwt bearer implementation of ITokenService 8 | */ 9 | @Injectable() 10 | export class TokenServiceBase implements ITokenService { 11 | constructor(protected readonly jwtService: JwtService) {} 12 | /** 13 | * 14 | * @object { id: String, username: String, password: String} 15 | * @returns a jwt token sign with the username and user id 16 | */ 17 | createToken({ id, username, password }: ITokenPayload): Promise<string> { 18 | if (!username) return Promise.reject(INVALID_USERNAME_ERROR); 19 | if (!password) return Promise.reject(INVALID_PASSWORD_ERROR); 20 | return this.jwtService.signAsync({ 21 | sub: id, 22 | username, 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/prisma.util.ts: -------------------------------------------------------------------------------- 1 | export const PRISMA_QUERY_INTERPRETATION_ERROR = "P2016"; 2 | export const PRISMA_RECORD_NOT_FOUND = "RecordNotFound"; 3 | 4 | export function isRecordNotFoundError( 5 | error: Error & { code?: string } 6 | ): boolean { 7 | return ( 8 | "code" in error && 9 | error.code === PRISMA_QUERY_INTERPRETATION_ERROR && 10 | error.message.includes(PRISMA_RECORD_NOT_FOUND) 11 | ); 12 | } 13 | 14 | export async function transformStringFieldUpdateInput< 15 | T extends undefined | string | { set?: string } 16 | >(input: T, transform: (input: string) => Promise<string>): Promise<T> { 17 | if (typeof input === "object" && typeof input?.set === "string") { 18 | return { set: await transform(input.set) } as T; 19 | } 20 | if (typeof input === "object") { 21 | if (typeof input.set === "string") { 22 | return { set: await transform(input.set) } as T; 23 | } 24 | return input; 25 | } 26 | if (typeof input === "string") { 27 | return (await transform(input)) as T; 28 | } 29 | return input; 30 | } 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/product/ProductEdit.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { 4 | Edit, 5 | SimpleForm, 6 | EditProps, 7 | TextInput, 8 | NumberInput, 9 | ReferenceArrayInput, 10 | SelectArrayInput, 11 | } from "react-admin"; 12 | 13 | import { OrderTitle } from "../order/OrderTitle"; 14 | 15 | export const ProductEdit = (props: EditProps): React.ReactElement => { 16 | return ( 17 | <Edit {...props}> 18 | <SimpleForm> 19 | <TextInput label="Description" multiline source="description" /> 20 | <NumberInput label="Item Price" source="itemPrice" /> 21 | <TextInput label="Name" source="name" /> 22 | <ReferenceArrayInput 23 | source="orders" 24 | reference="Order" 25 | parse={(value: any) => value && value.map((v: any) => ({ id: v }))} 26 | format={(value: any) => value && value.map((v: any) => v.id)} 27 | > 28 | <SelectArrayInput optionText={OrderTitle} /> 29 | </ReferenceArrayInput> 30 | </SimpleForm> 31 | </Edit> 32 | ); 33 | }; 34 | -------------------------------------------------------------------------------- /binary_search.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | 4 | def binary_search(array: list[int], target: int) -> Optional[int]: 5 | '''Simple implementation of binary search algorithm. It takes a sorted list 6 | and a target and returns the index of the target in the list. If the list 7 | doesn't contain the target that the algorithm returns None ''' 8 | 9 | left = 0 10 | right = len(array) - 1 11 | 12 | while left <= right: 13 | mid = (left + right) // 2 14 | 15 | if array[mid] < target: 16 | left = mid + 1 17 | elif array[mid] > target: 18 | right = mid - 1 19 | else: 20 | return mid 21 | 22 | return None 23 | 24 | 25 | if __name__ == '__main__': 26 | '''testing that the algorithm works properly''' 27 | 28 | arr = [1, 4, 6, 8, 10, 15, 19, 25, 45, 48] 29 | num = 19 30 | 31 | result = binary_search(arr, num) 32 | 33 | if result is not None: 34 | print(f"The index of {num} is {result}") 35 | else: 36 | print(f"The list does not contain number {num}") 37 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/product/ProductCreate.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { 4 | Create, 5 | SimpleForm, 6 | CreateProps, 7 | TextInput, 8 | NumberInput, 9 | ReferenceArrayInput, 10 | SelectArrayInput, 11 | } from "react-admin"; 12 | 13 | import { OrderTitle } from "../order/OrderTitle"; 14 | 15 | export const ProductCreate = (props: CreateProps): React.ReactElement => { 16 | return ( 17 | <Create {...props}> 18 | <SimpleForm> 19 | <TextInput label="Description" multiline source="description" /> 20 | <NumberInput label="Item Price" source="itemPrice" /> 21 | <TextInput label="Name" source="name" /> 22 | <ReferenceArrayInput 23 | source="orders" 24 | reference="Order" 25 | parse={(value: any) => value && value.map((v: any) => ({ id: v }))} 26 | format={(value: any) => value && value.map((v: any) => v.id)} 27 | > 28 | <SelectArrayInput optionText={OrderTitle} /> 29 | </ReferenceArrayInput> 30 | </SimpleForm> 31 | </Create> 32 | ); 33 | }; 34 | -------------------------------------------------------------------------------- /fb_logo.py: -------------------------------------------------------------------------------- 1 | from turtle import * 2 | 3 | speed(10) 4 | color("#0270d6") 5 | Screen().bgcolor('black') 6 | 7 | # setup the coordinates 8 | penup() 9 | goto(0, 150) 10 | pendown() 11 | 12 | # Draw the rectangle 13 | begin_fill() 14 | forward(150) 15 | circle(-50, 90) 16 | forward(300) 17 | circle(-50, 90) 18 | forward(300) 19 | circle(-50, 90) 20 | forward(300) 21 | circle(-50, 90) 22 | forward(150) 23 | end_fill() 24 | 25 | # drawing the letter F 26 | color("white") 27 | penup() 28 | goto(140, 80) 29 | pendown() 30 | 31 | begin_fill() 32 | right(180) 33 | forward(50) 34 | circle(80, 90) 35 | forward(50) 36 | right(90) 37 | forward(80) 38 | left(90) 39 | forward(40) 40 | left(90) 41 | forward(80) 42 | right(90) 43 | forward(160) 44 | left(90) 45 | forward(55) 46 | left(90) 47 | forward(160) 48 | right(90) 49 | forward(70) 50 | left(80) 51 | forward(45) 52 | left(100) 53 | forward(80) 54 | right(90) 55 | forward(40) 56 | circle(-40, 90) 57 | forward(40) 58 | left(90) 59 | forward(45) 60 | end_fill() 61 | 62 | hideturtle() 63 | done() 64 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/base/CreateUserArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { UserCreateInput } from "./UserCreateInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class CreateUserArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => UserCreateInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => UserCreateInput) 26 | @Field(() => UserCreateInput, { nullable: false }) 27 | data!: UserCreateInput; 28 | } 29 | 30 | export { CreateUserArgs as CreateUserArgs }; 31 | -------------------------------------------------------------------------------- /Sudoku-GUI-Solver/README.md: -------------------------------------------------------------------------------- 1 | # Sudoku Solver GUI using Pygame 2 | 3 | This repository contains a Sudoku Solver implemented with a graphical user interface (GUI) using Pygame. With this solver, you can interactively input a Sudoku puzzle and watch as the program finds a solution. 4 | 5 | ## Features 6 | 7 | - Graphical User Interface (GUI) for interactive input. 8 | - Real-time solving visualization. 9 | - Error handling for invalid inputs. 10 | 11 | ## Installation 12 | 13 | 1. Ensure you have Python and Pygame installed on your system. 14 | 2. Clone this repository to your local machine. 15 | 3. Run `sudoku_solver_gui.py` to start the application. 16 | 17 | ## Contributing 18 | 19 | If you'd like to contribute to this project, please create a new branch, make your changes, and submit a pull request. 20 | 21 | 22 | ## Acknowledgments 23 | 24 | - The Sudoku solving algorithm is based on [Backtracking](https://en.wikipedia.org/wiki/Sudoku_solving_algorithms#Backtracking). 25 | - Pygame for providing the graphical interface. 26 | 27 | Feel free to customize this README to suit your specific repository. -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/base/CreateOrderArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { OrderCreateInput } from "./OrderCreateInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class CreateOrderArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => OrderCreateInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => OrderCreateInput) 26 | @Field(() => OrderCreateInput, { nullable: false }) 27 | data!: OrderCreateInput; 28 | } 29 | 30 | export { CreateOrderArgs as CreateOrderArgs }; 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/base/OrderCreateNestedManyWithoutProductsInput.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { InputType, Field } from "@nestjs/graphql"; 13 | import { OrderWhereUniqueInput } from "../../order/base/OrderWhereUniqueInput"; 14 | import { ApiProperty } from "@nestjs/swagger"; 15 | 16 | @InputType() 17 | class OrderCreateNestedManyWithoutProductsInput { 18 | @Field(() => [OrderWhereUniqueInput], { 19 | nullable: true, 20 | }) 21 | @ApiProperty({ 22 | required: false, 23 | type: () => [OrderWhereUniqueInput], 24 | }) 25 | connect?: Array<OrderWhereUniqueInput>; 26 | } 27 | 28 | export { OrderCreateNestedManyWithoutProductsInput as OrderCreateNestedManyWithoutProductsInput }; 29 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/base/CreateAddressArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { AddressCreateInput } from "./AddressCreateInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class CreateAddressArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => AddressCreateInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => AddressCreateInput) 26 | @Field(() => AddressCreateInput, { nullable: false }) 27 | data!: AddressCreateInput; 28 | } 29 | 30 | export { CreateAddressArgs as CreateAddressArgs }; 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/base/OrderCreateNestedManyWithoutCustomersInput.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { InputType, Field } from "@nestjs/graphql"; 13 | import { OrderWhereUniqueInput } from "../../order/base/OrderWhereUniqueInput"; 14 | import { ApiProperty } from "@nestjs/swagger"; 15 | 16 | @InputType() 17 | class OrderCreateNestedManyWithoutCustomersInput { 18 | @Field(() => [OrderWhereUniqueInput], { 19 | nullable: true, 20 | }) 21 | @ApiProperty({ 22 | required: false, 23 | type: () => [OrderWhereUniqueInput], 24 | }) 25 | connect?: Array<OrderWhereUniqueInput>; 26 | } 27 | 28 | export { OrderCreateNestedManyWithoutCustomersInput as OrderCreateNestedManyWithoutCustomersInput }; 29 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/base/CreateProductArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { ProductCreateInput } from "./ProductCreateInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class CreateProductArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => ProductCreateInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => ProductCreateInput) 26 | @Field(() => ProductCreateInput, { nullable: false }) 27 | data!: ProductCreateInput; 28 | } 29 | 30 | export { CreateProductArgs as CreateProductArgs }; 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/base/DeleteUserArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { UserWhereUniqueInput } from "./UserWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class DeleteUserArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => UserWhereUniqueInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => UserWhereUniqueInput) 26 | @Field(() => UserWhereUniqueInput, { nullable: false }) 27 | where!: UserWhereUniqueInput; 28 | } 29 | 30 | export { DeleteUserArgs as DeleteUserArgs }; 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/tests/auth/jwt/jwt.strategy.spec.ts: -------------------------------------------------------------------------------- 1 | import { UnauthorizedException } from "@nestjs/common"; 2 | import { mock } from "jest-mock-extended"; 3 | import { JwtStrategyBase } from "../../../auth/jwt/base/jwt.strategy.base"; 4 | import { TEST_USER } from "../constants"; 5 | import { UserService } from "../../../user/user.service"; 6 | describe("Testing the jwtStrategyBase.validate()", () => { 7 | const userService = mock<UserService>(); 8 | const jwtStrategy = new JwtStrategyBase(userService, "Secrete"); 9 | beforeEach(() => { 10 | userService.findOne.mockClear(); 11 | }); 12 | it("should throw UnauthorizedException where there is no user", async () => { 13 | //ARRANGE 14 | userService.findOne 15 | .calledWith({ where: { username: TEST_USER.username } }) 16 | .mockReturnValue(Promise.resolve(null)); 17 | //ACT 18 | const result = jwtStrategy.validate({ 19 | id: TEST_USER.id, 20 | username: TEST_USER.username, 21 | roles: TEST_USER.roles, 22 | }); 23 | //ASSERT 24 | return expect(result).rejects.toThrowError(UnauthorizedException); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/base/CreateCustomerArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { CustomerCreateInput } from "./CustomerCreateInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class CreateCustomerArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => CustomerCreateInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => CustomerCreateInput) 26 | @Field(() => CustomerCreateInput, { nullable: false }) 27 | data!: CustomerCreateInput; 28 | } 29 | 30 | export { CreateCustomerArgs as CreateCustomerArgs }; 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/base/DeleteOrderArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { OrderWhereUniqueInput } from "./OrderWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class DeleteOrderArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => OrderWhereUniqueInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => OrderWhereUniqueInput) 26 | @Field(() => OrderWhereUniqueInput, { nullable: false }) 27 | where!: OrderWhereUniqueInput; 28 | } 29 | 30 | export { DeleteOrderArgs as DeleteOrderArgs }; 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Mr.B 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/base/UserFindUniqueArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { UserWhereUniqueInput } from "./UserWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class UserFindUniqueArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => UserWhereUniqueInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => UserWhereUniqueInput) 26 | @Field(() => UserWhereUniqueInput, { nullable: false }) 27 | where!: UserWhereUniqueInput; 28 | } 29 | 30 | export { UserFindUniqueArgs as UserFindUniqueArgs }; 31 | -------------------------------------------------------------------------------- /Improved_Password_Generator.py: -------------------------------------------------------------------------------- 1 | import random 2 | import string 3 | 4 | def generate_password(length=12, include_uppercase=True, include_digits=True, include_special_chars=True) -> None: 5 | 6 | # Define character sets based on user preferences 7 | lowercase_chars = string.ascii_lowercase 8 | uppercase_chars = string.ascii_uppercase if include_uppercase else '' 9 | digit_chars = string.digits if include_digits else '' 10 | special_chars = "!@#$%^&*()_+[]{}|;':,.<>?/" if include_special_chars else '' 11 | 12 | # Combine the character sets based on user preferences 13 | all_chars = lowercase_chars + uppercase_chars + digit_chars + special_chars 14 | 15 | # Check if at least one character set is selected 16 | if not all_chars: 17 | return "Please include at least one character set in the password." 18 | 19 | # Generate the password 20 | password = ''.join(random.choice(all_chars) for _ in range(length)) 21 | 22 | return password 23 | 24 | # Example usage: 25 | password = generate_password(length=16, include_uppercase=True, include_digits=True, include_special_chars=True) 26 | print(password) 27 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/base/OrderFindUniqueArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { OrderWhereUniqueInput } from "./OrderWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class OrderFindUniqueArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => OrderWhereUniqueInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => OrderWhereUniqueInput) 26 | @Field(() => OrderWhereUniqueInput, { nullable: false }) 27 | where!: OrderWhereUniqueInput; 28 | } 29 | 30 | export { OrderFindUniqueArgs as OrderFindUniqueArgs }; 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/base/CustomerCreateNestedManyWithoutAddressesInput.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { InputType, Field } from "@nestjs/graphql"; 13 | import { CustomerWhereUniqueInput } from "../../customer/base/CustomerWhereUniqueInput"; 14 | import { ApiProperty } from "@nestjs/swagger"; 15 | 16 | @InputType() 17 | class CustomerCreateNestedManyWithoutAddressesInput { 18 | @Field(() => [CustomerWhereUniqueInput], { 19 | nullable: true, 20 | }) 21 | @ApiProperty({ 22 | required: false, 23 | type: () => [CustomerWhereUniqueInput], 24 | }) 25 | connect?: Array<CustomerWhereUniqueInput>; 26 | } 27 | 28 | export { CustomerCreateNestedManyWithoutAddressesInput as CustomerCreateNestedManyWithoutAddressesInput }; 29 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/base/DeleteAddressArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { AddressWhereUniqueInput } from "./AddressWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class DeleteAddressArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => AddressWhereUniqueInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => AddressWhereUniqueInput) 26 | @Field(() => AddressWhereUniqueInput, { nullable: false }) 27 | where!: AddressWhereUniqueInput; 28 | } 29 | 30 | export { DeleteAddressArgs as DeleteAddressArgs }; 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/base/DeleteProductArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { ProductWhereUniqueInput } from "./ProductWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class DeleteProductArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => ProductWhereUniqueInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => ProductWhereUniqueInput) 26 | @Field(() => ProductWhereUniqueInput, { nullable: false }) 27 | where!: ProductWhereUniqueInput; 28 | } 29 | 30 | export { DeleteProductArgs as DeleteProductArgs }; 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/order/OrderEdit.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { 3 | Edit, 4 | SimpleForm, 5 | EditProps, 6 | ReferenceInput, 7 | SelectInput, 8 | NumberInput, 9 | } from "react-admin"; 10 | import { CustomerTitle } from "../customer/CustomerTitle"; 11 | import { ProductTitle } from "../product/ProductTitle"; 12 | 13 | export const OrderEdit = (props: EditProps): React.ReactElement => { 14 | return ( 15 | <Edit {...props}> 16 | <SimpleForm> 17 | <ReferenceInput 18 | source="customer.id" 19 | reference="Customer" 20 | label="Customer" 21 | > 22 | <SelectInput optionText={CustomerTitle} /> 23 | </ReferenceInput> 24 | <NumberInput label="Discount" source="discount" /> 25 | <ReferenceInput source="product.id" reference="Product" label="Product"> 26 | <SelectInput optionText={ProductTitle} /> 27 | </ReferenceInput> 28 | <NumberInput step={1} label="Quantity" source="quantity" /> 29 | <NumberInput step={1} label="Total Price" source="totalPrice" /> 30 | </SimpleForm> 31 | </Edit> 32 | ); 33 | }; 34 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/base/DeleteCustomerArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { CustomerWhereUniqueInput } from "./CustomerWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class DeleteCustomerArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => CustomerWhereUniqueInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => CustomerWhereUniqueInput) 26 | @Field(() => CustomerWhereUniqueInput, { nullable: false }) 27 | where!: CustomerWhereUniqueInput; 28 | } 29 | 30 | export { DeleteCustomerArgs as DeleteCustomerArgs }; 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/order/OrderCreate.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { 3 | Create, 4 | SimpleForm, 5 | CreateProps, 6 | ReferenceInput, 7 | SelectInput, 8 | NumberInput, 9 | } from "react-admin"; 10 | import { CustomerTitle } from "../customer/CustomerTitle"; 11 | import { ProductTitle } from "../product/ProductTitle"; 12 | 13 | export const OrderCreate = (props: CreateProps): React.ReactElement => { 14 | return ( 15 | <Create {...props}> 16 | <SimpleForm> 17 | <ReferenceInput 18 | source="customer.id" 19 | reference="Customer" 20 | label="Customer" 21 | > 22 | <SelectInput optionText={CustomerTitle} /> 23 | </ReferenceInput> 24 | <NumberInput label="Discount" source="discount" /> 25 | <ReferenceInput source="product.id" reference="Product" label="Product"> 26 | <SelectInput optionText={ProductTitle} /> 27 | </ReferenceInput> 28 | <NumberInput step={1} label="Quantity" source="quantity" /> 29 | <NumberInput step={1} label="Total Price" source="totalPrice" /> 30 | </SimpleForm> 31 | </Create> 32 | ); 33 | }; 34 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/address/base/AddressFindUniqueArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { AddressWhereUniqueInput } from "./AddressWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class AddressFindUniqueArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => AddressWhereUniqueInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => AddressWhereUniqueInput) 26 | @Field(() => AddressWhereUniqueInput, { nullable: false }) 27 | where!: AddressWhereUniqueInput; 28 | } 29 | 30 | export { AddressFindUniqueArgs as AddressFindUniqueArgs }; 31 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/product/base/ProductFindUniqueArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { ProductWhereUniqueInput } from "./ProductWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class ProductFindUniqueArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => ProductWhereUniqueInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => ProductWhereUniqueInput) 26 | @Field(() => ProductWhereUniqueInput, { nullable: false }) 27 | where!: ProductWhereUniqueInput; 28 | } 29 | 30 | export { ProductFindUniqueArgs as ProductFindUniqueArgs }; 31 | -------------------------------------------------------------------------------- /Mailer-main/Mailer-main/setup_repair.py: -------------------------------------------------------------------------------- 1 | #Logic Tested Ok 2 | 3 | 4 | from tkinter import * 5 | 6 | 7 | class setup_repair(object): 8 | def __init__(self): 9 | 10 | return None 11 | 12 | def setup(self): 13 | win = Tk() 14 | win.geometry("400x400") 15 | win.title("Setup/Repair") 16 | Label(win,text="Enter Your Email",width=50,font=("Roman",15,"bold")).pack() 17 | e1 = Entry(win,width=50) 18 | e1.pack() 19 | Label(win,text="Enter Your App Password",width=50,font=("Roman",15,"bold")).pack() 20 | e2 = Entry(win,width=50) 21 | e2.pack() 22 | 23 | def save(): 24 | f = open("current.status" ,"w") 25 | str = "" 26 | str += e1.get() 27 | str += " " 28 | str += e2.get() 29 | f.write(str) 30 | f.close() 31 | return None 32 | 33 | Button(win,text="Save",width=30,height=5,command=save,font=("Roman",15,"bold"),fg="green",bg="white").pack() 34 | win.mainloop() 35 | 36 | return None 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /hs_battlegrounds/hs_cards.py: -------------------------------------------------------------------------------- 1 | from base_card import Card 2 | 3 | if_base_card = True 4 | inherited_class = Card 5 | 6 | 7 | class Annoy_o_Tron(inherited_class): 8 | name = 'Annoy-o-Tron' 9 | 10 | def __init__(self): 11 | super().__init__(attack=1, health=2) 12 | self.is_bubbled = True 13 | self.is_taunt = True 14 | 15 | 16 | class Dozy_Whelp(inherited_class): 17 | name = 'Dozy Whelp' 18 | 19 | def __init__(self): 20 | super().__init__(attack=0, health=3) 21 | self.is_taunt = True 22 | 23 | def before_attacked(self, other): 24 | self.attack += 1 25 | 26 | 27 | class Micro_Mummy(inherited_class): 28 | name = 'Micro Mummy' 29 | 30 | def __init__(self): 31 | super().__init__(attack=1, health=2) 32 | self.is_reborn = True 33 | 34 | 35 | def get_cards() -> dict: 36 | cards = dict() 37 | def_classes = [Card, inherited_class] # excluding this classes from list 38 | global_objs = list(globals().items()) 39 | 40 | for name, obj in global_objs: 41 | if obj not in def_classes and isinstance(obj, type): 42 | cards[obj.name] = obj 43 | 44 | return cards 45 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/customer/base/CustomerFindUniqueArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { CustomerWhereUniqueInput } from "./CustomerWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | 18 | @ArgsType() 19 | class CustomerFindUniqueArgs { 20 | @ApiProperty({ 21 | required: true, 22 | type: () => CustomerWhereUniqueInput, 23 | }) 24 | @ValidateNested() 25 | @Type(() => CustomerWhereUniqueInput) 26 | @Field(() => CustomerWhereUniqueInput, { nullable: false }) 27 | where!: CustomerWhereUniqueInput; 28 | } 29 | 30 | export { CustomerFindUniqueArgs as CustomerFindUniqueArgs }; 31 | -------------------------------------------------------------------------------- /turtle_race.py: -------------------------------------------------------------------------------- 1 | from turtle import Turtle, Screen 2 | import random 3 | is_race_on=False 4 | screen=Screen() 5 | screen.setup(width=500,height=400) 6 | user_bet=screen.textinput(title="Make your bet",prompt="Choose your turtle, Enter a colour : ") 7 | colors=["purple","blue","green","yellow","orange","red"] 8 | all_turtles=[] 9 | 10 | for turtle_index in range(0,6): 11 | new_turtle=Turtle(shape="turtle") 12 | new_turtle.color(colors[turtle_index]) 13 | new_turtle.penup() 14 | new_turtle.goto(x=-230,y=-120+turtle_index*50) 15 | all_turtles.append(new_turtle) 16 | 17 | if user_bet: 18 | is_race_on=True 19 | 20 | while(is_race_on): 21 | for turtle in all_turtles: 22 | if turtle.xcor()>230: 23 | is_race_on=False 24 | winning_colour=turtle.pencolor() 25 | if winning_colour==user_bet: 26 | print(f"You've won. The winner of the race is {winning_colour} turtle") 27 | else: 28 | print(f"You've lost. The winner of the race is {winning_colour} turtle") 29 | rand_distance=random.randint(0,10) 30 | turtle.forward(rand_distance) 31 | 32 | screen.exitonclick() 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `Python_Projects` 2 | #### ➡️ A Collaborative Hub for Python Enthusiasts, a one-stop destination for Python programs, games, projects, and more ⬅️ 3 | <h1 align=center> 🎃 Hacktoberfest 2023 🎃 </h1> 4 | 5 | ## <center> 🎊 `Hacktoberfest` welcomes everyone to represent their unique skills and interest towards the open sources community contribution... 🎊 </center> 6 | 7 | <img align="center" src="https://hacktoberfest.com/_next/static/media/opengraph.e5fafe07.png"/> 8 | 9 | # 10 | 11 | [![@incrediblepro's Holopin board](https://holopin.me/incrediblepro)](https://holopin.io/@incrediblepro) 12 | 13 | ## 📢 Register yourself for the 10th Hacktoberfest challenge, make 4 quality contribution pull requests (PRs/MRs) between October 1st and 31st, and grab amazing rewards! ✨ 14 | 15 | ### Contributors must go through `CONTRIBUTING.md` and follow all the guidelines... 16 | #### *All the languages are accepted here... 17 | 18 | ### `Contributors:` 19 | 20 | <a href="https://github.com/mrb141107/Python_Projects/graphs/contributors"> 21 | <img src="https://contrib.rocks/image?repo=mrb141107/Python_Projects" /> 22 | </a> 23 | 24 | ## All the best for the festival of hackers 👍🏻 👨🏻‍💻 🎃 25 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/address/AddressEdit.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { 4 | Edit, 5 | SimpleForm, 6 | EditProps, 7 | TextInput, 8 | ReferenceArrayInput, 9 | SelectArrayInput, 10 | NumberInput, 11 | } from "react-admin"; 12 | 13 | import { CustomerTitle } from "../customer/CustomerTitle"; 14 | 15 | export const AddressEdit = (props: EditProps): React.ReactElement => { 16 | return ( 17 | <Edit {...props}> 18 | <SimpleForm> 19 | <TextInput label="Address 1" source="address_1" /> 20 | <TextInput label="Address 2" source="address_2" /> 21 | <TextInput label="City" source="city" /> 22 | <ReferenceArrayInput 23 | source="customers" 24 | reference="Customer" 25 | parse={(value: any) => value && value.map((v: any) => ({ id: v }))} 26 | format={(value: any) => value && value.map((v: any) => v.id)} 27 | > 28 | <SelectArrayInput optionText={CustomerTitle} /> 29 | </ReferenceArrayInput> 30 | <TextInput label="State" source="state" /> 31 | <NumberInput step={1} label="Zip" source="zip" /> 32 | </SimpleForm> 33 | </Edit> 34 | ); 35 | }; 36 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/address/AddressCreate.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { 4 | Create, 5 | SimpleForm, 6 | CreateProps, 7 | TextInput, 8 | ReferenceArrayInput, 9 | SelectArrayInput, 10 | NumberInput, 11 | } from "react-admin"; 12 | 13 | import { CustomerTitle } from "../customer/CustomerTitle"; 14 | 15 | export const AddressCreate = (props: CreateProps): React.ReactElement => { 16 | return ( 17 | <Create {...props}> 18 | <SimpleForm> 19 | <TextInput label="Address 1" source="address_1" /> 20 | <TextInput label="Address 2" source="address_2" /> 21 | <TextInput label="City" source="city" /> 22 | <ReferenceArrayInput 23 | source="customers" 24 | reference="Customer" 25 | parse={(value: any) => value && value.map((v: any) => ({ id: v }))} 26 | format={(value: any) => value && value.map((v: any) => v.id)} 27 | > 28 | <SelectArrayInput optionText={CustomerTitle} /> 29 | </ReferenceArrayInput> 30 | <TextInput label="State" source="state" /> 31 | <NumberInput step={1} label="Zip" source="zip" /> 32 | </SimpleForm> 33 | </Create> 34 | ); 35 | }; 36 | -------------------------------------------------------------------------------- /mergesort.py: -------------------------------------------------------------------------------- 1 | def mergeSort(array): 2 | if len(array) > 1: 3 | 4 | # r is the point where the array is divided into two subarrays 5 | r = len(array)//2 6 | L = array[:r] 7 | M = array[r:] 8 | 9 | # Sort the two halves 10 | mergeSort(L) 11 | mergeSort(M) 12 | 13 | i = j = k = 0 14 | 15 | # Until we reach either end of either L or M, pick larger among 16 | # elements L and M and place them in the correct position at A[p..r] 17 | while i < len(L) and j < len(M): 18 | if L[i] < M[j]: 19 | array[k] = L[i] 20 | i += 1 21 | else: 22 | array[k] = M[j] 23 | j += 1 24 | k += 1 25 | 26 | # When we run out of elements in either L or M, 27 | # pick up the remaining elements and put in A[p..r] 28 | while i < len(L): 29 | array[k] = L[i] 30 | i += 1 31 | k += 1 32 | 33 | while j < len(M): 34 | array[k] = M[j] 35 | j += 1 36 | k += 1 37 | 38 | arr = list(map(int,input("Enter the arr : ").split())) 39 | mergeSort(arr) 40 | print(ar) 41 | -------------------------------------------------------------------------------- /qrcode generator.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | import pyqrcode 3 | from PIL import ImageTk,Image 4 | root=Tk() 5 | 6 | def generator(): 7 | link_name=name_entry.get() 8 | link=link_entry.get() 9 | file_name=link_name + ".png" 10 | url=pyqrcode.create(link) 11 | url.png(file_name,scale=7) 12 | image=ImageTk.PhotoImage(Image.open(file_name)) 13 | image_label=Label(image=image) 14 | image_label.image=image 15 | canvas.create_window(200,450,window=image_label) 16 | 17 | 18 | 19 | canvas=Canvas(root,width=400,height=600) 20 | canvas.pack() 21 | 22 | app_label=Label(root,text="QR CODE Generator",fg="blue",font=("Arial",30)) 23 | canvas.create_window(200,50,window=app_label) 24 | 25 | name_label=Label(root,text='Link Name') 26 | link_label=Label(root,text='Link') 27 | 28 | canvas.create_window(200,100,window=name_label) 29 | canvas.create_window(200,160,window=link_label) 30 | 31 | 32 | name_entry=Entry(root) 33 | link_entry=Entry(root) 34 | 35 | 36 | canvas.create_window(200,130,window=name_entry) 37 | canvas.create_window(200,180,window=link_entry) 38 | 39 | button=Button(text="Generate QR CODE",command=generator) 40 | canvas.create_window(200,230,window=button) 41 | 42 | 43 | root.mainloop() 44 | 45 | -------------------------------------------------------------------------------- /python-hangman-Sanyog_Mishra/art.py: -------------------------------------------------------------------------------- 1 | stages = [''' 2 | +---+ 3 | | | 4 | O | 5 | /|\ | 6 | / \ | 7 | | 8 | ========= 9 | ''', ''' 10 | +---+ 11 | | | 12 | O | 13 | /|\ | 14 | / | 15 | | 16 | ========= 17 | ''', ''' 18 | +---+ 19 | | | 20 | O | 21 | /|\ | 22 | | 23 | | 24 | ========= 25 | ''', ''' 26 | +---+ 27 | | | 28 | O | 29 | /| | 30 | | 31 | | 32 | =========''', ''' 33 | +---+ 34 | | | 35 | O | 36 | | | 37 | | 38 | | 39 | ========= 40 | ''', ''' 41 | +---+ 42 | | | 43 | O | 44 | | 45 | | 46 | | 47 | ========= 48 | ''', ''' 49 | +---+ 50 | | | 51 | | 52 | | 53 | | 54 | | 55 | ========= 56 | '''] 57 | 58 | logo = ''' 59 | _ 60 | | | 61 | | |__ __ _ _ __ __ _ _ __ ___ __ _ _ __ 62 | | '_ \ / _` | '_ \ / _` | '_ ` _ \ / _` | '_ \ 63 | | | | | (_| | | | | (_| | | | | | | (_| | | | | 64 | |_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_| 65 | __/ | 66 | |___/ ''' 67 | -------------------------------------------------------------------------------- /Guess_the_number.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | print("Welcome to Guessing the Number game...") 3 | print("I'm thinking of a number between 1 to 100...") 4 | 5 | chances = 0 6 | if chances == 0 : 7 | d_level = input("\nSelect the difficulty level (easy/medium/hard) : ").lower() 8 | if str(d_level) == "easy": 9 | chances += 10 10 | print("You will get 10 chances to guess the number..") 11 | if str(d_level) == "medium" : 12 | chances += 7 13 | print("You will get 7 chances to guess the number..") 14 | if str(d_level) == "hard": 15 | chances += 5 16 | print("You will get 5 chances to guess the number..") 17 | 18 | number = randint(1,100) 19 | while chances >= 0: 20 | answer = int(input("\nMake a guess :")) 21 | if chances == 0 : 22 | print("Oops your chances over....Game over!!") 23 | chances=-1 24 | if answer > 100 or answer < 1: 25 | print("Guess the number between 1 to 100..") 26 | elif answer > number: print("Guess a smaller number..") 27 | elif answer < number : print("Guess a larger number..") 28 | elif answer == number : 29 | print("Correct answer!!...Booyaahhh....") 30 | chances=-1 31 | chances -=1 -------------------------------------------------------------------------------- /Trigonometric_ratios.py: -------------------------------------------------------------------------------- 1 | import math 2 | print("Enter the values of sides of a triangle") 3 | a = float(input("Enter the value of side a: ")) 4 | b = float(input("Enter the value of side b: ")) 5 | c = float(input("Enter the value of side c: ")) 6 | 7 | # Calculating the values of sin, cos and tan 8 | sin_a = round((a / c),2) 9 | cos_a = round((b / c),2) 10 | tan_a = round((a / b),2) 11 | 12 | # Calculating the values of cosec, sec and cot 13 | cosec_a = round((1 / sin_a),2) 14 | sec_a = round((1 / cos_a),2) 15 | cot_a = round((1 / tan_a),2) 16 | 17 | # Printing the values of sin, cos and tan 18 | print("\nThe value of sin a is: ", sin_a) 19 | print("The value of cos a is: ", cos_a) 20 | print("The value of tan a is: ", tan_a) 21 | 22 | # Printing the values of cosec, sec and cot 23 | print("The value of cosec a is: ", cosec_a) 24 | print("The value of sec a is: ", sec_a) 25 | print("The value of cot a is: ", cot_a) 26 | 27 | 28 | # Defining the formula of Heron's to calculate the area of triangle. 29 | def Area(a, b, c): 30 | sp = (a + b + c) / 2 31 | area = (sp) * (sp - a) * (sp - b) * (sp - c) 32 | f_area = round((area**0.5), 2) 33 | print(f"The area of triangle is {f_area}" + " square units") 34 | 35 | #Printing the area of triangle. 36 | Area(a,b,c) 37 | -------------------------------------------------------------------------------- /apps/mr-b-141107/scripts/seed.ts: -------------------------------------------------------------------------------- 1 | import * as dotenv from "dotenv"; 2 | import { PrismaClient } from "@prisma/client"; 3 | import { customSeed } from "./customSeed"; 4 | import { Salt, parseSalt } from "../src/auth/password.service"; 5 | import { hash } from "bcrypt"; 6 | 7 | if (require.main === module) { 8 | dotenv.config(); 9 | 10 | const { BCRYPT_SALT } = process.env; 11 | 12 | if (!BCRYPT_SALT) { 13 | throw new Error("BCRYPT_SALT environment variable must be defined"); 14 | } 15 | const salt = parseSalt(BCRYPT_SALT); 16 | 17 | seed(salt).catch((error) => { 18 | console.error(error); 19 | process.exit(1); 20 | }); 21 | } 22 | 23 | async function seed(bcryptSalt: Salt) { 24 | console.info("Seeding database..."); 25 | 26 | const client = new PrismaClient(); 27 | 28 | const data = { 29 | username: "admin", 30 | password: await hash("admin", bcryptSalt), 31 | roles: ["user"], 32 | }; 33 | 34 | await client.user.upsert({ 35 | where: { 36 | username: data.username, 37 | }, 38 | 39 | update: {}, 40 | create: data, 41 | }); 42 | 43 | void client.$disconnect(); 44 | 45 | console.info("Seeding database with custom seed..."); 46 | customSeed(); 47 | 48 | console.info("Seeded database successfully"); 49 | } 50 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/customer/CustomerList.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { 3 | List, 4 | Datagrid, 5 | ListProps, 6 | ReferenceField, 7 | TextField, 8 | DateField, 9 | } from "react-admin"; 10 | import Pagination from "../Components/Pagination"; 11 | import { ADDRESS_TITLE_FIELD } from "../address/AddressTitle"; 12 | 13 | export const CustomerList = (props: ListProps): React.ReactElement => { 14 | return ( 15 | <List 16 | {...props} 17 | bulkActionButtons={false} 18 | title={"Customers"} 19 | perPage={50} 20 | pagination={<Pagination />} 21 | > 22 | <Datagrid rowClick="show"> 23 | <ReferenceField label="Address" source="address.id" reference="Address"> 24 | <TextField source={ADDRESS_TITLE_FIELD} /> 25 | </ReferenceField> 26 | <DateField source="createdAt" label="Created At" /> 27 | <TextField label="Email" source="email" /> 28 | <TextField label="First Name" source="firstName" /> 29 | <TextField label="ID" source="id" /> 30 | <TextField label="Last Name" source="lastName" /> 31 | <TextField label="Phone" source="phone" /> 32 | <DateField source="updatedAt" label="Updated At" /> 33 | </Datagrid> 34 | </List> 35 | ); 36 | }; 37 | -------------------------------------------------------------------------------- /etch-a-sketch.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | 3 | class sketch_book: 4 | def __init__(self) -> None: 5 | self.tim=turtle.Turtle() 6 | self.screen=turtle.Screen() 7 | color=self.screen.textinput("color","choose the color of pen ") 8 | size=self.screen.textinput("size","choose the size of pen (in range 1 to 10)") 9 | self.tim.color(color) 10 | self.tim.pensize(size) 11 | self.listen() 12 | self.screen.mainloop() 13 | 14 | def movefd(self): 15 | self.tim.fd(30) 16 | 17 | def movebk(self): 18 | self.tim.bk(30) 19 | 20 | def left(self): 21 | self.tim.left(10) 22 | 23 | def right(self): 24 | self.tim.right(10) 25 | 26 | def clear(self): 27 | self.tim.clear() 28 | 29 | def listen(self): 30 | self.screen.listen() 31 | self.screen.onkeypress(key="Up",fun=self.movefd) 32 | self.screen.onkeypress(key="Down",fun=self.movebk) 33 | self.screen.onkeypress(key="Left",fun=self.left) 34 | self.screen.onkeypress(key="Right",fun=self.right) 35 | self.screen.onkeypress(key="c",fun=self.clear) 36 | self.tim.ondrag(self.tim.goto) 37 | 38 | if __name__=="__main__": 39 | game1=sketch_book() 40 | -------------------------------------------------------------------------------- /breadth_first_search.py: -------------------------------------------------------------------------------- 1 | class Node: 2 | def __init__(self, value) -> None: 3 | self.value = value 4 | self.left = None 5 | self.right = None 6 | 7 | 8 | def breadth_first_search(root) -> None: 9 | 10 | if root is None: 11 | print("# No output as the tree is empty.") 12 | return 13 | 14 | queue = [] 15 | queue.append(root) 16 | result = [] 17 | 18 | while queue: 19 | current_node = queue.pop(0) 20 | result.append(current_node.value) 21 | print(current_node.value, end=" ") 22 | 23 | if current_node.left: 24 | queue.append(current_node.left) 25 | if current_node.right: 26 | queue.append(current_node.right) 27 | 28 | print("Breadth-First Search traversal:") 29 | print(" ".join(map(str, result))) 30 | 31 | 32 | if __name__ == "__main__": 33 | # Constructing the search tree 34 | root = Node(1) 35 | root.left = Node(2) 36 | root.right = Node(3) 37 | root.left.left = Node(4) 38 | root.left.right = Node(5) 39 | root.right.left = Node(6) 40 | root.right.right = Node(7) 41 | 42 | # Running the breadth-first search 43 | breadth_first_search(root) 44 | 45 | # Test with an empty tree 46 | root = None 47 | breadth_first_search(root) 48 | -------------------------------------------------------------------------------- /depth_first_search.py: -------------------------------------------------------------------------------- 1 | class Node: 2 | def __init__(self, value) -> None: 3 | self.value = value 4 | self.children = [] 5 | 6 | def depth_first_search(root) -> None: 7 | if root is None: 8 | print("# No output as the tree is empty.") 9 | return 10 | 11 | stack = [] 12 | stack.append(root) 13 | result = [] 14 | 15 | while stack: 16 | current_node = stack.pop() 17 | result.append(current_node.value) 18 | print(current_node.value, end=" ") 19 | 20 | # Reverse the order of children to explore in a specific order (e.g., left to right). 21 | for child in reversed(current_node.children): 22 | stack.append(child) 23 | 24 | print("Depth-First Search traversal:") 25 | print(" ".join(map(str, result))) 26 | 27 | 28 | if __name__ == "__main__": 29 | # Constructing a tree with arbitrary structure 30 | root = Node(1) 31 | root.children = [Node(2), Node(3), Node(4)] 32 | root.children[0].children = [Node(5), Node(6)] 33 | root.children[1].children = [Node(7)] 34 | root.children[2].children = [Node(8), Node(9)] 35 | 36 | # Running the depth-first search 37 | depth_first_search(root) 38 | 39 | # Test with an empty tree 40 | root = None 41 | depth_first_search(root) 42 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## `Rules :` 2 | 1. Fake PR/MR will not be accepted, and marked as `invalid`. 3 | 4 | 2. We may ask to `update/change` program if it include bugs. 5 | 6 | 3. Your PR/MRs must be created between `October 1` and `October 31`. 7 | 8 | 4. Spammy PRs will be marked as `spam` 9 | 10 | 5. No `README.md` updates will be accepted. 11 | 12 | 6. Be aware of `MIT License`. 13 | 14 | 15 | ## `How to Contribute` 16 | We welcome contributions from developers, educators, and anyone interested in improving this project. To contribute, follow these steps: 17 | 18 | 1. Fork the repository to your GitHub account. 19 | 20 | 2. Clone the forked repository to your local machine. 21 | 22 | 3. Make your desired changes and improvements. 23 | 24 | 4. Commit your changes with clear and concise commit messages. 25 | 26 | 5. Push your changes to your forked repository. 27 | 28 | 6. Create a pull request to the main repository, outlining the changes you've made and the reasons behind them. 29 | 30 | 7. Participate in the discussion and collaboration to refine and merge your contributions into the project. 31 | 32 | ### `Our contributors :` 33 | 34 | <a href="https://github.com/MrB141107/Python_Projects/graphs/contributors"> 35 | <img src="https://contrib.rocks/image?repo=MrB141107/Python_Projects" /> 36 | </a> 37 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/order/OrderShow.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { 3 | Show, 4 | SimpleShowLayout, 5 | ShowProps, 6 | DateField, 7 | ReferenceField, 8 | TextField, 9 | } from "react-admin"; 10 | import { CUSTOMER_TITLE_FIELD } from "../customer/CustomerTitle"; 11 | import { PRODUCT_TITLE_FIELD } from "../product/ProductTitle"; 12 | 13 | export const OrderShow = (props: ShowProps): React.ReactElement => { 14 | return ( 15 | <Show {...props}> 16 | <SimpleShowLayout> 17 | <DateField source="createdAt" label="Created At" /> 18 | <ReferenceField 19 | label="Customer" 20 | source="customer.id" 21 | reference="Customer" 22 | > 23 | <TextField source={CUSTOMER_TITLE_FIELD} /> 24 | </ReferenceField> 25 | <TextField label="Discount" source="discount" /> 26 | <TextField label="ID" source="id" /> 27 | <ReferenceField label="Product" source="product.id" reference="Product"> 28 | <TextField source={PRODUCT_TITLE_FIELD} /> 29 | </ReferenceField> 30 | <TextField label="Quantity" source="quantity" /> 31 | <TextField label="Total Price" source="totalPrice" /> 32 | <DateField source="updatedAt" label="Updated At" /> 33 | </SimpleShowLayout> 34 | </Show> 35 | ); 36 | }; 37 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/swagger/favicon.png: -------------------------------------------------------------------------------- 1 | �PNG 2 |  3 | ��� IHDR��� ��� ���szz���4IDATXG��Kl]W�����}�L�����n�NR�IP%P)��U�� 2�$D�1c cF���PU��"!J�J�#����#%�[Ǿ���й��sI�(q�'G:���k�Oq�eM��P�����q ޏ�!%�$z��~��,-��A�/����L����/(�ɬ�|��o����zs��52r>�hn�KqGU�ݠ!)앴�ũ��%%~��Wk��}�H��@��<�M��� !^���������� TAi�� �##�/�|�ܶ��R� �tP�}�;Ph�n2~���� ����WE8(9`���1�J�M� 1��J6��~n�J=����,-td,��b؏�q�àA�����y ��B|Y�� ��&�͂��l� _6�M/�g�[��93q��L��cc�} W�nn�k�1R�0pDЇh5�/^�������?Ԕ�%;?_q>��ήkU�|��[K ])d�!�� ?d�/qP��~T�M��:g{�j�U��䮾�UZ�~�|Ǽl�{_��&��)���g C�vI����N2`����� y�����yI��ڶ��ԟ��J<�y�S��� �)@�{�� ���/J��xMo�[���_.�}�_AGm���v�)��0�Z���J�:��� ���$�0V;�|��])�d�J“rx��b��)x �SȃFMZ ����(��e�3�N��:{z��z%?Bv&�o#����K�Ǟ���쏁]2���-����ð^������G�wb J��!�o����^2� }�sg�~g�.��b�V��c������]�-���Vks��,[\������y'o�jyK��3s�Z�!k�yǖ+0>:����l#um=���J���z ��7/ 7���s�P��� ����*���'<���)��PP:�Ԯ��^���?�<���!= :*�ѱe�O=6�Qn��<=j��2-�%E��6�l�>�<���s}��� �L���o�6?������h��p����#�]��$b�B����5����:�/O&F\�m�����!���2�i٠ĽQ�1�����"Ձ�!��}@w�X�"2JE�N���� nC/Jkm��>O=�VS[�����R��Gz�M�~�ǐ;@%��~v���#��պٰ(���33m� ��Y5�P{���ń�.����R�X�q9Oա_�5l�L�7�XR��~�:�ԯ�'`��¶Ɩ���z��'H�sjޤp� 4 | q�j��8����F�� 5 | �ٰ\�W�a�%Qw� c8v�L77��lj��߯�Rm����;�R�)���D��F���:�kad \1, ������n�/U����IEND�B`� -------------------------------------------------------------------------------- /apps/mr-b-141107/src/auth/jwt/base/jwt.strategy.base.ts: -------------------------------------------------------------------------------- 1 | import { UnauthorizedException } from "@nestjs/common"; 2 | import { PassportStrategy } from "@nestjs/passport"; 3 | import { ExtractJwt, Strategy } from "passport-jwt"; 4 | import { IAuthStrategy } from "../../IAuthStrategy"; 5 | import { UserInfo } from "../../UserInfo"; 6 | import { UserService } from "../../../user/user.service"; 7 | 8 | export class JwtStrategyBase 9 | extends PassportStrategy(Strategy) 10 | implements IAuthStrategy 11 | { 12 | constructor( 13 | protected readonly secretOrKey: string, 14 | protected readonly userService: UserService 15 | ) { 16 | super({ 17 | jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), 18 | ignoreExpiration: false, 19 | secretOrKey, 20 | }); 21 | } 22 | 23 | async validate(payload: UserInfo): Promise<UserInfo> { 24 | const { username } = payload; 25 | const user = await this.userService.findOne({ 26 | where: { username }, 27 | }); 28 | if (!user) { 29 | throw new UnauthorizedException(); 30 | } 31 | if ( 32 | !Array.isArray(user.roles) || 33 | typeof user.roles !== "object" || 34 | user.roles === null 35 | ) { 36 | throw new Error("User roles is not a valid value"); 37 | } 38 | return { ...user, roles: user.roles as string[] }; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /password_manager.py: -------------------------------------------------------------------------------- 1 | from cryptography.fernet import Fernet 2 | 3 | # Run the function write_key before running the whole program 4 | ''' 5 | def write_key(): 6 | key = Fernet.generate_key() 7 | with open("key.key", "wb") as key_file: 8 | key_file.write(key)''' 9 | 10 | 11 | def load_key(): 12 | file = open("key.key", "rb") 13 | key = file.read() 14 | file.close() 15 | return key 16 | 17 | 18 | key = load_key() 19 | fer = Fernet(key) 20 | 21 | 22 | def view(): 23 | with open('passwords.txt', 'r') as f: 24 | for line in f.readlines(): 25 | data = line.rstrip() 26 | user, passw = data.split("|") 27 | print("User:", user, "| Password:", 28 | fer.decrypt(passw.encode()).decode()) 29 | 30 | 31 | def add(): 32 | name = input('Account Name: ') 33 | pwd = input("Password: ") 34 | 35 | with open('passwords.txt', 'a') as f: 36 | f.write(name + "|" + fer.encrypt(pwd.encode()).decode() + "\n") 37 | 38 | 39 | while True: 40 | mode = input( 41 | "Would you like to add a new password or view existing ones (view, add), press q to quit? ").lower() 42 | if mode == "q": 43 | break 44 | 45 | if mode == "view": 46 | view() 47 | elif mode == "add": 48 | add() 49 | else: 50 | print("Invalid mode.") 51 | continue -------------------------------------------------------------------------------- /apps/mr-b-141107/src/tests/health/health.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { mock } from "jest-mock-extended"; 2 | import { PrismaService } from "../../prisma/prisma.service"; 3 | import { HealthServiceBase } from "../../health/base/health.service.base"; 4 | 5 | describe("Testing the HealthServiceBase", () => { 6 | //ARRANGE 7 | let prismaService: PrismaService; 8 | let healthServiceBase: HealthServiceBase; 9 | 10 | describe("Testing the isDbReady function in HealthServiceBase class", () => { 11 | beforeEach(() => { 12 | prismaService = mock<PrismaService>(); 13 | healthServiceBase = new HealthServiceBase(prismaService); 14 | }); 15 | it("should return true if allow connection to db", async () => { 16 | //ARRANGE 17 | (prismaService.$queryRaw as jest.Mock).mockReturnValue( 18 | Promise.resolve(true) 19 | ); 20 | //ACT 21 | const response = await healthServiceBase.isDbReady(); 22 | //ASSERT 23 | expect(response).toBe(true); 24 | }); 25 | it("should return false if db is not available", async () => { 26 | //ARRANGE 27 | (prismaService.$queryRaw as jest.Mock).mockReturnValue( 28 | Promise.reject(false) 29 | ); 30 | //ACT 31 | const response = await healthServiceBase.isDbReady(); 32 | //ASSERT 33 | expect(response).toBe(false); 34 | }); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/App.scss: -------------------------------------------------------------------------------- 1 | // .App { 2 | // .MuiAppBar-colorSecondary { 3 | // background-color: black; 4 | 5 | // .RaAppBar-menuButton-13 { 6 | // background-color: yellow; 7 | // } 8 | // } 9 | 10 | // .MuiDrawer-paper { 11 | // background-color: red; 12 | 13 | // .MuiListItemIcon-root { 14 | // color: white; 15 | // } 16 | // } 17 | 18 | // .MuiButton-textPrimary { 19 | // background-color: purple; 20 | // margin: 0 0.5rem; 21 | // color: white; 22 | // padding: 0.5rem 1rem; 23 | 24 | // &:hover { 25 | // background-color: blue; 26 | // } 27 | // } 28 | 29 | // .MuiTableRow-head { 30 | // .MuiTableCell-head { 31 | // background-color: black; 32 | // color: white; 33 | // } 34 | 35 | // .MuiTableSortLabel-root { 36 | // &:hover { 37 | // color: red; 38 | 39 | // .MuiTableSortLabel-icon { 40 | // color: red !important; 41 | // } 42 | // } 43 | // .MuiTableSortLabel-icon { 44 | // color: white !important; 45 | // } 46 | // } 47 | // .MuiTableSortLabel-active { 48 | // color: green; 49 | 50 | // .MuiTableSortLabel-icon { 51 | // color: green !important; 52 | // } 53 | // } 54 | // } 55 | 56 | // .MuiFormLabel-root { 57 | // color: magenta; 58 | // } 59 | // } 60 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/customer/CustomerEdit.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { 4 | Edit, 5 | SimpleForm, 6 | EditProps, 7 | ReferenceInput, 8 | SelectInput, 9 | TextInput, 10 | ReferenceArrayInput, 11 | SelectArrayInput, 12 | } from "react-admin"; 13 | 14 | import { AddressTitle } from "../address/AddressTitle"; 15 | import { OrderTitle } from "../order/OrderTitle"; 16 | 17 | export const CustomerEdit = (props: EditProps): React.ReactElement => { 18 | return ( 19 | <Edit {...props}> 20 | <SimpleForm> 21 | <ReferenceInput source="address.id" reference="Address" label="Address"> 22 | <SelectInput optionText={AddressTitle} /> 23 | </ReferenceInput> 24 | <TextInput label="Email" source="email" type="email" /> 25 | <TextInput label="First Name" source="firstName" /> 26 | <TextInput label="Last Name" source="lastName" /> 27 | <ReferenceArrayInput 28 | source="orders" 29 | reference="Order" 30 | parse={(value: any) => value && value.map((v: any) => ({ id: v }))} 31 | format={(value: any) => value && value.map((v: any) => v.id)} 32 | > 33 | <SelectArrayInput optionText={OrderTitle} /> 34 | </ReferenceArrayInput> 35 | <TextInput label="Phone" source="phone" /> 36 | </SimpleForm> 37 | </Edit> 38 | ); 39 | }; 40 | -------------------------------------------------------------------------------- /apps/mr-b-141107-admin/src/customer/CustomerCreate.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { 4 | Create, 5 | SimpleForm, 6 | CreateProps, 7 | ReferenceInput, 8 | SelectInput, 9 | TextInput, 10 | ReferenceArrayInput, 11 | SelectArrayInput, 12 | } from "react-admin"; 13 | 14 | import { AddressTitle } from "../address/AddressTitle"; 15 | import { OrderTitle } from "../order/OrderTitle"; 16 | 17 | export const CustomerCreate = (props: CreateProps): React.ReactElement => { 18 | return ( 19 | <Create {...props}> 20 | <SimpleForm> 21 | <ReferenceInput source="address.id" reference="Address" label="Address"> 22 | <SelectInput optionText={AddressTitle} /> 23 | </ReferenceInput> 24 | <TextInput label="Email" source="email" type="email" /> 25 | <TextInput label="First Name" source="firstName" /> 26 | <TextInput label="Last Name" source="lastName" /> 27 | <ReferenceArrayInput 28 | source="orders" 29 | reference="Order" 30 | parse={(value: any) => value && value.map((v: any) => ({ id: v }))} 31 | format={(value: any) => value && value.map((v: any) => v.id)} 32 | > 33 | <SelectArrayInput optionText={OrderTitle} /> 34 | </ReferenceArrayInput> 35 | <TextInput label="Phone" source="phone" /> 36 | </SimpleForm> 37 | </Create> 38 | ); 39 | }; 40 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/serveStaticOptions.service.ts: -------------------------------------------------------------------------------- 1 | import * as path from "path"; 2 | import { Injectable, Logger } from "@nestjs/common"; 3 | import { ConfigService } from "@nestjs/config"; 4 | import { 5 | ServeStaticModuleOptions, 6 | ServeStaticModuleOptionsFactory, 7 | } from "@nestjs/serve-static"; 8 | 9 | const SERVE_STATIC_ROOT_PATH_VAR = "SERVE_STATIC_ROOT_PATH"; 10 | const DEFAULT_STATIC_MODULE_OPTIONS_LIST: ServeStaticModuleOptions[] = [ 11 | { 12 | serveRoot: "/swagger", 13 | rootPath: path.join(__dirname, "swagger"), 14 | }, 15 | ]; 16 | 17 | @Injectable() 18 | export class ServeStaticOptionsService 19 | implements ServeStaticModuleOptionsFactory 20 | { 21 | private readonly logger = new Logger(ServeStaticOptionsService.name); 22 | 23 | constructor(private readonly configService: ConfigService) {} 24 | 25 | createLoggerOptions(): ServeStaticModuleOptions[] { 26 | const serveStaticRootPath = this.configService.get( 27 | SERVE_STATIC_ROOT_PATH_VAR 28 | ); 29 | if (serveStaticRootPath) { 30 | const resolvedPath = path.resolve(serveStaticRootPath); 31 | this.logger.log(`Serving static files from ${resolvedPath}`); 32 | return [ 33 | ...DEFAULT_STATIC_MODULE_OPTIONS_LIST, 34 | { rootPath: resolvedPath, exclude: ["/api*", "/graphql"] }, 35 | ]; 36 | } 37 | return DEFAULT_STATIC_MODULE_OPTIONS_LIST; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/user/base/UpdateUserArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { UserWhereUniqueInput } from "./UserWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | import { UserUpdateInput } from "./UserUpdateInput"; 18 | 19 | @ArgsType() 20 | class UpdateUserArgs { 21 | @ApiProperty({ 22 | required: true, 23 | type: () => UserWhereUniqueInput, 24 | }) 25 | @ValidateNested() 26 | @Type(() => UserWhereUniqueInput) 27 | @Field(() => UserWhereUniqueInput, { nullable: false }) 28 | where!: UserWhereUniqueInput; 29 | 30 | @ApiProperty({ 31 | required: true, 32 | type: () => UserUpdateInput, 33 | }) 34 | @ValidateNested() 35 | @Type(() => UserUpdateInput) 36 | @Field(() => UserUpdateInput, { nullable: false }) 37 | data!: UserUpdateInput; 38 | } 39 | 40 | export { UpdateUserArgs as UpdateUserArgs }; 41 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/order/base/UpdateOrderArgs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------------ 3 | This code was generated by Amplication. 4 | 5 | Changes to this file will be lost if the code is regenerated. 6 | 7 | There are other ways to to customize your code, see this doc to learn more 8 | https://docs.amplication.com/how-to/custom-code 9 | 10 | ------------------------------------------------------------------------------ 11 | */ 12 | import { ArgsType, Field } from "@nestjs/graphql"; 13 | import { ApiProperty } from "@nestjs/swagger"; 14 | import { OrderWhereUniqueInput } from "./OrderWhereUniqueInput"; 15 | import { ValidateNested } from "class-validator"; 16 | import { Type } from "class-transformer"; 17 | import { OrderUpdateInput } from "./OrderUpdateInput"; 18 | 19 | @ArgsType() 20 | class UpdateOrderArgs { 21 | @ApiProperty({ 22 | required: true, 23 | type: () => OrderWhereUniqueInput, 24 | }) 25 | @ValidateNested() 26 | @Type(() => OrderWhereUniqueInput) 27 | @Field(() => OrderWhereUniqueInput, { nullable: false }) 28 | where!: OrderWhereUniqueInput; 29 | 30 | @ApiProperty({ 31 | required: true, 32 | type: () => OrderUpdateInput, 33 | }) 34 | @ValidateNested() 35 | @Type(() => OrderUpdateInput) 36 | @Field(() => OrderUpdateInput, { nullable: false }) 37 | data!: OrderUpdateInput; 38 | } 39 | 40 | export { UpdateOrderArgs as UpdateOrderArgs }; 41 | -------------------------------------------------------------------------------- /apps/mr-b-141107/src/interceptors/aclFilterResponse.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { 2 | CallHandler, 3 | ExecutionContext, 4 | Injectable, 5 | NestInterceptor, 6 | } from "@nestjs/common"; 7 | import { Observable } from "rxjs"; 8 | import { map } from "rxjs/operators"; 9 | import { InjectRolesBuilder, RolesBuilder } from "nest-access-control"; 10 | import { Reflector } from "@nestjs/core"; 11 | 12 | @Injectable() 13 | export class AclFilterResponseInterceptor implements NestInterceptor { 14 | constructor( 15 | @InjectRolesBuilder() private readonly rolesBuilder: RolesBuilder, 16 | private readonly reflector: Reflector 17 | ) {} 18 | 19 | intercept(context: ExecutionContext, next: CallHandler): Observable<any> { 20 | const [permissionsRoles]: any = this.reflector.getAllAndMerge<string[]>( 21 | "roles", 22 | [context.getHandler(), context.getClass()] 23 | ); 24 | 25 | const permission = this.rolesBuilder.permission({ 26 | role: permissionsRoles.role, 27 | action: permissionsRoles.action, 28 | possession: permissionsRoles.possession, 29 | resource: permissionsRoles.resource, 30 | }); 31 | 32 | return next.handle().pipe( 33 | map((data) => { 34 | if (Array.isArray(data)) { 35 | return data.map((results: any) => permission.filter(results)); 36 | } else { 37 | return permission.filter(data); 38 | } 39 | }) 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /apps/mr-b-141107/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | server: 4 | build: 5 | context: . 6 | args: 7 | NPM_LOG_LEVEL: notice 8 | ports: 9 | - ${PORT}:3000 10 | environment: 11 | BCRYPT_SALT: ${BCRYPT_SALT} 12 | JWT_SECRET_KEY: ${JWT_SECRET_KEY} 13 | JWT_EXPIRATION: ${JWT_EXPIRATION} 14 | DB_URL: mysql://${DB_USER}:${DB_PASSWORD}@db:3306/${DB_NAME} 15 | depends_on: 16 | - migrate 17 | migrate: 18 | build: 19 | context: . 20 | args: 21 | NPM_LOG_LEVEL: notice 22 | command: npm run db:init 23 | working_dir: /app/server 24 | environment: 25 | BCRYPT_SALT: ${BCRYPT_SALT} 26 | DB_URL: mysql://${DB_USER}:${DB_PASSWORD}@db:3306/${DB_NAME} 27 | depends_on: 28 | db: 29 | condition: service_healthy 30 | adminer: 31 | image: adminer 32 | restart: always 33 | ports: 34 | - 1234:8080 35 | db: 36 | image: mysql 37 | command: --default-authentication-plugin=mysql_native_password 38 | restart: always 39 | ports: 40 | - ${DB_PORT}:3306 41 | environment: 42 | MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} 43 | healthcheck: 44 | test: 45 | - CMD 46 | - mysqladmin 47 | - ping 48 | - -h 49 | - localhost 50 | - -u 51 | - ${DB_USER} 52 | timeout: 45s 53 | interval: 10s 54 | retries: 10 55 | volumes: 56 | mysql: ~ 57 | --------------------------------------------------------------------------------