Skip to content

Instantly share code, notes, and snippets.

@ybagheri
ybagheri / recursively_array.php
Created August 19, 2017 09:34
Apply a user function recursively to every member of an array
<?php
//your array
$data = array(
'a' => '"Hello World"',
'b' => "'Hello World'",
'c' => "Hello 'Worl\"d",
'd' => array(
'A' => 'H"e"l"l"o" "W"o"r"l"d'
)
);
@ybagheri
ybagheri / ffmpeg_install.md
Last active October 18, 2017 12:58 — forked from jmsaavedra/ffmpeg_install.md
Install FFmpeg on a Linux Box

###Install FFmpeg via CLI on Linux box

These steps walk through installing a static binary of any ffmpeg version on to your linux machine. If you want to compile from source, there are several ways to do so. Here's the official guide. Tested and works on an AWS EC2 Ubuntu instance, but should work on any Linux machine.

  • SSH into your instance and become root
@ybagheri
ybagheri / gist:08ae21e71babec393e5ff4ca69494a7b
Last active October 16, 2017 07:57
PHP 7.0 on CentOS/RHEL 6.9 and 7.4 via Yum
PHP 7.0 on CentOS/RHEL 6.9 and 7.4 via Yum
ref: https://webtatic.com/packages/php70/
CentOS/RHEL 7.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOS/RHEL 6.x:
@ybagheri
ybagheri / gist:55c816ad0c2c63e77da5f74e292f416b
Last active October 17, 2017 06:22
install lua in php7 centos
sudo su -
yum install yum-utils
# you can get last version of lua : http://pecl.php.net/package/lua
wget http://pecl.php.net/get/lua-2.0.4.tgz
tar -xvzf lua-2.0.4.tgz
@ybagheri
ybagheri / gist:e17874e53b33abb28649a60ba63223b7
Last active January 2, 2018 10:07
Cron job check mysql for run php script and run every 5 second
# check mysql for run php script
if [ $(mysql -u MYSQL_USER -pMYSQL_PASSWORD -Bse "SELECT flag FROM DATABASE_NAME.TABLE_NAME where id=1") == "1" ]; then
curl --silent "http://example.com" >/dev/null 2>&1
fi
# Cronjob every 5 second
# Preperation for https://github.com/vysheng/tg
# If error occurs while installation, try
# yum update kernel
# yum update
sudo su -
yum groupinstall 'Development Tools'
yum install readline-devel
yum install libconfig-devel
yum install libevent-devel
@ybagheri
ybagheri / unrar.txt
Last active December 29, 2017 07:07
Unzip p7zip 7za Unrar rar Centos 6.5
# installing Unrar
sudo su -
cd /usr/local/src
wget http://www.rarlab.com/rar/rarlinux-x64-5.2.1.tar.gz
tar zxvf rarlinux-x64-5.2.1.tar.gz
cp rar/unrar /usr/local/bin
# Install unrar on Ubuntu
# apt-get install unrar-free
@ybagheri
ybagheri / bot01.php
Last active October 15, 2019 05:58
extract unzip unrar add watermark upload Telegram madelineproto
<?php
// ini_set('max_execution_time', 10);
set_time_limit ( 15 );
$servername = "localhost";
$db_username = "root1";
$password = "root1";
$dbname = "root1";
$caption = '@UnzipUploadTelegramBot';
$pass = "www.irlanguage.com";
$user_id='';
sudo su -
#visit this gist: https://gist.github.com/ybagheri/08ae21e71babec393e5ff4ca69494a7b
#and install it.
# and https://centos.pkgs.org/6/atomic-x86_64/atomic-release-1.0-21.el6.art.noarch.rpm.html
yum install yum-utils
yum install gcc
@ybagheri
ybagheri / updateBotCallbackQuery.php
Created December 16, 2017 03:54
inline_keyboard reply_markup updateBotCallbackQuery
<?php
$reply_markup = ['inline_keyboard' => [
[ // Row 1
['text' => 'Row 1 c1',"callback_data" => "myCallbackData_11"],
['text' => 'Row 1 c2',"callback_data" => "myCallbackData_12"],
['text' => 'Row 1 c3',"callback_data" => "myCallbackData_13"],
],
[ // Row 2
['text' => 'Row 2 c1',"callback_data" => "myCallbackData_21"],
['text' => 'Row 2 c2',"callback_data" => "myCallbackData_22"],