How to code in PHP for a dynamic response with caching when data may be updated within some period of time

https://g.co/gemini/share/2175b8e1272c To code a dynamic PHP response with caching when data may be updated within 15 minutes, you can use a combination of PHP’s file system functions and HTTP headers. The general strategy involves checking for a cached file, serving it if it’s recent enough, and generating a new response and cache file if it’s not.   Basic Caching Logic   The core idea is […]

Read Me Leave comment

How to call a shared c library function from python

https://g.co/gemini/share/bef352c1745d C // my_library.c #include <stdio.h> // A simple function to add two integers int add(int a, int b) { return a + b; } // A function to calculate the factorial of a non-negative integer long long factorial(int n) { if (n < 0) { fprintf(stderr, “Factorial is not defined for negative numbers.\n”); return -1; // Indicate an error } if (n == 0) […]

Read Me Leave comment

How to mount a Google Cloud Storage (GCS) bucket as a folder

https://g.co/gemini/share/d2a1b5c3e021 Mounting a Google Cloud Storage (GCS) bucket as a folder in a Debian-based VM is a common and very useful task, typically accomplished using Cloud Storage FUSE (gcsfuse). This allows your applications to interact with GCS as if it were a local file system. Here’s a step-by-step guide: 1. Prerequisites: A Debian-based VM: This guide assumes you’re working on a Debian or Ubuntu VM […]

Read Me Leave comment

How to block all IPs from a specific country

https://gemini.google.com/share/ef5ee9c9b31a Yes, you can use ufw (Uncomplicated Firewall) to block IP addresses from China. However, directly adding thousands of individual IP ranges to ufw is not the most efficient method and can be quite slow and resource-intensive. A better approach is to use ipset, a tool designed to manage large sets of IP addresses, and then create a single ufw rule that references that set. […]

Read Me Leave comment

Laravel Installation

1. Global Installation composer global require laravel/installer laravel new example-app   2. Per Project Installation composer create-project laravel/laravel example-app   3. Specific Version Installation composer create-project laravel/laravel:^8.0 example-app (Install version 8.0)      

Read Me Leave comment

Apache Cordova emulator not running on android run in Debian Linux.

Apache Cordova emulator not running on android run in Debian Linux.

Read Me Leave comment

How to write Python Bindings for Qt Applications

This article gives indepth tutorial for creating custom pythons bindigns for your qt Applications: https://www.qt.io/blog/2018/05/31/write-python-bindings

Read Me Leave comment