Skip to content

Instantly share code, notes, and snippets.

View krishnaanaril's full-sized avatar
🎯
Focusing

Krishna Mohan krishnaanaril

🎯
Focusing
View GitHub Profile
@krishnaanaril
krishnaanaril / test-repetition.ps1
Last active June 22, 2020 12:31
Powershell script to repeat the testing certain number of times. This is to find the errors caused by the numbers generated in random/inputs generated in random.
$count = 0
do {
$count = $count + 1
Write-Host "Testing: "+$count
$result = dotnet test .\Sample.csproj --filter "FullyQualifiedName=Test_Namespace.Test_Name" --nologo --no-build
} while(($result.ExitCode -ne 0) -and ($count -lt 50))
@krishnaanaril
krishnaanaril / Screenshot.cs
Created March 24, 2021 17:20
Snippet for generating image from a html element using puppeteer-sharp.
var t = Task.Run(async () =>
{
_ = await new BrowserFetcher().DownloadAsync("848005");
var url = "file:///C:/KrishnaMohan/Learning/tailwind/tailwind-npm/banner/banner.html";
var outputFile = ".\\somepage02.png";
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true,
DefaultViewport =
{
@krishnaanaril
krishnaanaril / file-download-from-fetch.js
Created March 1, 2023 05:18
Download response.data as a file, through Blob()
// Reference: https://gist.github.com/davalapar/d0a5ba7cce4bc599f54800da22926da2
export function downloadFile(data, filename, mime) {
// It is necessary to create a new blob object with mime-type explicitly set
// otherwise only Chrome works like it should
const blob = new Blob([data], {type: mime || 'application/octet-stream'});
if (typeof window.navigator.msSaveBlob !== 'undefined') {
// IE doesn't allow using a blob object directly as link href.
// Workaround for "HTML7007: One or more blob URLs were
// revoked by closing the blob for which they were created.
@krishnaanaril
krishnaanaril / audio-caption.html
Created March 5, 2023 11:24
POC for displaying audio with captions and subtitles
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Podcast</title>
</head>
<script src="https://cdn.tailwindcss.com"></script>