You can now search your diary, something you've wanted to do for a long time! Enter a free word in the "Article Search" and a list of applicable articles will be displayed.
Click on the link in the search results to open the corresponding diary.
Talk to ChatGPT about the Python version of the rental server Xserver. Python 2.7.5The instruction to upgrade the version because support has already ended at However, the Python-3.12.3 installation does not finish with an error Then it instructed me to upgrade gcc version 4.8.5 because it was out of date.
It ended up taking a long time to make from the evening to the morning.
# GCC Installation Instructions
echo $HOME /home/lily2004 # Create working directory mkdir -p $HOME/src cd $HOME/src
# Download and install MPFR, GMP, MPC sources wget https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz tar xf gmp-6.2.1.tar.xz cd gmp-6.2.1 . /configure --prefix=$HOME/local make make install cd ...
wget https://www.mpfr.org/mpfr-4.2.1/mpfr-4.2.1.tar.xz tar xf mpfr-4.2.1.tar.xz cd mpfr-4.2.1 . /configure --prefix=$HOME/local --with-gmp=$HOME/local make make install cd ...
wget https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz tar xf mpc-1.2.1.tar.gz cd mpc-1.2.1 . /configure --prefix=$HOME/local --with-gmp=$HOME/local --with-mpfr=$HOME/local make make install cd ...
# Download GCC wget https://ftp.gnu.org/gnu/gcc/gcc-11.4.0/gcc-11.4.0.tar.xz tar xf gcc-11.4.0.tar.xz cd gcc-11.4.0
# Prepare to build GCC . /configure --prefix=$HOME/local --with-gmp=$HOME/local --with-mpfr=$HOME/local --with-mpc=$HOME/local --enable-languages=c,c++ --disable --multilib make make install cd ...
# Prepare to install Python wget https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tgz tar xf Python-3.12.3.tgz cd Python-3.12.3
Python program to create Json Index (index.json)make_index.2.py
We run it once a day with cron. 0 2 * * * /home/lily2004/local/bin/python3 /home/lily2004/ji1fgx.com/public_html/script/make_index.2.py
/home/lily2004/ji1fgx.com/public_html /home/lily2004/ji1fgx.com/public_html/index.json
#make_index.2.py # -*- coding: utf-8 -*- import os import json import sys import chardet from bs4 import BeautifulSoup
# Function to determine file encoding def detect_encoding(file_path):. with open(file_path, 'rb') as f:. raw_data = f.read() result = chardet.detect(raw_data) return result['encoding'] or 'utf-8' # return utf-8 if no result
# Function to extract unique title and body from HTML def extract_custom_title_and_text(file_path):. encoding = detect_encoding(file_path) # detect encoding with open(file_path, 'r', encoding=encoding, errors='ignore') as f:. html = f.read()
soup = BeautifulSoup(html, 'html.parser')
# Unique title extraction th_title = soup.find('th', class_='hpb-cnt-tb-th1') title = '' if th_title:. title = th_title.get_text(strip=True)
# Extract text also (for search) body = soup.get_text(separator=' ', strip=True)
return title, body
def main(folder, output_file):. index_data = [].
for filename in os.listdir(folder): for filename in os.listdir(folder) # if filename.endswith('.html', '.php'):. if filename.endswith(('.html', '.php')):. full_path = os.path.join(folder, filename) try:. title, content = extract_custom_title_and_text(full_path)
# Embed file names as links link = f'<a href="{filename}" target="B">{filename}</a>'
# Add data to index_data index_data.append({ 'title': title or link, and 'file': filename,. 'link': link,. 'content': content[:300]. }) except Exception as e:. print(f "Error processing {filename}: {e}")
with open(output_file, 'w', encoding='utf-8') as f:. json.dump(index_data, f, ensure_ascii=False, indent=2)
print(f "Index file created: {output_file}")
if __name__ == '__main__':. if len(sys.argv) < 3: if len(sys.argv) < 3: if len(sys.argv) < 3 print("Usage: make_index.py <input_folder> <output_file>") else:. input_folder = sys.argv[1]. output_file = sys.argv[2]. main(input_folder, output_file)