Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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
@devlifeX
devlifeX / ovpn.sh
Last active December 12, 2020 22:58
Easy Setup And Run OpenVPN Server with docker compose, Using Same profile for multiple connections. Easy Setup! Enjoy :)
# Requiremnts: Docker, Docker Compose a Server with 256 MB Of RAM.
# If you neeed Install docker and docker compose on ubuntu (tested on ubuntu 16) use this gist: https://gist.github.com/devlifeX/be64df7608e08853aad995c65872df59
# 1) Put the content in ovpn.sh
# 2) chmod +x ovpn.sh
# 3) execute like this: ./ovpn.sh xxx.xxx.xxx.xxx (xxx's is your ip or domain address)
BASE=/home/$(whoami)
CONFIG="$BASE/openvpn-data/conf/openvpn.conf"
mkdir -p $BASE
cd $BASE
@devlifeX
devlifeX / .bashrc
Last active December 25, 2020 15:50
Append These code to your .bashrc and make your life easier!
# Docker section ################################################
# - Stop all running docker containers
function stopAll {
containers=$(docker ps -qa)
if [ ! -z "$containers" ]
then
echo $containers | xargs docker container rm -f $1
else
echo "No Containers for remove!" | grep -e "."
@devlifeX
devlifeX / import-listing.php
Last active October 9, 2020 07:20
Listing_Import for import data from listing theme wordpress
class Listing_Import
{
public function __construct()
{
if (
isset($_GET['task']) &&
$_GET['task'] === "import"
) {
add_action('init', [$this, 'doAction']);