Skip to content

Instantly share code, notes, and snippets.

View mubbashar's full-sized avatar

Mubbashar Husain mubbashar

View GitHub Profile
@mubbashar
mubbashar / judge_csv_column_type.py
Created September 13, 2023 06:19
This Will determine the data type of each Column in CSV file
import pandas as pd
import re
import os
def guess_column_types(file_path, delimiter=',', has_headers=True):
try:
# Read the CSV file using the specified delimiter and header settings
df = pd.read_csv(file_path, sep=delimiter, header=0 if has_headers else None)
@mubbashar
mubbashar / JsonHelper.php
Created February 26, 2020 05:39
PHP Code to write JSON file
<?php
public function writeJsonFile($jsonFileNamePath, $jsonData)
{
if (file_exists($jsonFileNamePath) ) {
preg_match('/^\[(.+)\]$/', $jsonData, $removeBracket);
$jsonFileHandle = fopen($jsonFileNamePath, 'c');
// move back a byte
fseek($jsonFileHandle, -1, SEEK_END);
$pointerPosition = ftell($jsonFileHandle);
@mubbashar
mubbashar / gist:8fbff377d5b889b1233401c8ca965c24
Created November 3, 2017 07:04
FFMPEG amix filter not found
I tried complied binary by https://www.johnvansickle.com/ffmpeg/
./ffmpeg -y -i video-orignal.mp4 -i 1.mp3 -i 2.mp3 -filter_complex "[0:v] pad=width=iw:height=ih+200:x=0:y=100:color=#f2e6e6@0.99 [v_1];[1:a]atrim=0:11,adelay=6000|6000[1a];[2:a]atrim=0:15,adelay=130000|130000[2a];[1a][2a]amix‌​=2[aout]" -map "[v_1]" -map "[aout]" video-final.mp4
ffmpeg version 3.4-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.4.0 (Debian 6.4.0-7) 20170920
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora
@mubbashar
mubbashar / supervisor.config
Created February 3, 2017 10:38
supervisor.config on beanstalk
packages:
yum:
openssl-devel: []
python27-setuptools: []
container_commands:
01-supervise:
command: "chmod +x .ebextensions/supervise.sh"
02-supervise:
command: ".ebextensions/supervise.sh"
@mubbashar
mubbashar / JSON2CSV.php
Last active August 17, 2016 12:49
PHP JSON TO CSV Listener using salsify/jsonstreamingparser
<?php
namespace App\Test\JSONListener;
use \JsonStreamingParser\Listener;
class JSON2CSV implements Listener
{
private $_current_row;
private $_outfile;
private $_key;