Skip to content

Instantly share code, notes, and snippets.

View ArmanTaheriGhaleTaki's full-sized avatar

Arman Taheri ArmanTaheriGhaleTaki

View GitHub Profile
@ArmanTaheriGhaleTaki
ArmanTaheriGhaleTaki / ffmpegautomate.cpp
Last active June 5, 2023 09:07
automation of the process of the naming the output file
#include <iostream>
#include <sys/stat.h>
#include <fstream>
void compress( char** input);
unsigned long long int fileSize(std::string fileNameWithextensionSTR);
void diffsize(std::string fileNameWithextensionSTR1,std::string fileNameWithextensionSTR2);
inline bool IsMP4FileExists (const std::string& name);
using namespace std;
int *argcGlobal=0;
int main(int argc, char **argv) {
@ArmanTaheriGhaleTaki
ArmanTaheriGhaleTaki / automatic_FFMPEG_script
Created July 29, 2022 04:03
this is a bash script that compress MP4 formatted videos in a folder automatically and name the output as [Videoname] _compressed.mp4
#!/bin/bash
VIDEOS=$(ls *.mp4)
for VIDEO in $VIDEOS
do
ffmpeg -i $VIDEO -vcodec libx265 -crf 28 -f mp4 ${VIDEO%%.*}_compressed.mp4
done
@ArmanTaheriGhaleTaki
ArmanTaheriGhaleTaki / irping.sh
Last active November 14, 2024 09:13
using https://check-host.net/check-ping ping API to check if a IP is accessible from Iran
irping() {
ip=$1
nodes=("ir1" "ir3" "ir5" "ir6")
for node in "${nodes[@]}"; do
# Make the API request and store the response
response=$(curl -s -H "Accept: application/json" "https://check-host.net/check-ping?host=${ip}&node=ir1.node.check-host.net&node=ir3.node.check-host.net&node=ir5.node.check-host.net&node=ir6.node.check-host.net")
# Check for "limit_exceeded" error in the response
error_message=$(echo "$response" | jq -r '.error')
if [ "$error_message" == "limit_exceeded" ]; then