htpasswd -c /etc/apache2/htpasswd user
<Directory /var/foo>
Authtype Basic
Authname "Sacred Garden"
AuthUserFile /etc/apache2/htpasswd
| import requests | |
| from requests.auth import HTTPBasicAuth | |
| # WooCommerce API credentials | |
| api_url = "https://yourwebsite.com/wp-json/wc/v3/products" | |
| consumer_key = "your_consumer_key" | |
| consumer_secret = "your_consumer_secret" | |
| # Make the GET request | |
| response = requests.get(api_url, auth=HTTPBasicAuth(consumer_key, consumer_secret)) |
| // This goes into your theme's functions.php file | |
| function display_new_customer_status() { | |
| if (is_wc_endpoint_url('order-received')) { | |
| global $wpdb; | |
| $user_email = get_post_meta(get_query_var('order-received'), '_billing_email', true); | |
| // echo '<p>User Email: ' . $user_email . '</p>'; |
| // the point here is to check if the customer is new, and if so, display a <p> with class new-customer, so JS can see visiblity on it. | |
| function display_new_customer_status() { | |
| if (is_wc_endpoint_url('order-received')) { | |
| global $wpdb; | |
| $user_email = get_post_meta(get_query_var('order-received'), '_billing_email', true); | |
| // echo '<p>User Email: ' . $user_email . '</p>'; |
| from barcode import Code39 | |
| from barcode.writer import ImageWriter | |
| # import ./litfarms-skus.csv and loop through each line, creating a EAN14 barcode for each line, saving the filename as the SKU number | |
| # this will be used to generate a barcode for each SKU number | |
| with open("./litfarms-skus.csv") as csv: | |
| for line in csv: | |
| line = line.rstrip('\n') | |
| barcode = Code39(line, writer=ImageWriter(), add_checksum=False) | |
| cwd = "X:/_DEV/_SINGLES/barcodes/" |
| function my_custom_order_note_action($note_id, $args) { | |
| $order_id = $args['order_id']; | |
| $order = wc_get_order($order_id); | |
| $note = $order->get_note($note_id); | |
| $note_content = $note->content; | |
| // Check if the note content contains "Order is shipped" | |
| if (strpos($note_content, 'Order is shipped') !== false) { | |
| // Get the customer's email address | |
| $customer_email = $order->get_billing_email(); |
| import openai | |
| from concurrent.futures import ThreadPoolExecutor | |
| # Add your own OpenAI API key | |
| openai.api_key = "sk-XXXXXXXXXXXXXXXXXXXXX" | |
| def load_text(file_path): | |
| with open(file_path, 'r') as file: | |
| return file.read() |
| #!/usr/bin/python3 | |
| # 2023 / @soupisgood | |
| # Took some code from @gunny26/python-demoscene and added color to a classic starfield demoscene effect. | |
| import sys | |
| import pygame | |
| import random | |
| from Vec2d import Vec2d |
| # 1file-pdf2jpg.py | |
| # README: drop into folder of PDFs and run it <3 | |
| from multiprocessing import Pool | |
| import glob | |
| from pdf2image import convert_from_path, convert_from_bytes | |
| from pdf2image.exceptions import ( | |
| PDFInfoNotInstalledError, | |
| PDFPageCountError, | |
| PDFSyntaxError |
| # After install, don't forget to configure apache | |
| # Bitnami Lightsail Apache config file for easy virtual hosts... | |
| # ...located @ /opt/bitnami/apache2/conf/extra/httpd-vhosts.conf | |
| # --- Sample httpd-vhosts.conf --- | |
| # [where] wp_container is your WP environment wrapper | |
| <VirtualHost _default_:80> | |
| DocumentRoot /opt/bitnami/apps/wp_container/example.com/wordpress | |
| ServerName example.com |