Skip to content

Instantly share code, notes, and snippets.

View gladx's full-sized avatar
🕺
Coding ...

Ali Yousefi gladx

🕺
Coding ...
View GitHub Profile
@gladx
gladx / rclone.md
Last active September 20, 2023 00:31
Rclone example commands

Rclone Simple Example Commands

Copy

-P show proggress

rclone copy -P -v --multi-thread-streams=10 remote-230:/root/a ~/Videos/

Config

@gladx
gladx / phpmyadmin-config.md
Created July 20, 2022 23:00
Install phpmyadmin and set random hash config.inc.php

openssl rand -base64 32 // config.inc.php $cfg['blowfish_secret'] = 'BX0pgCsYvLhoohqKaUgdTzr5T+Na0n/tKvat4i9bGfc=';

// .bashrc alias phpmyadmin="php8.0 -S localhost:8081 -t /home/user/tools/phpmyadmin"

@gladx
gladx / gitup.sh
Created July 4, 2022 12:48
get git update last changes
#!/bin/bash
# gitup.sh
# gitup.sh HEAD
# gitup.sh HEAD~3
if [ ! -z "$1" ] ; then
echo "Createing ../update.zip "
git diff --name-only "$1" --diff-filter=d
git archive -o ../update.zip HEAD $(git diff --name-only "$1" --diff-filter=d)
sshuttle --dns -r ubuntu@130.250.10.5 -x 130.250.10.5 0/0
if(responseCode.code === 200){
var jsonData = JSON.parse(responseBody);
//postman.setEnvironmentVariable("usertoken1", jsonData.data.token);
pm.collectionVariables.set("token", jsonData.data.token)
}
@gladx
gladx / api-platform-code-coverage-help.md
Created July 13, 2021 07:50
Manual setup xdebug and phpunit coverage code in api-platform with docker
docker exec  -it  project_name_xxx_php_1 sh

apk add --no-cache --virtual .build-deps $PHPIZE_DEPS;
pecl install xdebug-3.0.2;
docker-php-ext-enable xdebug;

pecl install pcov
composer require --dev pcov/clobber
vi /usr/local/etc/php/php.ini
# php install
## apt
sudo add-apt-repository ppa:ondrej/php
## set other version
sudo update-alternatives --config php
// sudo update-alternatives --set php /usr/bin/php7.1
apt-get install -y \
php8.2-cli php8.2-dev \
@gladx
gladx / .htaccess
Created October 18, 2020 23:36
.htaccess with redirect to https
RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php
# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
@gladx
gladx / 1-7 new php.php
Last active January 1, 2018 20:56
how get 1th and 7th day of week in persian
/**
* ورودی تابع آبجکت DateTime است
* خروجی این متد تاریخ اول و آخر هفته است
* اول هفته شنبه و آخر هفته جمعه
* خروجی نمونه
* [
* 'from' => 2018-1-6,
* 'to' => 2018-1-12
* ]
*/
how detect system ?
/usr/lib/systemd tells you you're on a systemd based system.
/usr/share/upstart is a pretty good indicator that you're on an Upstart-based system.
/etc/init.d tells you the box has SysV init in its history
----- OR
strings /sbin/init | grep -q "/lib/systemd" && echo SYSTEMD
strings /sbin/init | grep -q "sysvinit" && echo SYSVINIT
strings /sbin/init | grep -q "upstart" && echo UPSTART
----- OR
sudo stat /proc/1/exe