Skip to content

Instantly share code, notes, and snippets.

View dmanexe's full-sized avatar
:electron:
Reticulating splines

dmanexe dmanexe

:electron:
Reticulating splines
  • San Francisco, CA
  • 13:47 (UTC -07:00)
View GitHub Profile
@dmanexe
dmanexe / woocommerce-products.py
Created September 25, 2024 14:13
Python Example - WooCommerce Scrape
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))
@dmanexe
dmanexe / functions.php
Created May 20, 2024 12:19
WooCommerce custom new customer check
// 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>';
@dmanexe
dmanexe / functions.php
Last active April 25, 2024 09:43
WooCommerce New Customer Post-Purchase Check
// 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>';
@dmanexe
dmanexe / simple-barcodes.py
Created June 28, 2023 08:40
Simple python-barcodes generator
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/"
@dmanexe
dmanexe / mailhook.php
Created June 6, 2023 08:15
simple hook to check order notes
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();
@dmanexe
dmanexe / infinite_gpt.py
Created May 10, 2023 22:48
unlimited chatgpt input script
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()
@dmanexe
dmanexe / 3d-color-starfield.py
Created March 27, 2023 23:16
pygame 3d color starfield (demoscene!)
#!/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
@dmanexe
dmanexe / 1file-pdf2jpg.py
Created October 30, 2022 13:40
Single File Self Hosted Python PDF to JPG Conversion Script
# 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
@dmanexe
dmanexe / htpasswd.md
Created May 16, 2022 12:17
HOWTO Simple htpasswd and apache conf / htaccess

1. Generate password file

htpasswd -c /etc/apache2/htpasswd user

2. Inside .htaccess/conf file:

<Directory /var/foo>
  Authtype Basic
  Authname "Sacred Garden"
 AuthUserFile /etc/apache2/htpasswd
@dmanexe
dmanexe / httpd-vhosts.conf
Last active April 22, 2019 07:24
AWS Lightsail with Bitnami - Apache Configuration
# 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