ARCHIVE - Dedicated Python Tools (tar/zip)

Here's a step-by-step tutorial on how to manage `tar` and `zip` archives in Python, using a pedagogical approach with checkpoints to ensure understanding.

### **Python Tools for Managing `tar` and `zip` Archives: A How-to Guide**

### **Prerequisites**
- Basic knowledge of Python programming
- Python installed on your machine (Python 3.x recommended)

### **Tools Overview**
Python provides built-in libraries to manage `tar` and `zip` files:
- `tarfile` for handling `.tar`, `.tar.gz`, and `.tar.

ENCODING - Check file encoding

To check the encoding of a file, you can use various tools and programming languages. Here are a few methods to do this:

### 1. Using Python
You can use the [**`chardet`**](https://pypi.org/project/chardet/) library to detect the encoding of a file in Python. First, install the library if you haven't:

```bash
pip install chardet
```

Then, use the following script:

```python
import chardet

file_path = 'path/to/your/file'

with open(file_path, 'rb') as file:
    raw_data = file.read()
    res

GCP - Unzipping Archives in Cloud Storage - 3 - Using Google Cloud Functions

Let's go through this tutorial step by step on how to use Google Cloud Functions to automatically extract archives when they are uploaded to a Google Cloud Storage (GCS) bucket. Since you're a beginner, I'll break this down into smaller chunks with checkpoints after each step to ensure clarity.

### Overview of the Process

1. **Create a Cloud Function** that triggers when a `.zip` file is uploaded to your GCS bucket.
2. **Write the Cloud Function** to:
   - Download the archive.
   - Extract it

GCP - Unzipping Archives in Cloud Storage - 2 - Using a VM

To manually extract archives stored in Google Cloud Storage (GCS) using a Google Compute Engine (GCE) virtual machine (VM), follow this step-by-step guide. This approach provides control over the extraction process and is straightforward to set up.

### Step-by-Step Guidance for Extracting Archives in GCS Using a VM

#### **Step 1: Set Up Your Google Cloud Environment**

1. **Open Google Cloud Console**:
   - Go to the [Google Cloud Console](https://console.cloud.google.com/).

2. **Enable Billi

GCP - Unzipping Archives in Cloud Storage - 1 - Different Options

☝️ When you upload archives (such as `.zip` or `.tar.gz` files) to a Google Cloud Storage (GCS) bucket, **they are not automatically unarchived**. 

GCS stores these files exactly as they are uploaded. If you need the files to be extracted, you must do so manually or using additional tools and services.

### Options for Extracting Archives in GCS

If you need the contents of the archives extracted in the cloud, here are some common methods:

#### 1. **Manual Extraction Using a Compute Engine VM*

PowerShell - Encoding UTF-8

It is possible to enforce UTF-8 encoding when creating archives with PowerShell, particularly when handling file names or paths that contain accents or special characters. However, this involves ensuring that the file names and paths are correctly encoded in UTF-8 before the compression process.

### How to Enforce UTF-8 When Creating Archives

#### 1. **Ensure File Names and Paths are in UTF-8**
Before creating an archive, ensure that any file names or paths with accents are correctly interpret

show low in stock products - wordpress Woocommerce

https://stackoverflow.com/questions/64645772/show-low-in-stock-products

PowerShell - Archiving

Creating an archive (like a ZIP file) in PowerShell is straightforward, and you can do it using the `Compress-Archive` cmdlet. Here's a step-by-step explanation:

### 1. Basic Syntax of `Compress-Archive`
The general syntax for creating a ZIP archive with `Compress-Archive` is:
```powershell
Compress-Archive -Path <PathToFiles> -DestinationPath <PathToArchive>
```
- **`-Path`**: Specifies the files or folders you want to include in the archive.
- **`-DestinationPath`**: Specifies the path and na

Date Formatter Class js

/**
  * @version 17.09.2024
  * @author info@artemsites.ru
  * import { DateFormatterClass } from "/src/utils/DateFormatterClass.js"
  *
  * const dateFormatter = new DateFormatterClass('2024-03-28') // создаст экземпляр на указанную дату
  * const dateFormatter = new DateFormatterClass() // создаст экземпляр на текущую дату
 */
export class DateFormatterClass {
  constructor(dateString = new Date()) {
    this.date = new Date(dateString)
  }

  // Ср
  getNameDayWeekShort(date) {
    if (date) 

タグの中の文字の改行をそのまま改行として表示する

<style>
  .text {
    white-space: pre-wrap;
  }
</style>
<p class="text"></p>
<script>
  const text = document.querySelector(".text");
  text.textContent = "テキスト\nテキスト";
</script>

Shell - Utilities

# Count Files Within a Directory
## Using `ls` and `wc`
```bash
ls -1 /path/to/your/folder | wc -l
```

## Using `find`
```bash
find /path/to/your/folder -type f | wc -l
```

## Using `ls` with `-l` for Details (If you want to ensure no directories are counted)
```bash
ls -l /path/to/your/folder | grep '^-' | wc -l
```

# Find the Memory Usage of a Directory
## Find the Total Size of a Directory in Human-Readable Format
```bash
du -sh /path/to/your/directory
```

## Find the Size of Each Subdire

PowerShell - Utilities

# Count Files in a Directory (Non-Recursive)
```powershell
(Get-ChildItem -File -Path "path\to\your\folder").Count
```

# Count Files in a Directory (Recursive, Including Subdirectories)
```powershell
(Get-ChildItem -File -Recurse -Path "path\to\your\folder").Count
```

# Get Folder Size in Bytes
```powershell
(Get-ChildItem -Path "C:\path\to\your\folder" -Recurse -File | Measure-Object -Property Length -Sum).Sum
```

# Get Folder Size in a Human-Readable Format
```powershell
$size = (Get-ChildI

PHPで開発環境のテンプレをつくる(layouts,components)

<?php
  function renderLayout($head, $slot) {
    ob_start(); 
    $slot(); 
    $content = ob_get_clean(); 
?>
<!DOCTYPE html>
<html lang="ja">
<?php
  include_once 'components/common/head.php'; 
  renderHeadTag($head); 
?>

<body>
  <div class="wrap">
    <?php include_once 'components/common/header.html'; ?>
    <main class="main">
      <?php echo $content; ?>
    </main>
    <?php include_once 'components/common/footer.html'; ?>
  </div>
</body>

</html>
<?php
}

テキストエリアの形に画像を切り抜く

<div class="aug-img w-full max-w-xl aspect-[3/2]">
  <div>
    <img src="assets/images/1.jpg" alt="" />
  </div>
  <div>
    <img src="assets/images/1.jpg" alt="" />
  </div>
  <div class="pt-3 pr-4 text-sm grid gap-1">
    <h2 class="font-bold text-lg">タイトル</h2>
    <p>テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキスト</p>
  </div>
</div>

html

_