Skip to content

Instantly share code, notes, and snippets.

View numpde's full-sized avatar

numpde

View GitHub Profile
@numpde
numpde / issues.json
Created November 10, 2024 10:33
WA/TA: Typesense collection for an issue tracker
{
"name": "issues",
"fields": [
{
"name": "thread_id",
"type": "string",
"facet": true,
"optional": false,
"index": true,
"sort": false,
@numpde
numpde / wa-ts_collection_schema.json
Last active October 27, 2024 07:48
WA/TS: Typesense collection schema
{
"name": "wa_conversations",
"fields": [
{
"name": "contacts.wa_id",
"type": "string",
"facet": true,
"optional": false,
"index": true,
"sort": false,
@numpde
numpde / gpt-action-feedback.php
Last active October 25, 2024 11:19
WP: Custom REST API endpoint to report using GPT actions
<?php
/*
Plugin Name: GPT Action Feedback
Description: Allows custom GPTs to report issues or concerns via a REST API endpoint, restricted to users with a specific capability.
Version: 1.0
Author: RA
*/
// Register the custom REST API endpoint only when the plugin is active.
add_action('rest_api_init', 'gpt_register_feedback_endpoint');
@numpde
numpde / set_permissions.sh
Created October 23, 2024 07:54
WP/WC: Set file permissions on the host
#!/bin/bash
# This script updates file ownership and permissions for a WordPress installation
# located in the specified base directory. It ensures that the directories and files
# are owned by 'www-data', making them accessible for a WordPress instance running
# as 'www-data' inside a Docker container, while allowing the 'wc' user to edit them.
#
# The script performs the following actions:
# 1. Changes ownership of plugins, themes, uploads, wp-config.php, and .htaccess to 'www-data'.
# 2. Adds the 'wc' user to the 'www-data' group for edit permissions.
@numpde
numpde / wpwc_openapi_000_draft.yaml
Created October 14, 2024 05:15
OpenAPI for the WP/WC (by Schneider & Schuetz GmbH)
components:
schemas:
WPError:
properties:
additional_data:
description: Additional data of the error
type: any
additional_errors:
description: More errors
items:
@numpde
numpde / wpwc_openapi_001_basic_product_management.yaml
Created October 14, 2024 05:06
OpenAPI for the WP/WC (basic product management)
openapi: 3.1.0
info:
summary: OpenAPI for the WP/WC (basic product management). Based on the doc from the WP plug-in by Schneider & Schuetz GmbH.
title: wc/v3
version: '1'
servers:
- url: ***************************
security:
- basicAuth: []
components:
@numpde
numpde / docker-compose.yml
Last active October 21, 2024 16:18
WP/WC: WordPress
# Run as:
# TRAEFIK_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' traefik) docker-compose --env-file ./env/nairobi/.env -f ./marketplaces/nairobi/docker-compose.yml up -d
services:
wordpress:
image: wordpress:latest
container_name: wordpress_nairobi
restart: always
environment:
WORDPRESS_DB_HOST: "${MYSQL_HOST:?Please set MYSQL_HOST in .env or Docker Compose configuration.}"
@numpde
numpde / docker-compose.yml
Last active October 9, 2024 09:31
WP/WC: Adminer
services:
adminer:
image: adminer
container_name: adminer
environment:
- ADMINER_DEFAULT_SERVER=db_nairobi # MySQL container name on internal_nairobi network
labels:
- "traefik.enable=true"
- "traefik.http.routers.adminer.rule=Host(`${ADMINER_HOST}`)" # Uses host from env file
- "traefik.http.routers.adminer.entrypoints=websecure"
@numpde
numpde / docker-compose.yml
Created October 9, 2024 08:55
WP/WC: MySQL
services:
db_nairobi:
image: mysql:8.1
container_name: db_nairobi
restart: always
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
@numpde
numpde / docker-compose.yml
Last active October 11, 2024 15:45
WP/WC: Traefik
services:
traefik:
image: traefik:v3.1.4
container_name: traefik
restart: always
command:
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"