OpenRGB OpenGL “Digital Rain” Matrix Code Script

I’ve been using OpenRGB for a while to control the RGB LEDs on my home PC and after a Windows 11 24H2 related forced re-install, I wanted to try and have the PC produce the Digital Rain Matrix Code effect on the LEDs.

Possibly because “matrix” is such a common search term when discussing RGB LEDs, I wasn’t able to find a ready made solution.

It seemed the best way to create a shader script, and use the “Shaders” effect in the effects plugin of OpenRGB. The only slight problem was that I know nothing about shader scripts.

With the help of Microsoft Copilot, I was able to create the script below, which for me in my setup works really well, and I’ve chosen to pop it up here to maybe save you some time if you’re looking to do something similar.

// Adjustable parameters
const float rainSpeed = 0.1;
const float speedVariance = 0.15;
const vec3 greenColor = vec3(0, 1.0, 0);
const vec3 whiteColor = vec3(0.04, 1.0, 0.02);

// Threshold for the "head" of the drop
const float headThreshold = 0.02;

vec3 rain(vec2 fragCoord)
{
    fragCoord.x -= mod(fragCoord.x, 1.0);

    float offset = sin(fragCoord.x * 15.0);
    float variation = (cos(fragCoord.x * 3.0) + 1.0) * 0.5;
    float speed = rainSpeed + variation * speedVariance;

    float y = fract(fragCoord.y / iResolution.y + iTime * speed + offset);

    // If y is near the top, use white; otherwise, use green
    vec3 color = (y < headThreshold) ? whiteColor : greenColor;

    return color / (y * 40.0);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord)
{
    fragColor = vec4(rain(fragCoord), 1.0);
}

Word Press Importer – Remote server did not respond

I had this issue when importing media from a site protected with an SSL certificate to a development site on the same server.

After a lot of googling and adding extra (useful) debugging code to wordpress-importer.php I found that the issue was that cURL was failing to verify the certificate (possibly due to it connecting locally).

After a lot of searching I failed to find a way to temporarily prevent the importer checking the certificate, but with a bit of persistence I found that adding the following two lines to the file wp-content/plugins/wordpress-importer.php

Find the lines :

function fetch_remote_file( $url, $post ) {
add_filter( 'http_request_host_is_external', '__return_true' );

for me they were found starting on line 982

Add the following below the two lines

add_filter( 'https_local_ssl_verify', '__return_false' );
add_filter( 'https_ssl_verify', '__return_false' );

and re-run the import.

I doubt both are necessary, but adding both will cover more SSL eventualities.

Remember to remove them after your import to reduce the likelihood of the settings being exploited.

FPDI php useTemplate and formatting on every page

This was something I was searching long and hard for whilst writing a billing system I was working on.

I thought I’d share this here just in case anyone else finds it useful.

Using the excellent FPDI php template library to write php generated text onto a PDF template, I needed to have the generated text span over a few pages. I struggled to get the template to appear on each new page, and when I did I need to add a margin to the top of the document to prevent overwriting the PDF template header.

In the end the only way I could do it was by extending the FPDI class to run my own code in the header of all new pages

class MYPDF extends FPDI {
    var $_tplIdx;  				// Store the template id of the imported page

    function Header() { 			// Include a background template for every page
        if (is_null($this->_tplIdx)) {
            $this->_tplIdx = $this->importPage(1);
        }
        $this->useTemplate($this->_tplIdx);
        $this->SetY(58);                        // Add a sufficent gap at the top of the page
    } 

    function Footer() {}
}