Skip to content

Instantly share code, notes, and snippets.

Working from home

Rahul Nath rahulpnath

Working from home
View GitHub Profile
rahulpnath / Program.cs
Created May 9, 2021
Connect to Local instance of DynamoDB
View Program.cs
using System;
using System.Threading.Tasks;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.DataModel;
using Amazon.Runtime;
using ConsoleTables.Core;
namespace dynamodb_local_sample
class Program
rahulpnath /
Last active Apr 27, 2022
Cypress Azure AD Login
rahulpnath / TypeScriptSumTypes.jsx
Created Feb 23, 2020
Using Sum Types to Model Data
View TypeScriptSumTypes.jsx
import * as React from "react";
import { render } from "react-dom";
const styles = {
margin: "10px"
export type PaymentOption = FullPaymentOption | PartPaymentOption;
export interface FullPaymentOption {
type: "full";
rahulpnath / dynamicPowershellAlias.ps1
Last active Dec 6, 2019
Create dynamic alias for Powershell
View dynamicPowershellAlias.ps1
$aliasFilePath = "<Alias file path>"
function New-CommandAlias {
$functionFormat = "function $commandName { & $command $args }
View powershell_alias.ps1
function Get-GitStatus { & git status -sb $args }
New-Alias -Name s -Value Get-GitStatus -Force -Option AllScope
function Get-GitCommit { & git commit -ev $args }
New-Alias -Name c -Value Get-GitCommit -Force -Option AllScope
function Get-GitAdd { & git add --all $args }
New-Alias -Name ga -Value Get-GitAdd -Force -Option AllScope
function Get-GitTree { & git log --graph --oneline --decorate $args }
rahulpnath / SqlRenameTableScript.fsx
Last active Nov 29, 2019
GIven an old tableName and newTableName and database details, the script generates a SQL script file to drop create all Index, Constraints. This script is useful if you use convention based naming for tables and the associated Index and Keys and want them all renamed.
View SqlRenameTableScript.fsx
#I @"C:\Program Files\Microsoft SQL Server\140\SDK\Assemblies\";;
#I @"C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies";;
#r "Microsoft.SqlServer.Smo.dll";;
#r "Microsoft.SqlServer.ConnectionInfo.dll";;
#r "Microsoft.SqlServer.Management.Sdk.Sfc.dll";;
open System.IO
open Microsoft.SqlServer.Management.Smo
rahulpnath / EFMIgrationHistoryDecode
Created Jun 21, 2018
EF Decode Migration History
View EFMIgrationHistoryDecode
void Main()
//SELECT @binaryContent = Model FROM[__MigrationHistory] where MigrationId = ''
//SELECT CAST('' AS XML).value('xs:base64Binary(sql:variable(''@binaryContent''))', 'varchar(max)') AS base64Content
var modelBase64 = "<base64Content>";
var bytes = Convert.FromBase64String(modelBase64);
var uncompressed = Decompress(bytes);
var edmx = Encoding.UTF8.GetString(uncompressed);
rahulpnath / Remove Nuget Restore.ps1
Last active Oct 18, 2018
This powershell script helps remove all NuGet configurations and files that got added while enabling NuGet Restore. More details @
View Remove Nuget Restore.ps1
# This powershell script helps remove all NuGet configurations and files that got added while enabling NuGet Restore.
# More details @
$importNugetTargetsTag= [regex]::escape(@'
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
$restorePackagesTag = '<RestorePackages>.*?</RestorePackages>'
$nuGetPackageImportStamp = '<NuGetPackageImportStamp>.*?</NuGetPackageImportStamp>'
View IValueConverter.markdown
View INotifyCollectionChanged.markdown