2024年5月22日星期三

[APPLE MAC OS]Got a kernel panic when just move mouse

Got kernel panic when just move mouse.

Checking with Apple, it seems that after update RTKit, which is a security method to prevent memory leak by local user, it was reported.

panic(cpu 1 caller 0xfffffe00299321dc): DCPEXT0 PANIC - IOMFB int_handler_gated: failure: axi_rd_err [0x40310634]

 - iomfb_driver(10)

IOMFB int_handler_gated: failure: axi_rd_err [0x40310634]


RTKit: RTKit-2419.101.1.release - Client: local-t600xdcp.RELEASE

!UUID: 44138b3c-b052-3669-bf7c-ac4a003b01b1

Time: 0x0000086d24b1a180


Faulting task  10 Call Stack: 0x000000000001e4a8 0x000000000001de98 0x000000000001dc9c 0x0000000000020dd4 0x0000000000209ac0 0x0000000000136a7c 0x000000000001e918 0x00000000000129d8 000000000000000000

RTKit Task List:

   name                    | pri     | stack use | status     | resource | warning

 0 rtk_background          | 007     |   848/2048  | SEMWAIT    | 0x962780 | 

      0x0000000000011ec0 0x0000000000012e5c 0x000000000001e8ac 0x00000000000129d8


 1 rtk_ep_work             | 057     |   920/2048  | SEMWAIT    | 0x95ee00 | 

      0x0000000000011ec0 0x0000000000012e5c 0x000000000001e8ac 0x00000000000129d8


 2 log_tx                  | 007     |   624/2048  | SEMWAIT    | 0x94b940 | 

      0x0000000000011ec0 0x0000000000012e5c 0x000000000001e8ac 0x00000000000129d8


 3 log_flush               | 015     |   944/4096  | SEMWAIT    | 0x94ace0 | 

      0x0000000000011ec0 0x0000000000012e5c 0x00000000000245c4 0x00000000000129d8


 4 tracekit_work           | 007     |   608/4096  | SEMWAIT    | 0x948810 | 

      0x0000000000011f08 0x0000000000012e5c 0x000000000001e8ac 0x00000000000129d8


...


Hope nothing wrong with my program..

2024年5月19日星期日

[yt-dlp]Investigation for logger output to log file

As Youtube-DL was not extended any more, I turned to yt-dlp also.

But it has an insufficient feature to output debug log to stdout. In my program, I need it to output debug log to log file instead of output to stdout.

After take some time to investigate the source, I found that I need to change one method in below file.

yt-dlp/yt_dlp/utils/_utils.py

Method: write_string

Its source below:

def write_string(s, out=None, encoding=None):

    assert isinstance(s, str)

    out = out or sys.stderr

    if not out:

        return


    if compat_os_name == 'nt' and supports_terminal_sequences(out):

        s = re.sub(r'([\r\n]+)', r' \1', s)


    enc, buffer = None, out

    if 'b' in (getattr(out, 'mode', None) or ''):

        enc = encoding or preferredencoding()

    elif hasattr(out, 'buffer'):

        buffer = out.buffer

        enc = encoding or getattr(out, 'encoding', None) or preferredencoding()


    buffer.write(s.encode(enc, 'ignore') if enc else s)

    out.flush()

As per the source, we can add out put log file parameter to it.


2024年5月17日星期五

[AWS EC2]Docker install

AWS EC2にDockerを利用して、Wordpressを使い始めたいと思いますので、AWS EC2にDockerインストールをメモしておきます。

1. EC2インスタンスにログインして、最新のyumリストを取得します。

$ sudo yum update -y

2. Docker packageインストールします。

$ sudo yum install -y docker

3. Dockerサービスを起動します。

$ sudo service docker start
Redirecting to /bin/systemctl start docker.service

4. Dockerグループにec2-userを追加します。

$ sudo usermod -a -G docker ec2-user

5. 一旦ログアウトして、再度ログインすることで、設定を有効化します。docker infoでdockerの起動を確認します。

exit

$ docker info
Client:
 Version:    25.0.3
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.0.0+unknown
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx

Server:
...
Although we did not face below issue, if you have the problem, please follow AWS guidance to restart the instance.

Cannot connect to the Docker daemon. Is the docker daemon running on this host?


The blog is follow on AWS guidance. Amazon ECS で使用するコンテナイメージの作成

2024年5月15日星期三

Youtube-dl Error

