Skip to content

Instantly share code, notes, and snippets.

View hussnainsheikh's full-sized avatar
🎯
Focusing

Sheikh Hussnain hussnainsheikh

🎯
Focusing
View GitHub Profile
@hussnainsheikh
hussnainsheikh / ffmpeg-watermark.md
Created July 24, 2024 06:55 — forked from bennylope/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

@hussnainsheikh
hussnainsheikh / ftp_download.php
Created July 11, 2024 02:49
Connect FTP server through PHP using "league/flysystem-ftp" package and download file(s).
<?php
/**
*
* I am using `league/flysystem-ftp` package for it
* so make sure you install it before using this code.
* if you are using composer then you can simply install
* it using command `composer require league/flysystem-ftp:^3.0`
* check the latest version on the package documentation.
*
@hussnainsheikh
hussnainsheikh / random_numbers.php
Created December 1, 2023 00:12
Recursion to generate random numbers within range with no duplicate
/** generate an array of random
* numbers within given range
**/
function generateRandom($end, $total, $start = 0, $numbers = [])
{
if(count($numbers) == $total) {
return $numbers;
}
$number = rand($start, $end);
@hussnainsheikh
hussnainsheikh / wordpress_sitemaps.php
Last active October 29, 2022 22:06
Create separate sitemaps in WordPress for all the activated languages in WPML.
<?php
function sitemaps() {
/* get all the activated languages in WPML plugin */
$languages = apply_filters( 'wpml_active_languages', NULL, array( 'skip_missing' => 0));
foreach((array)$languages as $lang) {
/* change language */
do_action('wpml_switch_language', $lang['code']);
@hussnainsheikh
hussnainsheikh / rename.py
Created September 6, 2022 00:07
Rename the *index.html* files in all directories, sub directories and remove the directories and sub directories.
import os
def getListOfFiles(dirName):
# create a list of file and sub directories
# names in the given directory
listOfFile = os.listdir(dirName)
allFiles = list()
# Iterate over all the entries
for entry in listOfFile:
print(entry)
@hussnainsheikh
hussnainsheikh / json_to_csv.py
Created November 25, 2021 01:44
Python code to converts JSON data into CSV. Please change your dict obj according to your JSON data. Keep sharing!
import json
import csv
# Opening JSON file
f = open('productfeed.json')
# returns JSON object as
# a dictionary
data = json.load(f)
@hussnainsheikh
hussnainsheikh / delete_older_than.php
Last active November 15, 2023 07:23 — forked from tdebatty/delete_older_than.php
A simple PHP function to delete files older than a given age. **Updated to delete files in subdirectories.**
<?php
/**
* A simple function that uses mtime to delete files older than a given age (in seconds)
* Very handy to rotate backup or log files, for example...
*
* $dir String whhere the files are
* $max_age Int in seconds
* return String[] the list of deleted files
*/
@hussnainsheikh
hussnainsheikh / table-liquid.liquid
Last active November 25, 2021 01:45
Shopify: Show product Metafields on Product page in Table
{%- comment -%} Metafields {%- endcomment -%}
{%- if product.metafields.xojson != blank -%} //change "xojson" with your scope of metafields, can be global or something else which you defined while creating them.
<div class="row container" id="Specifications">
<header class="section__header column small-12">
<h3 class="section__title heading h3">Product Attributes</h3>
</header>
<div class="row">
<div class="columns medium-6 small-12 tooltip-container">
<table role="presentation" style="width: 80%;background: #fff;border: solid 1px #ddd;margin-bottom: 1.25rem;table-layout: auto;">
<tbody>
@hussnainsheikh
hussnainsheikh / Lamp-stack on ubuntu with SSL on apache
Last active August 8, 2020 02:01
Install lamp-stack on Ubuntu with virtual host and SSL with certbot on apache. If you are facing any issue while installing ask me. Thank you!
#install lamp-stack by tasksel
sudo apt update && sudo apt upgrade
sudo apt install tasksel
sudo tasksel install lamp-server
#install phpmyadmin
sudo apt-get install -y phpmyadmin
#create db_user and grant access
@hussnainsheikh
hussnainsheikh / gcc-5.4.0-install.sh
Created October 13, 2019 12:06 — forked from jdhao/gcc-5.4.0-install.sh
The script will install GCC 5.4.0 on your CentOS 7 system, make sure you have root right. See https://jdhao.github.io/2017/09/04/install-gcc-newer-version-on-centos/ for more details.
echo "Downloading gcc source files..."
curl https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O
echo "extracting files..."
tar xvfj gcc-5.4.0.tar.bz2
echo "Installing dependencies..."
yum install gmp-devel mpfr-devel libmpc-devel -y
echo "Configure and install..."