Skip to content

Instantly share code, notes, and snippets.

View foyzulkarim's full-sized avatar
🚀
building awesome stuffs

Foyzul Karim foyzulkarim

🚀
building awesome stuffs
View GitHub Profile
@foyzulkarim
foyzulkarim / timezone-finder.js
Created February 10, 2025 03:05
This file contains a list of timezones and their corresponding cities. It also includes functions to get the GMT offset and find the closest timezone based on a target hour.
/**
* This file contains a list of timezones and their corresponding cities.
* It also includes functions to get the GMT offset and find the closest timezone based on a target hour.
*/
// Define 24 hour timezones and their cities
const timezones = [
// Americas (West to East)
{ city: "Honolulu", timezone: "Pacific/Honolulu", gmt: "GMT-10" },
{ city: "Anchorage", timezone: "America/Anchorage", gmt: "GMT-9" },
@foyzulkarim
foyzulkarim / readme.md
Last active February 5, 2025 05:05
# Text-to-Speech Pipeline with Kokoro TTS A Python script that converts text into natural-sounding speech using the Kokoro TTS engine. The script processes a transcript file, generates speech segments, and merges them into a single audio file. ## Features: - Reads text from a transcript file - Generates speech segments with customizable voice an…

Text-to-Speech Pipeline with Kokoro TTS

A Python script that converts text into natural-sounding speech using the Kokoro TTS engine. The script processes a transcript file, generates speech segments, and merges them into a single audio file.

Features:

  • Reads text from a transcript file
  • Generates speech segments with customizable voice and speed settings
  • Saves individual audio segments and their corresponding text
  • Merges all audio segments into a single WAV file using FFmpeg
  • Organizes output in timestamped directories
@foyzulkarim
foyzulkarim / usages.js
Created March 3, 2024 12:10
Simplify Express.js Validation: Sync Joi and Mongoose Schemas
const viewModelProps = {
title: { type: String, isRequired: true, minLength: 5, unique: true, index: true },
category: { type: String, isRequired: true },
}
// in mongoose
const videoSchema = new mongoose.Schema({
...generateSchema(true, viewModelProps),
duration: {
type: Number,
@foyzulkarim
foyzulkarim / index.js
Created July 14, 2021 15:55
Webinar on Node.js : Express.js handle 200K+ request in 10seconds using Cluster and PM2
const express = require('express')
var numCPUs = require('os').cpus().length;
const cluster = require('cluster');
const app = express()
app.get('/', (req, res) => {
res.send('Hello World!')
});
@foyzulkarim
foyzulkarim / Program.cs
Created September 8, 2018 03:51
Data Migration using Threading in C#
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Dynamic;
using System.Threading;
using System.Threading.Tasks;
using System.Transactions;
using Core = BizBookCoreDbModelLibrary;
using BizBookDbModelLibrary;
@foyzulkarim
foyzulkarim / AzureSigninFunction.cs
Created April 20, 2018 10:50
Azure Function is used here as ASP.NET Identity Token provider for SPA Applications. Then this token will be used for other secured API calls, eg. saving a Sale entity to database
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
namespace FunctionApp1
{
@foyzulkarim
foyzulkarim / Get Text From PDF using C# and iTextSharp
Created February 9, 2018 15:25
One of my clients who is currently using BizBook, used Wave for some months, but while they grew bigger, wave stopped supporting to download the invoices as a bulk excel or csv. So, when they decided to jump into BizBook, then they had to export their all existing data into my system. Since the wave didn’t allow csv / excel anymore, so I had no …
private static IEnumerable<string> GetTextFromPDF(string invoicePdf)
{
var fromPdf = new List<string>();
using (PdfReader reader = new PdfReader(invoicePdf))
{
for (int i = 1; i <= reader.NumberOfPages; i++)
{
string value = PdfTextExtractor.GetTextFromPage(reader, i);
List<string> list = value.Split(new[] { "\n" }, StringSplitOptions.None).ToList();
list.RemoveAll(Match);
@foyzulkarim
foyzulkarim / BaseReportService.cs
Created February 4, 2018 18:15
Create default instance of the provided type
public class BaseReportService
{
protected T CreateDefault<T>(Type t, string shopId) where T : BaseReport
{
var report = Activator.CreateInstance(t) as BaseReport;
report.Id = Guid.NewGuid().ToString();
report.Created = DateTime.Now;
report.Modified = DateTime.Now;
report.CreatedBy = "System";
report.ModifiedBy = "System";
<button type="button" class="btn btn-inline" ng-click="vm.back()"><</button>
<button type="button" class="btn btn-inline" ng-click="vm.print()">Print</button>
<button type="button" class="btn btn-inline" ng-click="vm.downloadPdf('receipt')">Pdf</button>
<div class="container-fluid" id="receipt" style="background: white">
<style type="text/css">
.invoice-title h2, .invoice-title h3 {
display: inline-block;
}
.table > tbody > tr > .no-line {
@foyzulkarim
foyzulkarim / AuthorizationController.cs
Created August 22, 2017 16:12
Role-Based-Access-Control Authorization Logic based on ASP.NET Identity and System.Runtime.Caching.MemoryCache
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Net.Http;
using System.Runtime.Caching;
using System.Web.Http;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;