```

pi@raspberrypi:~/YoutubeDownLoad $ ./downloadYoutube_list.py 

Downloading https://www.youtube.com/watch?v=Y3mj8UZpvxQ

 MP4 start..

[youtube] Y3mj8UZpvxQ: Downloading webpage

ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Unknown issue

Unexpected {err=}, {type(err)=}

1 : https://www.youtube.com/watch?v=Y3mj8UZpvxQ


Downloading https://www.youtube.com/watch?v=lrpfYD4DUGs

 MP4 start..

[youtube] lrpfYD4DUGs: Downloading webpage

ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Unknown issue

Unexpected {err=}, {type(err)=}

2 : https://www.youtube.com/watch?v=lrpfYD4DUGs


pi@raspberrypi:~/YoutubeDownLoad $ sudo pip install yt-dlp

sudo: pip: command not found

pi@raspberrypi:~/YoutubeDownLoad $ sudo pip3 install yt-dlp

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple

Collecting yt-dlp

  Downloading https://files.pythonhosted.org/packages/31/5a/d9b0a47a3aacf650b8ffc750bb5d296c24b2cc674f4c2a975895f49d4f0a/yt_dlp-2023.11.16-py2.py3-none-any.whl (3.1MB)

    100% |████████████████████████████████| 3.1MB 87kB/s 

Collecting brotli; implementation_name == "cpython" (from yt-dlp)

  Downloading https://www.piwheels.org/simple/brotli/Brotli-1.1.0-cp37-cp37m-linux_armv7l.whl (2.1MB)

    100% |████████████████████████████████| 2.1MB 126kB/s 

Collecting websockets (from yt-dlp)

  Downloading https://www.piwheels.org/simple/websockets/websockets-11.0.3-cp37-cp37m-linux_armv7l.whl (132kB)

    100% |████████████████████████████████| 133kB 173kB/s 

Collecting pycryptodomex (from yt-dlp)

  Downloading https://www.piwheels.org/simple/pycryptodomex/pycryptodomex-3.20.0-cp35-abi3-linux_armv7l.whl (2.0MB)

    100% |████████████████████████████████| 2.0MB 130kB/s 

Requirement already satisfied: certifi in /usr/local/lib/python3.7/dist-packages (from yt-dlp) (2022.12.7)

Collecting mutagen (from yt-dlp)

  Downloading https://files.pythonhosted.org/packages/b0/7a/620f945b96be1f6ee357d211d5bf74ab1b7fe72a9f1525aafbfe3aee6875/mutagen-1.47.0-py3-none-any.whl (194kB)

    100% |████████████████████████████████| 194kB 1.0MB/s 

Collecting urllib3<3,>=1.26.17 (from yt-dlp)

  Downloading https://files.pythonhosted.org/packages/d2/b2/b157855192a68541a91ba7b2bbcb91f1b4faa51f8bae38d8005c034be524/urllib3-2.0.7-py3-none-any.whl (124kB)

    100% |████████████████████████████████| 133kB 1.4MB/s 

Collecting requests<3,>=2.31.0 (from yt-dlp)

  Using cached https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl

Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.31.0->yt-dlp) (3.4)

Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.31.0->yt-dlp) (3.1.0)

selenium 4.8.2 has requirement urllib3[socks]~=1.26, but you'll have urllib3 2.0.7 which is incompatible.

google-api-core 2.11.1 has requirement google-auth<3.0.dev0,>=2.14.1, but you'll have google-auth 1.23.0 which is incompatible.

Installing collected packages: brotli, websockets, pycryptodomex, mutagen, urllib3, requests, yt-dlp

  Found existing installation: urllib3 1.26.14

    Uninstalling urllib3-1.26.14:

      Successfully uninstalled urllib3-1.26.14

  Found existing installation: requests 2.28.2

    Uninstalling requests-2.28.2:

      Successfully uninstalled requests-2.28.2

Successfully installed brotli-1.1.0 mutagen-1.47.0 pycryptodomex-3.20.0 requests-2.31.0 urllib3-2.0.7 websockets-11.0.3 yt-dlp-2023.11.16


```

2024年5月13日星期一

[VS CODE]HTMLをリアルタイムでプレビューする方法

Web制作の過程でリアルタイムプレビューを使いたい場合、Visual Studio Code(VS Code)の利用をおすすめです。

Visual Studio Code(VS Code)はマイクロソフトが提供している無料のコードエディタです。昔はAdobeのDreamWeaverを利用し、非常に高機能で使いやすかったが、MACのOSアップデートで、一括支払いバージョンからSaaSになって、高額で諦めました。

