Skip to content

Instantly share code, notes, and snippets.

View itorian's full-sized avatar
🎯
Focusing

Abhimanyu Kumar Vatsa itorian

🎯
Focusing
View GitHub Profile
@itorian
itorian / asp-dot-net-identity-to-asp-dot-net-core-identity-migration-script.sql
Last active August 20, 2024 19:34
Migrating database from ASP.NET Identity to ASP.NET Core Identity
-- STEP 1 : Change name of existing tables
EXEC sp_rename 'AspNetRoles', 'AspNetRoles_old';
EXEC sp_rename 'AspNetUserClaims', 'AspNetUserClaims_old';
EXEC sp_rename 'AspNetUserLogins', 'AspNetUserLogins_old';
EXEC sp_rename 'AspNetUserRoles', 'AspNetUserRoles_old';
EXEC sp_rename 'AspNetUsers', 'AspNetUsers_old';
@itorian
itorian / DevOps-Pipeline-For-Linux-Build
Last active October 1, 2019 05:44
This gist has sample DevOps pipeline code to build ASP.NET Core Web Application for Linux
# ------------------------------------------------------------------------------
# 1. To build all .net core projects in a solution use below pipeline code
# ------------------------------------------------------------------------------
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
@itorian
itorian / PayPalRESTAPI.cs
Created June 7, 2019 13:14
PayPal REST API calls to get access token and process payment
using System;
using System.Text;
using System.Net.Http;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Web.Script.Serialization;
namespace ConsoleApp14
{
class Program
@itorian
itorian / create-azure-vm-in-selected-subscription-powershell.ps1
Created December 24, 2017 10:51
Create Azure Virtual Machine inside selected subscription using PowerShell
# Login
Login-AzureRmAccount
# Set subscription to create resources in
Set-AzureRmContext -SubscriptionId "xxxxxxxxx"
# Variables for common values
$location = "westeurope"
$resourceGroup = "demo-resgroup-0"
$vmName = "demovm-0"
@itorian
itorian / create-azure-vm-powershell.ps1
Last active November 16, 2022 09:20
Create Azure Virtual Machine using PowerShell
# Login
Login-AzureRmAccount
# Variables for common values
$location = "westeurope"
$resourceGroup = "demo-resgroup-0"
$vmName = "demovm-0"
$publicIP = "spublicip-1"
$subnet = "subnet-1"
$vnet = "vnet-1"
@itorian
itorian / H264MultipleBitrateCustom720p.json
Last active April 19, 2016 07:20
I received two different error messages (.xml preset and .json preset displays different messages) from azure media services encoder.
{
"Version": 1.0,
"Codecs": [
{
"KeyFrameInterval": "00:00:02",
"H264Layers": [
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 1000,
@itorian
itorian / Azure media services transcoding JobState.Error handling
Last active April 19, 2016 06:12
In case you are facing error in scheduled transcoding task and you would like to know details of the error, you can use below code snippet. More details here http://www.itorian.com/2016/04/azure-media-services-transcoding.html
static public IAsset EncodeToAdaptiveBitrateMP4s(IAsset asset, AssetCreationOptions options)
{
// Default preset settings
//IJob job = _context.Jobs.CreateWithSingleTask(MediaProcessorNames.AzureMediaEncoder,
// MediaEncoderTaskPresetStrings.H264AdaptiveBitrateMP4Set720p,
// asset,
// "Test-Video-" + 100 + "-" + Guid.NewGuid().ToString() + "-Adaptive-Bitrate-MP4",
// AssetCreationOptions.None);
// Custom preset settings
@itorian
itorian / Comparing two List<T> to find match in both list, 1st list only, 2nd list only that is Insersect, Minus and Minus Except
Created April 13, 2016 09:09
Comparing two List<T> to find match in both list, 1st list only, 2nd list only that is Insersect, Minus and Minus Except
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
List<Items> list1 = new List<Items>();
list1.Add(new Items { name = "abc" });
list1.Add(new Items { name = "abd" });
list1.Add(new Items { name = "aef" });
## 1. Install log4net using NuGet
## 2. Add assembly in AssemblyInfo.cs file
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Web.config", Watch = true)]
## 3. Add settings in web.config
<configuration>
<configSections>
:::
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
@itorian
itorian / EntityFramework vs LINQ vs ADO.NET - select query samples
Created December 3, 2015 11:24
EntityFramework vs LINQ vs ADO.NET - select query samples
// Entity Framework
public ActionResult GetBokaroStudentEF()
{
var db = GetFromDbContext();
var data = db.Students.Where(i => i.City == "Bokaro");
return View(data);
}
// LINQ
public ActionResult GetBokaroStudentLINQ()