Posts

How to Square Images Without Cropping or Downscaling with FFmpeg

Image
set -xef input=$1 dirpath=$(dirname "$input") file_name=$(basename "$input") file_ext="${file_name##*.}" file_name="${file_name%.*}" blurred="$dirpath/blurred-$file_name.$file_ext" output="$dirpath/output-$file_name.$file_ext" width=$(ffprobe -v error -select_streams v:0 -show_entries stream=width -of csv=p=0 "$input") height=$(ffprobe -v error -select_streams v:0 -show_entries stream=height -of csv=p=0 "$input") longer_side="$height" diff_side=$(($height - $width)) # Determine longer side if [ "$width" -gt "$height" ]; then longer_side="$width" diff_side=$(($width - $height)) fi # Calculate canvas dimensions with padding padding=$((50+$diff_side/2)) canvas_side=$((longer_side + 2 * padding)) ffmpeg -i "$input" -vf "scale=$(($canvas_side*2)):-1,gblur=sigma=15,crop=$canvas_side:$canvas_side" -y "$blurred" ffmpeg -i "$...

Transliterate Script: Convert Text Across Multiple Languages with Ease

Image

SMS Counter: Automatically Detect Encoding, Character Count, and PDU!

Image

How to generate random string, username, password?

Image

Your Google Account Will Be Deleted

Image

How do I make an HTTP request in Javascript?

To make an HTTP request in JavaScript, you can use the `XMLHttpRequest` object, or more commonly nowadays, use the `fetch` API, which provides a more modern and simpler way to handle HTTP requests. Using the Fetch API (Recommended): The Fetch API is built into modern browsers and allows you to make network requests with a Promise-based approach. Here's how you can use it to make a simple HTTP GET request: // javascript // Making a GET request using Fetch API fetch('https://api.example.com/data') .then(response => response.json()) // Parse the response as JSON .then(data => { console.log(data); // Process the data returned by the server }) .catch(error => { console.error('Error:', error); }); You can also use `async/await` syntax to make it more readable: // javascript async function fetchData() { try { const response = await fetch('https://api.example.com/data'); const data = await response.json(); console.log(d...

PHP Basic Syntax and Variables: A Detailed Guide with Examples

Image
  Introduction: Understanding the fundamental concepts of PHP syntax and variables is essential for beginners. In this detailed blog post, we'll explore PHP syntax and variables in depth, providing you with clear explanations and practical examples to solidify your understanding. Table of Contents: 1. PHP Syntax Overview 2. Writing Your First PHP Script 3. Comments in PHP 4. PHP Variables 5. Variable Naming Conventions 6. Data Types in PHP 7. Assigning Values to Variables 8. Printing and Displaying Variables Let's dive into each section and explore PHP syntax and variables with detailed explanations and examples. 1. PHP Syntax Overview: PHP has a straightforward syntax. We'll cover the opening and closing PHP tags (`<?php` and `?>`), as well as basic structure and formatting guidelines for writing PHP code. 2. Writing Your First PHP Script: We'll walk you through writing your first PHP script step-by-step. You'll learn how to set up a development environment, ...