diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c3a1190 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Not sure what a .gitignore is? +# See: https://git-scm.com/docs/gitignore + +# The first files are directly copied from Jekyll's first-party docs on `.gitignore` files: +# https://jekyllrb.com/tutorials/using-jekyll-with-bundler/#commit-to-source-control + +# Ignore the default location of the built site, and caches and metadata generated by Jekyll +_site/ +.sass-cache/ +.jekyll-cache/ +.jekyll-metadata + +# Ignore folders generated by Bundler +.bundle/ +vendor/ + +# These next files are used by Just the Docs developers. They are not necessary for end users of the theme, only developers. + +# We use Stylelint and Prettier, JavaScript tools, to lint and format our own code. +# We use Node.js as our runtime, so we ignore node_modules +node_modules + +# .DS_Store is a macOS-only metadata file about directories. Convention is to not commit them. +# See: https://en.wikipedia.org/wiki/.DS_Store +.DS_Store + +# These are legacy globs that typically target Ruby theme developers. We may change these at a later date. +*.gem +.bundle +.ruby-version diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..6ac9c86 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,11 @@ +package-lock.json +_site +assets/css/just-the-docs-default.scss +assets/css/just-the-docs-light.scss +assets/css/just-the-docs-dark.scss +assets/js/vendor/lunr.min.js +assets/js/search-data.json +assets/js/zzzz-search-data.json +assets/js/just-the-docs.js +*.md +_includes/mermaid_config.js diff --git a/404.html b/404.html new file mode 100644 index 0000000..a2d250a --- /dev/null +++ b/404.html @@ -0,0 +1,11 @@ +--- +layout: default +title: 404 +permalink: /404 +nav_exclude: true +search_exclude: true +--- + +

Page not found

+ +

The page you requested could not be found. Try using the navigation {% if site.search_enabled != false %}or search {% endif %}to find what you're looking for or go to this site's home page.

diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..05e64d4 --- /dev/null +++ b/_config.yml @@ -0,0 +1,193 @@ +# Welcome to Jekyll! +# +# This config file is meant for settings that affect your whole site, values +# which you are expected to set up once and rarely edit after that. If you find +# yourself editing these this file very often, consider using Jekyll's data files +# feature for the data you need to update frequently. +# +# For technical reasons, this file is *NOT* reloaded automatically when you use +# 'jekyll serve'. If you change this file, please restart the server process. + +# Site settings +# These are used to personalize your new site. If you look in the HTML files, +# you will see them accessed via {{ sigem instte.title }}, {{ site.github_repo }}, and so on. +# You can create any custom variable you would like, and they will be accessible +# in the templates via {{ site.myvariable }}. +title: Santosh J +description: Associate Architect in .NET +baseurl: "" # the subpath of your site, e.g. /blog +url: "https://just-the-docs.com" # the base hostname & protocol for your site, e.g. http://example.com +repository: just-the-docs/just-the-docs # for github-metadata +theme: just-the-docs +permalink: pretty + +exclude: + # from https://github.com/jekyll/jekyll/blob/master/lib/site_template/_config.yml: + - .sass-cache/ + - .jekyll-cache/ + - gemfiles/ + - Gemfile + - Gemfile.lock + - node_modules/ + - vendor/bundle/ + - vendor/cache/ + - vendor/gems/ + - vendor/ruby/ + # specific to the theme website: + - bin/ + - lib/ + - "*.gemspec" + - "*.gem" + - LICENSE.txt + - package.json + - package-lock.json + - Rakefile + - README.md + - CODE_OF_CONDUCT.md + - docker-compose.yml + - Dockerfile + # theme test code + - fixtures/ + +# Set a path/url to a logo that will be displayed instead of the title +#logo: "/assets/images/just-the-docs.png" + +# Enable or disable the site search +# Supports true (default) or false +search_enabled: true +search: + # Split pages into sections that can be searched individually + # Supports 1 - 6, default: 2 + heading_level: 6 + # Maximum amount of previews per search result + # Default: 3 + previews: 4 + # Maximum amount of words to display before a matched word in the preview + # Default: 5 + preview_words_before: 3 + # Maximum amount of words to display after a matched word in the preview + # Default: 10 + preview_words_after: 3 + # Set the search token separator + # Default: /[\s\-/]+/ + # Example: enable support for hyphenated search words + tokenizer_separator: /[\s/]+/ + # Display the relative url in search results + # Supports true (default) or false + rel_url: true + # Enable or disable the search button that appears in the bottom right corner of every page + # Supports true or false (default) + button: false + # Focus the search input by pressing `ctrl + focus_shortcut_key` (or `cmd + focus_shortcut_key` on macOS) + focus_shortcut_key: 'k' + +# For copy button on code +enable_copy_code_button: true + +# By default, consuming the theme as a gem leaves mermaid disabled; it is opt-in +mermaid: + # Version of mermaid library + # Pick an available version from https://cdn.jsdelivr.net/npm/mermaid/ + version: "9.1.6" + # Put any additional configuration, such as setting the theme, in _includes/mermaid_config.js + # See also docs/ui-components/code + # To load mermaid from a local library, also use the `path` key to specify the location of the library; e.g. + # for (v10+): + # path: "/assets/js/mermaid.esm.min.mjs" + # for ( + +{% endif %} \ No newline at end of file diff --git a/_includes/title.html b/_includes/title.html new file mode 100644 index 0000000..5d9668e --- /dev/null +++ b/_includes/title.html @@ -0,0 +1,8 @@ +{% if site.logo %} + +{% else %} +
+ {{ site.title }} +
{{site.description}}
+
+{% endif %} \ No newline at end of file diff --git a/docs/.gitkeep b/docs/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docs/.gitkeep @@ -0,0 +1 @@ + diff --git a/docs/Misc.md b/docs/Misc.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/clean.md b/docs/clean.md new file mode 100644 index 0000000..a8a0e13 --- /dev/null +++ b/docs/clean.md @@ -0,0 +1,29 @@ +--- +title: Clean +parent: My Docs +layout: default +published: true +--- +### Clean SQL log File. + +```sql +use teamcity_sj_self; +SELECT file_id, name, type_desc, physical_name, size, max_size FROM sys.database_files; +ALTER DATABASE teamcity_sj_self +SET RECOVERY SIMPLE +GO +DBCC SHRINKFILE (teamcity_sj_self_log, 1) +GO +ALTER DATABASE teamcity_sj_self +SET RECOVERY FULL +SELECT file_id, name, type_desc, physical_name, size, max_size FROM sys.database_files; +select name, log_reuse_wait_desc from sys.databases +``` + +Note: Sometimes the log file name might be different. So check them in the first query result. + +### Clean bin/obj/packages folders + +``` powershell +Get-ChildItem .\ -include bin,obj,packages -Recurse | ForEach-Object ($_) { Remove-Item $_.FullName -Force -Recurse } +``` \ No newline at end of file diff --git a/docs/credits.md b/docs/credits.md new file mode 100644 index 0000000..6403c4a --- /dev/null +++ b/docs/credits.md @@ -0,0 +1,10 @@ +--- +title: Credits +parent: My Docs +layout: default +published: true +--- + +Credits for different packages used to build this site. + +1. This site uses [Just the Docs](https://just-the-docs.com), a documentation theme for Jekyll. \ No newline at end of file diff --git a/docs/dotnet/index.md b/docs/dotnet/index.md new file mode 100644 index 0000000..32b7195 --- /dev/null +++ b/docs/dotnet/index.md @@ -0,0 +1,7 @@ +--- +title: .NET +parent: My Docs +has_children: true +layout: default +published: true +--- \ No newline at end of file diff --git a/docs/dotnet/nuget.md b/docs/dotnet/nuget.md new file mode 100644 index 0000000..1c5620a --- /dev/null +++ b/docs/dotnet/nuget.md @@ -0,0 +1,43 @@ +--- +title: Nuget +parent: .NET +layout: default +grand_parent: My Docs +published: true +--- + +### Debugging a release mode nuget package + --- +1. Ensure the .nupkg file contians the pdb file along with the dll. + a. From .NET 7 add this line to the CSPROJ in PropertyGroup element. + ```xml + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + ``` + b. This line ensures the pdb file to be packed along with the dll in nupkg file. + c. Please google `How to add pdb file in nupkg file in .NET x.x` for other .NET versions. + d. [nuget#symbol-packages](https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/nuget#symbol-packages) +2. In the project where you refer the package add below lines in the PropertyGroup. + a. [msbuild-props](https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props) + ``` xml + true + true + ``` + +### Directory.Build.props +--- +```xml + + enable + disable + preview + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + true + true + true + +``` + +### Pushing a package to private nuget feed. +--- + +`dotnet nuget push --source " --interactive` \ No newline at end of file diff --git a/docs/dotnet/web_api.md b/docs/dotnet/web_api.md new file mode 100644 index 0000000..d70cf85 --- /dev/null +++ b/docs/dotnet/web_api.md @@ -0,0 +1,30 @@ +--- +title: Web API +parent: .NET +layout: default +published: true +grand_parent: My Docs +--- + +### Return all routes in the Web API. + +``` csharp +endpoints.MapGet("/api/debug/routes", (IEnumerable endpointSources) => +{ + var t = endpointSources.SelectMany(_ => _.Endpoints) + .Select(_ => (_ as Microsoft.AspNetCore.Routing.RouteEndpoint).RoutePattern.RawText.Replace("api/", string.Empty)) + .OrderBy(a => a).ToList(); + List r = new List(); + foreach (var item in t) + { + int index = item.LastIndexOf("/{"); + if (index >= 0) + r.Add(item.Substring(0, index)); // or index + 1 to keep slash + else + { + r.Add(item); + } + } + return string.Join("\r\n", r); +}); +``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..ba722c2 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,78 @@ +--- +title: My Docs +layout: default +has_children: true +published: true +--- + +### dotCover +--- + +``` powershell +$temp_folder = $env:TEMP+'\'+$env:ComputerName+'\random_folder_name' +$sln = './my-solution.sln' +dotnet dotcover test $sln -c Debug --collect "XPlat Code Coverage" --dcOutput="$temp_folder\Coverage\coverage.snapshot" --dcAttributeFilters="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" --dcFilters="-:*Tests*;" +dotnet dotCover report --source="$temp_folder\Coverage\coverage.snapshot" --output="$temp_folder\Coverage\coverage.xml" --reportType="DetailedXML" +reportgenerator -reports:$temp_folder\Coverage\coverage.xml -targetdir:$temp_folder\Reports\ -reporttypes:"HtmlInline_AzurePipelines_Dark" +Invoke-Item $temp_folder\Reports\index.html +``` + + +### RoboCopy +--- +```powershell +robocopy 'src\' 'dest\' /A-:SH +``` + +S - exclude system attributes +H - exlude hidden attribute + +Note: use `/MIR` with caution. it removes the destination files if they don't exist in source. + + + +### Nuget +--- + +For pushing a package to private nuget feed. + + +```powershell +dotnet nuget push --source " --interactive +``` + + +### Powershell + +--- +#### 1. Stop, deploy and start IIS + +```powershell +$ErrorActionPreference = "Stop" +$pwd = "current working directory" +$targetServer = "server / computer name" +$cred = Get-Credential -UserName Administrator -Message "Password for $targetServer" +$siteName ="iis site name" +$projectFile ='project file path' +$destFolder ='dest folder' +# stop iis. +invoke-command -computername $targetServer -scriptblock {Stop-IISSite -Name $using:siteName -Confirm:$false} -Credential $cred +cd $pwd +# create temp directory for published out. +$tempDir = [System.IO.Path]::GetTempPath() +[string] $dirPath = Join-Path $tempDir 'project name' +if (Test-Path $dirPath) { +Remove-Item -LiteralPath $dirPath -Recurse -Force +} +New-Item -ItemType Directory -Path $dirPath +# publish +dotnet publish $projectFile -c Release --force -o $dirPath --runtime "win-x64" --self-contained +#/p:PublishSingleFile=true /p:PublishTrimmed=true /p:PublishReadyToRun=true +# copy the files. +robocopy $dirPath $destFolder /A-:SH +#start iis +invoke-command -computername $targetServer -scriptblock {Start-IISSite -Name $using:siteName } -Credential $cred +``` + +### Teams login hint +`https://teams.microsoft.com/?tenantId=&login_hint=your.em@il.com` \ No newline at end of file diff --git a/docs/install/iis.md b/docs/install/iis.md new file mode 100644 index 0000000..9681e74 --- /dev/null +++ b/docs/install/iis.md @@ -0,0 +1,12 @@ +--- +title: IIS +layout: default +published: true +parent: Install / Uninstall +grand_parent: My Docs +--- + +## Kestrel on new server + +1. Install URL Rewrite +1. Install Asp Net Hosting Bundle. diff --git a/docs/install/index.md b/docs/install/index.md new file mode 100644 index 0000000..bea6f81 --- /dev/null +++ b/docs/install/index.md @@ -0,0 +1,7 @@ +--- +title: Install / Uninstall +parent: My Docs +has_children: true +layout: default +published: true +--- \ No newline at end of file diff --git a/docs/install/sonarqube-docker.md b/docs/install/sonarqube-docker.md new file mode 100644 index 0000000..a8c8c19 --- /dev/null +++ b/docs/install/sonarqube-docker.md @@ -0,0 +1,16 @@ +--- +title: Sonarqube Docker +parent: Install / Uninstall +layout: default +published: true +grand_parent: My Docs +--- + + +## Sonarqube Docker installation steps. + +1. ```docker pull sonarqube:9.4-community``` +1. if database is new then execute -```ALTER DATABASE CURRENT COLLATE SQL_Latin1_General_CP1_CS_AS;``` +1. ```docker run -d --name sonarqube_dotnet -p 9009:9000 -e SONAR_JDBC_URL="jdbc:sqlserver://192.168.1.192:1433;databaseName=sonarqube_dotnet" -e SONAR_JDBC_USERNAME=sa -e SONAR_JDBC_PASSWORD=admin@123 -v sonarqube_data:/dump/sonarqube_dotnet/data -v sonarqube_extensions:/dump/sonarqube_dotnet/extensions -v sonarqube_logs:/dump/sonarqube_dotnet/logs sonarqube:9.4-community``` + +[Got memory issues ?](https://stackoverflow.com/a/66547784/3465753) \ No newline at end of file diff --git a/docs/install/sql.md b/docs/install/sql.md new file mode 100644 index 0000000..a2b4268 --- /dev/null +++ b/docs/install/sql.md @@ -0,0 +1,64 @@ +--- +title: SQL +parent: Install / Uninstall +layout: default +published: true +grand_parent: My Docs +--- +## SQL Installation + +1. Create a new instance with required name. +2. Select only Database Engine Services, and Local DB. Local DB selection is applicable only for first instance. +3. ML Services, Polybase blah blah,SQl Server Repilication are optional. +4. Give a proper instance name. + +## Expose the instance to the LAN + +1. Open SQL Configuration Manager. +2. Expand SQL Server Network Configuration +3. Select your instance +1. Double click on Named Pipes and enable it. +1. Double Click TCP/IP + 1. Enable + 1. Listen All - No + 1. IP Addressess Tab + 1. All IP addresses have enable option. Enable this for all IP's in this tab. + 1. For TCP Port, enter what ever port you want but ensure port is not used. If port is being used then service won't restart. + 1. by default 1433 is the default port. + 1. For IPAll as well, set TCP port +1. Restart the instance in the SQL Server Services. + + +## Firewall + +1. Create or update the inbound and outbound rules with this new port. + +## Index Fragmentation + +```sql + SELECT OBJECT_NAME(ind.OBJECT_ID) AS TableName + ,ind.name AS IndexName + ,indexstats.index_type_desc AS IndexType + ,indexstats.avg_fragmentation_in_percent + FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL) indexstats + INNER JOIN sys.indexes ind ON ind.object_id = indexstats.object_id + AND ind.index_id = indexstats.index_id + WHERE indexstats.avg_fragmentation_in_percent > 10 + ORDER BY indexstats.avg_fragmentation_in_percent DESC +``` + +## Rebuild Index +`ALTER INDEX ALL ON rebuild` + + +## Rows Count +```sql + SELECT sc.name + '.' + ta.name TableName ,SUM(pa.rows) RowCnt + FROM sys.tables ta + INNER JOIN sys.partitions pa ON pa.OBJECT_ID = ta.OBJECT_ID + INNER JOIN sys.schemas sc ON ta.schema_id = sc.schema_id + WHERE ta.is_ms_shipped = 0 AND pa.index_id IN (1,0) + GROUP BY sc.name , ta.name + ORDER BY sc.name DESC +``` + diff --git a/docs/install/windows.md b/docs/install/windows.md new file mode 100644 index 0000000..0d524ef --- /dev/null +++ b/docs/install/windows.md @@ -0,0 +1,66 @@ +--- +title: Windows +parent: Install / Uninstall +layout: default +published: true +grand_parent: My Docs +--- + +## Create primary partition + +1. `diskpart` +1. `list disk` +1. `select disk ` - append your disk number at last. Choose your disk properly. +1. `list partition` +1. `list volume` +1. `clean` - caution: this formats everything on disk without confirmation. so double check you selected proper disk. +1. `create partition primary` +1. `format quick fs=ntfs` caution: normal formatting takes too much of time. +1. `active` - marks partition as active. +1. `assign LETTER=C` - assign some letter. and it's optional. +1. `exit` + +--- +## Create bootable USB + +1. Create primary partition. +2. Copy all installation media content nromally. + +--- + +## Run a VM on a physcial machine. + +### Creating a WIM file. + +1. Create a full backup of your server/client os on to a pendrive or shared location. +1. Take a USB(pendrive or HDD) connect it to your machine. And execute below scripts. +1. Am considering driver letter as "D" +1. `md D:\Mount, D:\Capture` +1. `Mount-WindowsImage -ImagePath "D:\full_path_to.vhdx" -Path D:\Mount -Index 1` +1. Once mounted if you want to clean any unneccesary file then you can do at this step. like cache folders, app data content, temp folders, windows updates folders etc. +1. `New-WindowsImage -CapturePath D:\Mount -Name WinBackup -ImagePath D:\Capture\Backup.wim -Description "Windows Backup" -Verify` - this takes time and it won't show any progress for a quite good amount of time based on your backup size. +1. `Dismount-WindowsImage -Path D:\Mount -Discard`- dismount image once completed. + +### Installing WIM file. + +1. Create a bootable USB(pendrive or HDD). Better to have another srive or copy the contents of D drive and then do this step else you will loose you WIM file created in above process. +1. Ensure to have the respective OS bootable files in the drive. In my case I used win server 2019. +1. Once you have the bootable USB to install fresh windows, then create a folder called "Softwares" and move your WIM file and also any other softwares/drivers if you need. Now you have the USB with bootable windows server and WIM file. +1. Ensure to boot from the USB and let windows shows its installation screen. Find the repair option in the same screen and proceed Repair Computer" > "Troubleshoot" > "Advanced Options" > "Command Prompt. +1. Now follow the below steps. The command prompt will open "X:\Sources" +1. Follow Create primary partition section above. +2. Go back to X Drive. +3. `Dism /Apply-Image /ImageFile:D:\Capture\Backup.wim /Index:1 /ApplyDir:C:\` +4. Once done then create boot files. `bcdboot C:\Windows /S C:` +5. Remove the pen drive and change the boot order to Windows Boot Manager. + +[Stack Overflow Reference](https://superuser.com/a/1170879/551075) + +### Domain Controller Not reacing issue + +1. Use `nltest` command +2. `nltest /sc_verify:domain_full_name` + +### Get Windows Key + +1. `wmic path softwarelicensingservice get OA3xOriginalProductKey` \ No newline at end of file diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..9d06e64 Binary files /dev/null and b/favicon.ico differ diff --git a/index.md b/index.md new file mode 100644 index 0000000..f1104bc --- /dev/null +++ b/index.md @@ -0,0 +1,10 @@ +--- +layout: default +title: Home +nav_order: 1 +description: "My personal blog" +permalink: / +--- + +# {{ description }} +{: .fs-9 } \ No newline at end of file