Skip to content

Instantly share code, notes, and snippets.

View ishar19's full-sized avatar
🥷
Stealth

ishar19 ishar19

🥷
Stealth
View GitHub Profile
const path = require('path');
const exec = require('child_process').exec;
function absoluteToRelative(absolutePath) {
// Normalize the paths to remove any unnecessary separators
// const normalizedAbsolutePath = path.normalize(absolutePath);
const currentPath = path.normalize(process.cwd());
const relativePath = path.relative(currentPath, absolutePath);
return relativePath;
}
@ishar19
ishar19 / gist:3ee43064b0aa25c039e6ba6f0dcd1d74
Created July 20, 2024 17:56
code to get duration of a video
const { execFile } = require('child_process');
const { promisify } = require('util');
const execFilePromise = promisify(execFile);
async function getVideoDuration(filePath) {
try {
const { stdout } = await execFilePromise('ffprobe', [
'-v',
'error',
//MAP METHOD
// Define an array of numbers
const numbers = [1, 2, 3, 4, 5];
// Use the map method to create a new array with the squares of the numbers
const squares = numbers.map(number => number * number);
// Log the original array and the new array to the console
console.log("Original array:", numbers);
console.log("Squared array:", squares);
This file has been truncated, but you can view the full file.
data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEASABIAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWFlaIAAAAAAAAPNRAAEAAAABFsxYWVogAAAAAAAAAAAAAAAAAAAAAFhZWiAAAAAAAABvogAAOPUAAAOQWFlaIAAAAAAAAGKZAAC3hQAAGNpYWVogAAAAAAAAJKAAAA+EAAC2z2Rlc2MAAAAAAAAAFklFQyBodHRwOi8vd3d3LmllYy5jaAAAAAAAAAAAAAAAFklFQyBodHRwOi8vd3d3LmllYy5jaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkZXNjA
@ishar19
ishar19 / barChart.json
Created November 23, 2023 19:16
barChart
[
{ category: "Category A", value: 30 },
{ category: "Category B", value: 50 },
{ category: "Category C", value: 70 },
{ category: "Category D", value: 40 },
{ category: "Category E", value: 60 },
// Add more data as needed
];