Me Forgetful

How to share an installed printer in linux/Debian in network

Sharing an installed printer in Debian on a network can be done using CUPS (Common Unix Printing System), which is the standard printing system for most Linux distributions.1 Step 1: Install CUPS and Printer Drivers First, ensure you have CUPS and the necessary printer drivers installed. If you installed your printer, you likely already have these. If not, open a terminal and run: Bash sudo […]

Read Me Leave comment

How to share a DIR with samba share in linux

To share a directory in Linux using Samba, you need to install the Samba server package, create a dedicated directory for sharing, configure the smb.conf file, and set up a Samba user with a password. This process makes the directory accessible to other computers on the network, including Windows, macOS, and other Linux machines.1   Step-by-Step Guide   1. Install Samba2   First, you need […]

Read Me Leave comment

How to use rclone to create Google Drive based drive on your computer.

Setting up Rclone with Google Drive involves configuring Rclone to access your Google Drive account and then optionally mounting it as a local drive.   1. Install Rclone: Download the appropriate Rclone executable for your operating system from the official Rclone website. Extract the downloaded archive and place the rclone executable in a directory included in your system’s PATH, or a location you can easily […]

Read Me Leave comment

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 allow SMTP on Google Cloud VM

https://g.co/gemini/share/dc2f83e714bb   Configuring a Google Cloud VM to allow SMTP traffic involves several steps.1 By default, Google Cloud Platform (GCP) blocks outbound connections on ports 25, 465, and 587. This is a security measure to prevent the platform from being used for spam. To send emails from your VM, you need to use a third-party email service like SendGrid, Mailgun, or Mailjet and configure your […]

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

Change Font Sizes Automatically Relative to Root Font Size

To change the fontsize of all elements relative to root font size: First set root font size with css html {                 font-size: 12px;             } then set related element sizes with rem size h1 {                 font-size: 2rem;               […]

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