「コードエディタを使ってリアルタイムプレビューの環境を作る」と聞くと難しそうな印象を受けるかもしれませんが、実際は非常に簡単で3分ほどで完了します。

「VS CodeのUI上でプレビューする方法」があります。まずはVS Codeが必要なので、下記のページからダウンロードしてPCにインストールしましょう。



https://code.visualstudio.com/download

VS CodeのUI上でプレビューできる拡張機能もあります。ExtensionsからHTML Previewと検索し、下記が表示されたらインストールしてください。

ファイルに戻り、command + Shift + P(Windows:Ctrl + Shift + P)を押すと上に表示される検索窓から、HTML: Open Preview the the Sideを選択します。そうすると、右にプレビュー画面が出てきて、所見既所得....

DreamWeaverのような高機能ではありませんが、基本的なHTML、CSS、Javascriptについて、問題がありません。ただし、Pluginの開発は2018からすでに停滞しているので、いつかに使えなくなるのが心配です。

まだ、問題となりのがリンクです。プレビュー画面からリンクを経由でNext Pageの確認が不可です。全てAzureに誘導され、Azureの共有リンクから探しているようです。設定不備かエンジンのバグだと思います。

2024年5月10日星期五

[youtube-dl]Blocked?

 Just want to confirm if there is any newer version for YouTube-dl, unfortunately, it was blocked by de court...


It was shown that [Access denied] to yt-dl.org due to a ruling of the Hamburg Regional Court.

Access to this website is blocked.


So, we still have another way.

https://github.com/ytdl-org/youtube-dl

But it seems that it stopped development since 2021.

ーーーーーーーーーーーーーーーSuper beautiful seperate lineーーーーーーーーーーーー

After asked Google, I found the below repository.

yt_dlp

We can make some change on script to work on yt_dlp rather than Youtube_DL.

2024年5月6日星期一

[Panasonic]CF-SZ6 Fixed a SZ6 LCD Screen

Fixed a Panasonic CF-SZ6 LCD Screen, but found that although it passed the selftest, but failed on startup beep.

Why?

Changed the module board, but it can not work fine yet.

Maybe motherboard connecter broken.



2024年4月25日星期四

[LINUX]Install CentOS on VMWare can not enable network connection

 Tested install CentOS7 on an old VMWare with ESXi 5.5.

After change VM resource memory more than 2 GB, installed CentOS7 successfully.

But anyway, I can not get the network work.

I checked any possible reason, including but not limited to VM resource, VM network, Device on CentOS, etc., everything is working fine. But CentOS will have no network.

