Skip to content

Instantly share code, notes, and snippets.

View shashank-shekhar's full-sized avatar
👋

Shashank Shekhar shashank-shekhar

👋
View GitHub Profile
@shashank-shekhar
shashank-shekhar / upload.js
Created November 21, 2020 00:37 — forked from virolea/upload.js
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@shashank-shekhar
shashank-shekhar / android-emulator-hosts.bat
Created December 2, 2020 19:25
Add custom domains to android emulator hosts
#Start emulator in write-only mode
C:\Program Files (x86)\Android\android-sdk\emulator>emulator -avd pixel-3 -writable-system
# Pull the existing hosts file to your local machine:
adb root
adb remount
adb pull /system/etc/hosts c:\temp\hosts
# Edit your hosts file e.g.
10.0.2.2 local.mysite.com
{"lastUpload":"2022-07-26T21:23:47.449Z","extensionVersion":"v3.4.3"}
@shashank-shekhar
shashank-shekhar / Clean-IISExpress.ps1
Created August 24, 2021 21:24 — forked from omidkrad/Clean-IISExpress.ps1
Delete IISExpress sites using PowerShell
Set-Alias appcmd "$env:ProgramFiles\IIS Express\appcmd.exe"
appcmd list site /text:SITE.NAME | % { appcmd delete site $_ }
# or remove IISExpress directory
Remove-Item -Recurse $env:USERPROFILE\Documents\IISExpress
@shashank-shekhar
shashank-shekhar / Cert.ps1
Last active August 24, 2021 21:25
Create self signed certificate using poweshell
New-SelfSignedCertificate -Type SSLServerAuthentication -DnsName 'local.mysite.com' -CertStoreLocation 'cert:\LocalMachine\My' -KeyExportPolicy Exportable -KeyAlgorithm RSA -KeyLength 4096
@shashank-shekhar
shashank-shekhar / HashSalt.cs
Created September 1, 2021 03:45
Hashing and Salting
private const int SALT_SIZE = 24; // size in bytes
private const int HASH_SIZE = 24; // size in bytes
private const int ITERATIONS = 100000; // number of pbkdf2 iterations
private static string CreateHash(string input, string salt)
{
// Generate a salt
var saltBytes = Convert.FromBase64String(salt);
// Generate the hash
@shashank-shekhar
shashank-shekhar / privacy.md
Created January 15, 2022 02:12
WBC Staff privacy policy

Privacy policy

This app does not collect any personally identifiable information and is designed for the sole use by staff and volunteers of Wilderness Basics Course Sierra Club San Diego Chapter.

@shashank-shekhar
shashank-shekhar / CreateIISSite.ps1
Created January 17, 2022 22:34
Create an IIS site, accopanying self signed certificate, and update hosts
# This scripts create an IIS site with an SSL Certificate assigned to it
$siteName = 'sitename'
$sitepath = 'path to project'
Write-Host "Starting Site Creation for $siteName"
# Create Certificate
New-SelfSignedCertificate -Type SSLServerAuthentication -DnsName $siteName -CertStoreLocation 'cert:\LocalMachine\My' -KeyExportPolicy Exportable -KeyAlgorithm RSA -KeyLength 4096
New-WebAppPool -Name $siteName
for /d /r . %%d in (bin,obj,packages) do @if exist "%%d" rd /s/q "%%d"
dotnet new classlib -f netcoreapp3.1 -o Project.Name
dotnet add package Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite -v 3.1.19
dotnet add package Microsoft.EntityFrameworkCore.SqlServer -v 3.1.19
dotnet add package Microsoft.EntityFrameworkCore.Design -v 3.1.19
dotnet ef dbcontext scaffold "Server=.;Database=<DataBase>;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o Models --schema dbo