Skip to content

Instantly share code, notes, and snippets.

Avatar

Schakko schakko

View GitHub Profile
@schakko
schakko / fix-woocommerce-germanized-invoices.md
Created Jan 18, 2022
Fix WooCommerce Germanized invoices due to changes or inconsistent order data
View fix-woocommerce-germanized-invoices.md

When using WooCommerce Germanized you might end up with processed orders but the invoices can not be generated. Clicking onto the Create invoice button throws the following error:

An invoice could not be created due to changes to or inconsistent order data. Please review the corresponding order.

For debugging purposes, you can look into wp-content/plugins/woocommerce-germanized-pro/packages/storeabill/src/WooCommerce/Order.php. Somewhere in protected function get_order_items_to_cancel( $args = array() ) WooCommerce Germanized detects a pricing difference. This is most likely to a mismatch between the data provided during the payment and the current point in time.

WooCommerce Germanize does the following:

  • If not present, create a new invoice in the table storeabill_documents
  • Fill up the invoice items in table storeabill_document_items by loading the data from woocommerce_order_items
@schakko
schakko / nginx.conf
Created Sep 8, 2021
Adjusted nginx.conf to make Laravel 8 apps with PHP 8.0 features runnable on Azure App Service
View nginx.conf
server {
# adjusted nginx.conf to make Laravel 8 apps with PHP 8.0 features runnable on Azure App Service
# @see https://laravel.com/docs/8.x/deployment
listen 8080;
listen [::]:8080;
root /home/site/wwwroot/public;
index index.php;
server_name example.com www.example.com;
location / {
@schakko
schakko / AuditAllKeyVaultsInTenant.ps1
Created Jun 23, 2021
Create an overview with all key vaults in current Azure tenant for auditing reasons
View AuditAllKeyVaultsInTenant.ps1
# This has been written to list all permissions to Key Vaults in the current Azure AD tenant.
# It comes in handy if you need to do a scheduled audit e.g. for TISAX compliance reasons.
$vaults = Get-AzKeyVault
foreach ($vault in $vaults) {
$detail = Get-AzKeyVault -VaultName $vault.VaultName;
# Expand all permissions
$FormatEnumerationLimit = 20;
# Get permissions for secrets (certificates etc. not required in our case)
@schakko
schakko / extension_nt_multi_field.php
Last active Aug 12, 2020
Fixes various bugs in Techland WordPress theme with WordPress 5.5; meta-box has currently issues and must be disabled
View extension_nt_multi_field.php
/**
* fix constructor to make it work with custom wp-content path (e.g. when hosting multiple webservers for loadbalancing purposes and using the same NFS share
* goes to wp-content/themes/techland/inc/theme-options/redux-extensions/extensions/nt_multi_field/extension_nt_multi_field.php line ~72
*/
if ( empty( $this->extension_dir ) ) {
$this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );
$this->extension_url = home_url( '/wp-content/' . str_replace( trailingslashit( str_replace( '\\', '/', WP_CONTENT_DIR ) ), '', $this->extension_dir ) );
}
@schakko
schakko / setup-wordpress-in-wsl.sh
Created Mar 6, 2019
WordPress in WSL / Windows Subsystem for Linux
View setup-wordpress-in-wsl.sh
sudo apt-get install apache2 php-fpm php-ldap php-xdebug
sudo a2enmod proxy_fcgi setenvif rewrite
sudo a2enconf php7.3-fpm
sudo service apache2 reload
vim /etc/apache2/apache2.conf
--- snip ---
# AllowOverride all for DocumentRoot
--- snip ---
@schakko
schakko / reordering_postgres_rows_and_fixing_gaps.md
Last active Dec 1, 2018
Reordering of Postgres table rows and fixing gaps afterwards
View reordering_postgres_rows_and_fixing_gaps.md

This describes a naive implementation how to fix missing gaps after a reordering. Table tbl contains two columns. The position column is of type decimal to make the reordering easier.

CREATE TABLE tbl(key varchar(255), position decimal(5,4));

We fill the table with the following statements

INSERT INTO tbl values('A', 1.0);
INSERT INTO tbl values('B', 2.0);
INSERT INTO tbl values('C', 3.0);
@schakko
schakko / monitord.xml
Last active Oct 1, 2015
XML configuration for monitord, using POCSAG and ActiveMQ failover. It uses snd_aloop as input device.
View monitord.xml
<?xml version="1.0" encoding="ISO-8859-1">
<monitordconfig version="1.0">
<name>monitord</name>
<logfile>/var/log/monitord.log</logfile>
<loglevel>DEBUG</loglevel>
<soundcard num="1">
<device>plughw:Loopback,0,0</device>
<status>1</status>
<baud>48000</baud>
<name>Loopback</name>
@schakko
schakko / autounattend.xml
Created Apr 24, 2015
Hard disk configuration for installing Windows 2012 R2 in VirtualBox without hitting the 0x80042565 error
View autounattend.xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<!-- only relevant information to install Windows 2012 R2 in VirtualBox without hitting 0x80042565 error -->
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DiskConfiguration>
<WillShowUI>OnError</WillShowUI>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
View EjbMocker.java
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtConstructor;
import javassist.CtField;
import javassist.CtMethod;
@schakko
schakko / EnvironmentSpecificHibernatePersistence.java
Created Jan 30, 2014
Dynamic properties inside persistence.xml
View EnvironmentSpecificHibernatePersistence.java
import java.util.HashMap;
import java.util.Map;
import javax.persistence.EntityManagerFactory;
import javax.persistence.spi.PersistenceProvider;
import javax.persistence.spi.PersistenceUnitInfo;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.ejb.HibernatePersistence;