BTW, configure on CentOS also setup properly like below: (let's suppose that you have the interface as enp0s3 with the static ip 192.168.1.11/24)

nmcli d  ## to check which interface you are using.

nmcli c modify enp0s3 ipv4.address 192.168.1.11/24  ## setup ip

nmcli c modify enp0s3 ipv4.gateway 192.168.1.1 ## setup default gateway 

nmcli c modify enp0s3 ipv4.method manual  ## static ip

It will change [BOOTPROTO=dhcp→none]

sudo systemctl restart networkmanager

Does it seem fine?

No, there is a very important thing.

You have to enable the network interface first via below:

nmcli c m enp0s3 connection.autoconnect yes 

It will change [ONBOOT=no→yes], or the interface will not work as you expected. 


You may also need below step to confirm the network to see if it can working fine.

Show network configuration.

nmcli d show enp0s3

Edit host file to obtain your host name with your ip.

192.168.1.1 your_router_name #router

192.168.1.11 your_hostname #

Confirm [/etc/resov.conf], it should show something as below:

nameserver 192.168.1.1

Then ping local and remote URL to see if the DNS can resolve the domain name and get ICMP traffic from them. 

 

[MacOS]Add auto log function to terminal.app

Boring with Mac terminal color of white and black?

Ok, you can change the theme.

I like the homebrew theme, but it has too bright color for text.

OK, that is not my point.

For some reason, I need to add a function for terminal.app on Mac to record the command and screen output as what I can see.

You can go to the menu, [Terminal] -> [Configuration] -> Click the theme you are using [Shell]. Then you will see a startup shell command input.

 now=`date +%Y%m%d%H%M%S`;logpath=~/scriptlogs/script_${now}.txt;script ${logpath}

Just copy and paste above. It will add auto execute script when terminal.app start up and execute it with script command of unix.

You also can change the following path to where you want to keep your log. "~/scriptlogs/"  

Then check the execute in shell. You need shutdown terminal.app and start it again.

Now you have an auto log for Mac terminal.app.

But most people will ignore one thing...

If you try to execute the command [cat the log] in the terminal.app, you will get into a loop...and a fast increased size log file till your system crash. 

Because the screen out put will be written to log imediately and it was also shown as standard output then it will be recorded to log again and again. 


2024年4月24日星期三

[CentOS]When trying to install CentOS stream on VMware, it got [kernal error] error

Just want to try new CentOS stream, so reopen the VMware machine.

It is running on a very old ESXi 5.5 via a vSphere center 5.5 from about 10 years ago.

After mounted the OS, it showed below [Kernal panic] error.


Considered it is a very old system, then I tested CentOS7. Same error occurred.

So it should be a something else.

Noticed that I created the VM machine based on ESXi default configuration. It was set the memory as 384MB as a template for CentOS 4/5/6 or any Linux version. That is it.

CentOS 7 run in a necessary requirement at least 1GB memory. Sorry, no any official document link, just got advices from many sites...

In fact, I set it as 512MB, it is also running.

2024年4月18日星期四

[LinkedIn]How to enable #OpenToWork Tag in LinkedIn

This is nothing related to technic, just for the feature of LinkedIn.

It is really hard to find it....

 

To enable the #OpenToWork feature:

  1. Click the Me icon at the top of your LinkedIn homepage.
  2. Click View profile.
  3. Click the Open to button.
  4. Click Finding a new job.
  5. Provide the requested information in the pop-up window that appears. ...
  6. Click Add to profile.

2024年4月16日星期二

[YAMAHA Router]The difference between YAMAHA Router RTX1210 and RTX1220

Have a request to compare YAMAHA Router RTX1210 and RTX1220.
For some meaning, it is a best replacement of CISCO Router which always need high price maintenance contract.

According to YAMAHA site, only below changed.
Not so much improvement.
But in auction with price, they have about 40,000 difference...

So if I should refresh the hardware, it is a problem...

項目RTX1220RTX1210
希望小売価格(税抜)118,000円125,000円
認証番号D20-0252001/M20-0021CD14-0216001/M14-0011
JANコード49 57812 67103 349 57812 57644 4
ISDN S/Tポート非搭載1ポート(終端抵抗ON/OFF可能)
対応回線およびサービス網ISDN(BRI)非対応対応
高速デジタル専用線(64kbit/s, 128kbit/s)非対応対応
WANプロトコルPPP非対応対応
MP非対応対応
QoS機能(制御方式)CBQ非対応対応
WFQ非対応対応
認証機能ISDN識別着信非対応対応
バックアップ機能ISDNへのバックアップ非対応対応
設定手段ISDN回線経由のリモートセットアップ非対応対応
その他機能BOD(MP, BACP)非対応対応
リモートアクセスサーバー非対応対応
コールバック(無課金独自方式, Windows標準方式)非対応対応
状態表示ランプISDN[L1/B1, B2]非搭載搭載
付属品CD-ROM(1枚:[PDF]取扱説明書, コマンドリファレンス, 設定例集, [ソフトウェア]RT-FileGuard, MD5SUM)なしあり
最大1年間無償のYNOライセンスありなし
ファームウェアRev.15.04系Rev.14.01系
 

2024年4月15日星期一

[Python]Use Python to send form data to page

 Consider to request a form URL to get the site accept the data.

import requests # Define the form data form_data = { 'name': 'G X', 'email': 'gx@gx.com' } # Send a POST request with the form data response = requests.post('http://gx.com/submit', data=form_data) # Check if the request was successful (status code 200) if response.status_code == 200: print('Form submitted successfully') else: print('Failed to submit the form')


But actually, it won't work for the site I had expected.

Because the site will use a one-time serial session id to identify the request. need to update.

Yes, you are right. this is a tips for company timecard registration automation. 

 

2024年4月13日星期六

Cloud Service Comparison Cheat Sheet

 Just got one sheet for comparison 4 cloud services difference.


Hope can help someone, including me.


2024年4月12日星期五

[Letsencrypt]Import Letsencrypt on AWS EC2 Instance

I have a site need to be implemented on AWS EC2 with SSL for my daughter.

We already have some sites with test running on it.

So we set up VirtualHost for it.

After it can work on AWS EC2, I imported Certbot for it.

It is a installed package with AWS Linux already and this is a subdomain for gxlcs.com, like temp.gxlcs.com.

We only have few steps need to do.

1. sudo yum install certbot

2. sudo systemctl start certbot-renew.timer

3. sudo certbot certonly

4. 

How would you like to authenticate with the ACME CA?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1: Runs an HTTP server locally which serves the necessary validation files under

the /.well-known/acme-challenge/ request path. Suitable if there is no HTTP

server already running. HTTP challenge only (wildcards not supported).

(standalone)

2: Saves the necessary validation files to a .well-known/acme-challenge/

directory within the nominated webroot path. A seperate HTTP server must be

running and serving files from the webroot path. HTTP challenge only (wildcards

not supported). (webroot)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Enter email address (used for urgent renewal and security notices)

 (Enter 'c' to cancel): webmaster@gxlcs.com


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Please read the Terms of Service at

https://letsencrypt.org/documents/LE-SA-v1.4-April-3-2024.pdf. You must agree in

order to register with the ACME server. Do you agree?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(Y)es/(N)o: Y


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Would you be willing, once your first certificate is successfully issued, to

share your email address with the Electronic Frontier Foundation, a founding

partner of the Let's Encrypt project and the non-profit organization that

develops Certbot? We'd like to send you email about our work encrypting the web,

EFF news, campaigns, and ways to support digital freedom.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(Y)es/(N)o: N

Account registered.

Please enter the domain name(s) you would like on your certificate (comma and/or

space separated) (Enter 'c' to cancel): temp.gxlcs.com

Requesting a certificate for temp.gxlcs.com

Input the webroot for temp.gxlcs.com: (Enter 'c' to cancel): 


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 does not exist or is not a directory

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Input the webroot for temp.gxlcs.com: (Enter 'c' to cancel): /var/www/html/temp


Successfully received certificate.

Certificate is saved at: /etc/letsencrypt/live/temp.gxlcs.com/fullchain.pem

Key is saved at:         /etc/letsencrypt/live/temp.gxlcs.com/privkey.pem

This certificate expires on 2024-07-11.

These files will be updated when the certificate renews.

Certbot has set up a scheduled task to automatically renew this certificate in the background.


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

If you like Certbot, please consider supporting our work by:

 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate

 * Donating to EFF:                    https://eff.org/donate-le

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

5. sudo systemctl is-enabled httpd

if the response is [disabled], need to run #6.

6.  sudo systemctl start httpd && sudo systemctl enable httpd

7.  sudo yum update -y

8.  sudo yum install -y mod_ssl

9. After #8, it will create a conf file with name ssl.conf in /etc/httpd/conf.d/

10. sudo nano /etc/httpd/conf.d/ssl.conf

11. specify the [SSLCertificateFile] and [SSLCertificateKeyFile] with the path where you keep the key and certificate.

12. sudo systemctl restart httpd.service

13. Because we have VirtualHost, you also may need to change VirtualHost setup with where you put the DocumentRoot and Server Name.

14. As we have permitted the 443 port traffic in AWS Console, I mean inbound rule under security group, so the traffic is not problem.

15. I use CLOUDFLARE to provide security for site (Free version), so we also need to add a CNAME DNS record for this site. You can enter the AWS EC2 Instance tag, then confirm public DNS name which will be used in CLOUDFLARE CNAME DNS record CONTENT. 

OK, Now your site will go ahead in the net with SSL.

I will add the screenshot when I have time, sorry for any inconvenience.


Additional: I also have a security test for the site.

you can refer to below URL: 

Qualys

 

 

2024年4月11日星期四

[Python]JPG to PNG Python Program

from PIL import Image import os def convert_jpg_to_png(input_folder, output_folder): # 1. Get list up the input folder files jpg_files = [f for f in os.listdir(input_folder) if f.endswith('.jpg')] # 2. Create the output folder if it did not exist os.makedirs(output_folder, exist_ok=True) # 3. Change the JPG to PNG files for jpg_file in jpg_files: jpg_path = os.path.join(input_folder, jpg_file) # Create the PNG file output path png_path = os.path.join(output_folder, os.path.splitext(jpg_file)[0] + '.png') # Change the image img = Image.open(jpg_path) img.save(png_path, 'PNG') if __name__ == "__main__": input_folder = "path" # Define the input path of JPG output_folder = "path" # Define the output path of PNG convert_jpg_to_png(input_folder, output_folder)

Need to get them work on my site...