Skip to content

Instantly share code, notes, and snippets.

View CupCodeIr's full-sized avatar
🎯
Focusing

Artin CupCodeIr

🎯
Focusing
View GitHub Profile
@CupCodeIr
CupCodeIr / npz_to_image.py
Last active October 4, 2022 12:41
Extract NPZ file which contains images as torch compatible arrays and save as actual image files
"""A python script to convert Numpy NPZ files containing torch-compatible shaped arrays of images
You can run this file with command:
python npz_to_to_image.py [PATH_TO_NPZ_FILE] [PATH_TO_DESTINATION_FOLDER] [IMAGE_EXTENSION]
"""
import os
import numpy as np
import argparse
from tqdm import tqdm
@CupCodeIr
CupCodeIr / woocommerce-disallow-adding-specific-products-with-others-to-cart.php
Created September 11, 2022 18:34
Limit WooCommerce Cart to include only one of the specific products and nothing else
<?php
/**
* Return if product can be added to the cart
* @param $valid
* @param $product_id
* @return bool
*/
function avoid_special_products_mix($valid, $product_id): bool