Skip to content

Instantly share code, notes, and snippets.

View shreyans-padmani's full-sized avatar

Shreyans Padmani shreyans-padmani

View GitHub Profile
@shreyans-padmani
shreyans-padmani / FoR EC2 With .net Live
Created April 3, 2025 13:04
FoR EC2 With .net Live
ubuntu@ip-172-31-12-139:~$ history
1 sudo apt update && sudo apt upgrade -y
2 sudo apt install -y wget apt-transport-https software-properties-common
3 wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
4 sudo dpkg -i packages-microsoft-prod.deb
5 sudo apt update
6 sudo apt install -y dotnet-sdk-8.0
7 sudo apt update
8 sudo apt install -y dotnet-runtime-8.0
9 dotnet --version
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using OpenPop.Common.Logging;
using OpenPop.Mime;
using OpenPop.Mime.Decode;
using OpenPop.Mime.Header;
udo nano /etc/systemd/system/Aayurveda.service
[Unit]
Description=.NET 8 App
After=network.target
[Service]
WorkingDirectory=/var/www/Ayurveda/publish
ExecStart=/usr/bin/dotnet /var/www/Ayurveda/publish/Ayurveda.dll
Restart=always
@shreyans-padmani
shreyans-padmani / scaffold-db-and-generate-view-controller.cs
Created February 13, 2025 05:12
This Gist contains configuration and setup files for a .NET 8.0 web application using Entity Framework Core with PostgreSQL. It includes: Project.sh: A shell script to: Add necessary NuGet packages for Entity Framework Core, PostgreSQL, and code generation. Scaffold the database context and models from an existing PostgreSQL database. Install th…
Project.sh
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL
dotnet ef dbcontext scaffold "Host=localhost;Database=Organization;Username=postgres;Password=1234" Npgsql.EntityFrameworkCore.PostgreSQL -o Models
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet tool install --global dotnet-aspnet-codegenerator
dotnet aspnet-codegenerator --help
dotnet add package Microsoft.EntityFrameworkCore.Tools
dotnet aspnet-codegenerator controller -name MstGallaryController -m MstGallary -dc OrganizationContext --relativeFolderPath Controllers --useDefaultLayout
CREATE PROCEDURE [Account_LogIn]
@UserName NVARCHAR(200),
@Password NVARCHAR(MAX)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @AspNetUserID NVARCHAR(256),
@UserType NVARCHAR(200),
@TableID INT,
@shreyans-padmani
shreyans-padmani / Pincode_Database_Schema_and_Bulk_Insert.sql
Created January 28, 2025 10:25
Pincode Database Schema and Bulk Insert with SQL Server
--https://drive.google.com/file/d/1ddUxGN69HDF1F7iGZ4dPlM5ZZluGtiFH/view?usp=sharing
CREATE TABLE Country (
CountryID INT PRIMARY KEY IDENTITY(1,1),
CountryName VARCHAR(100) UNIQUE
);
CREATE TABLE State (
StateID INT PRIMARY KEY IDENTITY(1,1),
StateName VARCHAR(100) UNIQUE,
@shreyans-padmani
shreyans-padmani / Sp_Generate_CRUD_Operation.sql
Last active March 3, 2025 10:41
SQL Script for Generating CRUD Stored Procedures
-- #########################################################
-- Author: https://theuniqueitsolution.com/
-- Copyright: (c) https://theuniqueitsolution.com/. You are free to use and redistribute
-- this script as long as this comments section with the
-- author and copyright details are not altered.
-- Purpose: For a specified user-defined table (or all user-defined
-- tables) in the database this script generates 4 Stored
-- Procedure definitions with different Procedure name
-- suffixes:
-- 1) List