Skip to content

Instantly share code, notes, and snippets.

@devlifeX
devlifeX / ro-titr.php
Created May 12, 2024 19:34
Add rotitr
<?php
/*
Plugin Name: Rotitr
Description: rotiter add new custom field to post area
Version: 1.0.0
Author: dariushvesal
Author URI: https://vesal.blog
*/
// don't load directly
@devlifeX
devlifeX / bulk-variation.php
Created April 17, 2024 15:17
The Bulk Set Variations Stock to Zero plugin provides a quick and efficient solution for managing stock levels in WooCommerce. This lightweight plugin enhances the WooCommerce bulk edit functionality, allowing you to easily set the stock quantity of all variations for a selected variable product to zero in just a few clicks.
<?php
/*
Plugin Name: Bulk Edit for variation products
Author: Dariush vesal
Plugin URI: https://vesal.blog
Description: Bulk Edit for variation products
Author URI: https://vesal.blog
Text Domain: bulk-variation
Version: 1.0.0
@devlifeX
devlifeX / compress_image_recursive.sh
Created January 8, 2022 19:14
Install imagemagick. then run this script to find jpg files recursively and compress them. of course you can adjust convert quality or etc.
#!/bin/bash
# You need to install `imagemagick`
# sudo apt install imagemagick
function compress_image {
cd "$1"
HAS_IMAGE=$(ls | grep ".jpg" | wc -l)
if [ "$HAS_IMAGE" -gt 0 ]; then
mkdir -p compress
@devlifeX
devlifeX / linux-setup.sh
Last active January 8, 2022 16:21
setup linux wit docker and other apps
echo "install some app"
sudo apt-get update
sudo apt-get -y install htop git
echo "Install shecan"
curl https://gist.githubusercontent.com/devlifeX/d2918f7af1d10409b5c82a52795b5c54/raw/0e098e5d1d90fb5e6fe74a1f52cb53953bfa076f/shecan.sh | sudo bash -
echo "install docker and docker-compose"
curl https://gist.githubusercontent.com/devlifeX/be64df7608e08853aad995c65872df59/raw/59401f9a980a869ff7cfedc1e1205d8bd2451fcc/docker-installer.sh | sudo bash -
@devlifeX
devlifeX / env.php
Created October 9, 2020 03:57
PHP ENV file handler, just include it and put .env file in your code, use like this: $_ENV['foot']; in your code.
<?php
class DotENV
{
private $options = [];
public function __construct($options)
{
$this->options = $options;
@devlifeX
devlifeX / docker-installer.sh
Last active September 18, 2021 00:50
Docker Installer - ubuntu 64bit
sudo apt-get update
sudo apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
echo "official GPG key"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@devlifeX
devlifeX / RASPAP.md
Last active May 6, 2021 08:06
RaspAP Instrcutions

Follow this repo installation:

Just download Raspberry Pi OS Lite 32Bit
https://www.raspberrypi.org/software/operating-systems/#raspberry-pi-os-32-bit

Download & Install etcher for OS Flash
https://www.balena.io/etcher/

https://github.com/RaspAP/raspap-webgui

@devlifeX
devlifeX / docker-proxy.sh
Created April 30, 2021 10:07
Docker proxy ubuntu
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/proxy.conf
echo '
[Service]
Environment="HTTP_PROXY=http://USERNAME:PASSWORD@IP:PORT"
Environment="NO_PROXY="localhost,127.0.0.1,::1"
' > /etc/systemd/system/docker.service.d/proxy.conf;
sudo systemctl daemon-reload
@devlifeX
devlifeX / p.sh
Created April 26, 2021 01:59
Fix wordpress permissions just in case
sudo chown -R www-data:www-data wp-content
sudo chown -R www-data:www-data wp-admin
sudo chown -R www-data:www-data wp-includes
sudo chown www-data:www-data index.php
sudo chown www-data:www-data wp-activate.php
sudo chown www-data:www-data wp-blog-header.php
sudo chown www-data:www-data wp-comments-post.php
sudo chown www-data:www-data wp-config.php
sudo chown www-data:www-data wp-cron.php
@devlifeX
devlifeX / dockerhub.sh
Created January 10, 2021 06:48
replace dockerhub.ir with docker hub default
sudo cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://dockerhub.ir"]
}
EOF
sudo systemctl restart docker