Hexa's Blog

How to install Talend Open Studio on Fedora 37?

08/05/2023 @ Saigon Talend

Step 1: Install java-11-openjdk

Due to Talend Open Studio prerequisites link, we need to install OpenJDK 11 (recommended distribution: Zulu) or OracleJDK 11. In this tutorial, I used OpenJDK 11 provided by Fedora package repository.

[1] Talend Open Studio prerequisites
[1] Talend Open Studio prerequisites

Package information:

$ sudo dnf info java-11-openjdk

Installed Packages
Name         : java-11-openjdk
Epoch        : 1
Version      : 11.0.18.0.10
Release      : 1.fc37
Architecture : x86_64
Size         : 1.2 M
Source       : java-11-openjdk-11.0.18.0.10-1.fc37.src.rpm
Repository   : @System
From repo    : updates
Summary      : OpenJDK 11 Runtime Environment
URL          : http://openjdk.java.net/
License      : ASL 1.1 and ASL 2.0 and BSD and BSD with advertising and GPL+ and GPLv2 and
               GPLv2 with exceptions and IJG and LGPLv2+ and MIT and MPLv2.0 and Public
               Domain and W3C and zlib and ISC and FTL and RSA
Description  : The OpenJDK 11 runtime environment.

Package installation:

$ sudo dnf install java-11-openjdk

Step 2: Setup java with alternatives command

In this step, we use command alternatives to set java version systemwide, java-11-openjdk.x86_64 is selected with option 3.

sudo alternatives --config java

There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           java-17-openjdk.x86_64 (/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-1.fc37.x86_64/bin/java)
   2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b09-2.fc37.x86_64/jre/bin/java)
 + 3           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.fc37.x86_64/bin/java)

Enter to keep the current selection[+], or type selection number: 3

Step 3: Set JAVA_HOME

I used shell named zsh, I will configure JAVA_HOME in .zshrc file which located in ~/.zshrc. If you use bash, you will need to configure .bashrc. You can trace the java home path using alternatives in Step 2. For me, the value is /usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.fc37.x86_64

export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.fc37.x86_64

Step 4: Download, Extract and Execute Talend Open Studio

After download Talend Open Studio TOS_DI-20211109_1610-V8.0.1.zip, and extract, you gonna see a list of file & directory.

$ ls -l
total 280
drwxr-xr-x. 1    136 Aug 26  2014 about_files
drwxr-xr-x. 1    660 May  8 17:00 configuration
drwxr-xr-x. 1   7170 Nov  9  2021 features
-rwxr-xr-x. 1    605 Nov  9  2021 license.txt
-rwxr-xr-x. 1  11840 Nov  9  2021 NOTICE.txt
drwxr-xr-x. 1    112 Nov  9  2021 p2
drwxr-xr-x. 1  59446 Nov  9  2021 plugins
drwxr-xr-x. 1      0 May  8 16:26 temp
-rwxr-xr-x. 1  80160 Jun 11  2021 TOS_DI-linux-gtk-aarch64
-rwxr-xr-x. 1    259 Nov  9  2021 TOS_DI-linux-gtk-aarch64.ini
-rwxr-xr-x. 1  74675 Aug 20  2014 TOS_DI-linux-gtk-x86_64
-rwxr-xr-x. 1    259 Nov  9  2021 TOS_DI-linux-gtk-x86_64.ini
drwxr-xr-x. 1     16 Oct 29  2021 TOS_DI-macosx-cocoa-aarch64.app
drwxr-xr-x. 1     16 Oct 29  2021 TOS_DI-macosx-cocoa.app
-rwxr-xr-x. 1    410 Nov  9  2021 TOS_DI-macosx-cocoa.ini
-rwxr-xr-x. 1  91512 Aug 19  2021 TOS_DI-win-x86_64.exe
-rwxr-xr-x. 1    259 Nov  9  2021 TOS_DI-win-x86_64.ini
drwxr-xr-x. 1     76 May  8 16:27 workspace

You need to execute this file named TOS_DI-linux-gtk-x86_64 and done. Good luck.

[2] Open Talend Open Studio
[2] Open Talend Open Studio

How to fix csgo_linux64 has stopped working

01/05/2023 @ Saigon CSGO

Sometimes, playing CSGO on Fedora (Gnome) gives you this message.

csgo_linux64 has stopped working
csgo_linux64 has stopped working

It’s because GNOME detects csgo_linux64 process unresponsive. You can fix this issue by setting the timeout to 0, by default, it’s 5000 milliseconds.

$ gsettings set org.gnome.mutter check-alive-timeout 0

How to copy files from docker image to host machine?

30/04/2023 @ Saigon Linux

Step 1: Prepare dockerfile

In this post, I would like to take an example building html file for jekyll blog.

from ruby:3.2.0 as build

WORKDIR /opt/nguyenvinhlinh.github.io
COPY . /opt/nguyenvinhlinh.github.io

RUN bundle config set --local deployment true
RUN bundle install
RUN bundle exec jekyll build --destination=/opt/nguyenvinhlinh.github.io/dist

FROM scratch as release
COPY --from=build  /opt/nguyenvinhlinh.github.io/dist /

The build step will make statis file in /opt/nguyenvinhlinh.github.io/dist, then at release stage, it copies all files from that dist directory to /

Step 2: Execute docker build command

$ mkdir -p /var/tmp/nguyenvinhlinh.github.io-dist
$ docker build -f Dockerfile  --target=release --output type=local,dest=/var/tmp/nguyenvinhlinh.github.io-dist .

[+] Building 29.7s (12/12) FINISHED
 => [internal] load .dockerignore                                                                                        0.0s
 => => transferring context: 120B                                                                                        0.0s
 => [internal] load build definition from Dockerfile                                                                     0.0s
 => => transferring dockerfile: 424B                                                                                     0.0s
 => [internal] load metadata for docker.io/library/ruby:3.2.0                                                            1.8s
 => [1/5] FROM docker.io/library/ruby:3.2.0@sha256:98e340a1e5a9a61ee0c30e464a058da093ab8179460ed096a2a763a3abaa6c47      0.0s
 => CACHED [2/5] WORKDIR /opt/nguyenvinhlinh.github.io                                                                   0.0s
 => [internal] load build context                                                                                        0.1s
 => => transferring context: 103.72kB                                                                                    0.0s
 => [build 3/6] COPY . /opt/nguyenvinhlinh.github.io                                                                     0.1s
 => [build 4/6] RUN bundle config set --local deployment true                                                            0.7s
 => [build 5/6] RUN bundle install                                                                                      23.7s
 => [build 6/6] RUN bundle exec jekyll build --destination=/opt/nguyenvinhlinh.github.io/dist                            2.6s
 => [release 1/1] COPY --from=build  /opt/nguyenvinhlinh.github.io/dist /                                                0.2s
 => exporting to client                                                                                                  0.2s
 => => copying files 12.10MB

In this step, the key point here is about to copy all files from stage named release to host directory at /var/tmp/nguyenvinhlinh.github.io-dist.

Good luck, have fun!

References

How to delete journalctl log safely?

29/04/2023 @ Saigon Linux

First of all, it’s important to know how much space has been used for journalctl log. There are many method to get this information, in this post, I would like to introduce two method.

  • Disk Usage (du command), given that logs stored in /var/log/journal. You can use this following command.
$ du --human-readable --summarize /var/log/journal
3.0G	/var/log/journal

$ du -sh /var/log/journal
3.0G	/var/log/journal
  • Using journalctl --disk-usage
$ journalctl --disk-usage
Archived and active journals take up 2.8G in the file system.

Now, come back to our main topic - deleting journalctl log safely.

  • Delete log data by time, in this example, it only keeo 7-day old data.
$ journalctl --vacuum-time=7d
Vacuuming done, freed 0B of archived journals from /run/log/journal.
Vacuuming done, freed 0B of archived journals from /var/log/journal/f5393db751dc400898dc12ef55768680.
Vacuuming done, freed 0B of archived journals from /var/log/journal.
  • Delete log data by disk usage, in the following example, it only keeps data up 1GB. This command uses G for Gigabyte, M for Megabyte, K for Kilobyte.
$ journalctl --vacuum-size=1G
Vacuuming done, freed 0B of archived journals from /var/log/journal.
Vacuuming done, freed 0B of archived journals from /run/log/journal.
Vacuuming done, freed 0B of archived journals from /var/log/journal/f5393db751dc400898dc12ef55768680.

Sơ đồ điện của mạch điều tốc

28/04/2023 @ Saigon Mining Rig

Sơ đồ điện của mạch điều tốc
Sơ đồ điện của mạch điều tốc

Dynex mining configuration - VGA 3080

08/03/2023 @ Saigon Mining Rig

1. Running bat script - run.bat

a. Dynex Solver 2.2.5

:loop
C:\Users\CHANGE_ME\Desktop\Software\dynexsolve_windows2.2.5\DynexSolveVS.225.exe ^
  -mallob-endpoint https://dnx.sg.ekapool.com ^
  -mining-address WALLET_ADDRESS ^
  -stratum-url POOL_URL -stratum-port POOL_PORT -no-cpu -multi-gpu ^
  -stratum-password WORKER_NAME -adj 1.0898 -sync
goto loop
:exitloop

Example:

:loop
C:\Users\LacLongQuan\Desktop\Software\dynexsolve_windows2.2.5\DynexSolveVS.225.exe ^
  -mallob-endpoint https://dnx.sg.ekapool.com ^
  -mining-address XwnTnXV7cSEQszHqM3xihWZp6MiP6n8vqggLFH15VMEBDnpkBKnv1Cz7wn5L18uVrwMDFhdhB2fV3fSTZ7MexKDJ1ZgGx9ZCC ^
  -stratum-url dnx.sg.ekapool.com -stratum-port 19666 -no-cpu -multi-gpu ^
  -stratum-password LAC-LONG-QUAN -adj 1.0898 -sync
goto loop
:exitloop

b. SRBMiner 2.2.1

SRBMiner-MULTI.exe ^
  --algorithm dynex ^
  --disable-cpu ^
  --gpu-id 0 ^ :: enable/disable gpu
  --mallob-endpoint https://dnx.sg.ekapool.com ^
  --pool dnx.sg.ekapool.com:19666 ^
  --wallet WALLET-ADDRESS
  --password WORKER-NAME

Example:

setx GPU_MAX_HEAP_SIZE 100
setx GPU_MAX_USE_SYNC_OBJECTS 1
setx GPU_SINGLE_ALLOC_PERCENT 100
setx GPU_MAX_ALLOC_PERCENT 100
setx GPU_MAX_SINGLE_ALLOC_PERCENT 100

@echo off
cd %~dp0
cls

SRBMiner-MULTI.exe ^
--algorithm dynex ^
--disable-cpu ^
--gpu-id 0 ^
--mallob-endpoint https://dnx.sg.ekapool.com ^
--pool dnx.sg.ekapool.com:19666 ^
--wallet XwnTnXV7cSEQszHqM3xihWZp6MiP6n8vqggLFH15VMEBDnpkBKnv1Cz7wn5L18uVrwMDFhdhB2fV3fSTZ7MexKDJ1ZgGx9ZCC ^
--password AU-CO
pause

2. Nvidia Overclock script - oc.bat

  • Locked GPU Clock: 1760MHz
  • Locked Memory Clock: 5000MHz
  • Power Limit: 135W
nvidia-smi -lgc 1760
nvidia-smi -lmc 5000
nvidia-smi -pl 135

3. Result

  • Hashrate for a 3080 GPU: 240H/s
  • Power Consumption: 115W
  • Temperature: 46C
  • Dynex chips: 334
Dynex Solver 2.2.5
Dynex Solver 2.2.5

Etica Miner Configuration

27/09/2022 @ Saigon Mining Rig

Step 1: Download miner & extract - lwYeo/SoliditySHA3Miner

In addition, install the following dependencies if need.

Step 2: Make a file name 01-mine-etica.bat

@echo off
pushd %~dp0

for %%X in (dotnet.exe) do (set FOUND=%%~$PATH:X)
if defined FOUND (goto dotNetFound) else (goto dotNetNotFound)

:dotNetNotFound
echo .NET Core is not found or not installed,
echo download and install from https://www.microsoft.com/net/download/windows/run
goto end

:dotNetFound
:startMiner
DEL /F /Q SoliditySHA3Miner.conf

SoliditySHA3Miner.exe ^
allowCPU=false ^
allowIntel=false ^
allowAMD=false ^
allowCUDA=true ^
abiFile=0xBTC.abi ^
contract=0xB6eD7644C69416d67B522e20bC294A9a9B405B31 ^
overrideMaxTarget=26959946667150639794667015087019630673637144422540572481103610249216 ^
pool=http://eticapool.com:8081 ^
address=0xE58796150958032349A32f20031645a3850Fe92C

if %errorlevel% EQU 22 (
  goto startMiner
)
:end
pause

Step 3: Make a file name 02-oc-etica.bat

nvidia-smi -lgc 1850
nvidia-smi -lmc 810
nvidia-smi -pl 220
pause

Step 4: Execute 01-mine-etica.bat & 02-oc-etica.bat.

Checklist chuẩn bị dàn đào

02/08/2022 @ Saigon Mining Rig

Bài viết này được viết để hỗ trợ cho các dàn đào sử dụng hệ điều hành Window 10. Ý kiến cá nhân, tôi không thích sử dụng các hệ điều hành chuyên dụng ví dụ như Minerstat OS, tôi thích sử dụng Minerstat Window hơn.

Dàn Đào
Dàn Đào

I. BIOS

  • Advanced → SATA Mode Selection: AHCI
  • Advanced → CSM Configuration
    • CSM Support: Enabled
    • Gate A20 Active: Upon Request (Mặc định)
    • Option ROM Messages: Force BIOS (Mặc định)
    • Boot option filter: UEFI and Legacy
    • Network: Do not lauch (Mặc định)
    • Storage: UEFI
    • Video: Legacy (Mặc định)
    • Other PCI devices: UEFI (Mặc định)
  • Advanced → USB Configuration
    • Legacy USB Support: Disabled
  • Chipset → Restore AC Power Loss: Power On

II. Window 10

1. Phần mềm

2. Thiết lập thêm trong Window 10

  • User Account Control Settings: Never Notify
  • Power Option: High Performance
    • Turn off the display: Never
    • Put the computer to sleep: Never
  • Virtual Memory: mỗi VGA là 8,000 MB, ví dụ cài đặt cho 4 x 3080, tổng cộng là 32,000 MB.
    • Initial size (MB): 32,000 MB
    • Maximum size (MB): 32,000 MB
  • Visual Effects: Adjust for best performance

Phân tích exec trong shell script

27/07/2022 @ Saigon Linux

1. Giới thiệu exec

Trước tiên cần giải thích hành vi của exec. Dưới đây là ví dụ của file có tên là script.sh. Trong file này, nó sẽ gọi child_script.sh

#!/bin/bash
...
...
...

./child_script.sh

Giả sử như là child_script này chạy khá lâu, lâu đến mức chúng ta có thể mở một terminal khác và rồi liệt kê danh sách những process nào đang chạy. Chúng ta sẽ thấy có hai process.

  • process dành cho script.sh
  • process dành cho child_script.sh

Phân tích thêm một chút là mặc dù script.sh đã chạy xong phần việc của nó, giờ đây nó kích hoạt child_script.sh, phần code/chức năng lúc này đang được thực thi là năm trong child_script.sh. Lưu ý một chút là mặc dù để tên là child_script.sh tuy nhiên đây cũng có thể là một đoạn script ngang cấp với script.sh, chỉ đơn giản là script này chạy trước, cái kia chạy sau, script này gọi script kia.

Khi nhìn nhận ở góc độ này, chúng ta có thể nhận ra rằng việc nhận được danh sách process đang chạy có 2 process dành cho script.shchild_script.sh không phải lúc nào cũng là phương án tốt nhất.

Một cách tiếp cận khác đó là khi script.sh đã chạy xong, process dành cho nó sẽ bị khai tử, và khi liệt kê danh sách các process đang chạy, chúng ta sẽ chỉ thấy process dành cho child_script.sh mà thôi.

Để làm được điều này, ta sẽ cần sử dụng exec. script.sh sau khi viết lại và sử dụng exec sẽ trông như sau:

#!/bin/bash
...
...
...

exec ./child_script.sh

2. Khi nào nên sử dụng?

child_script.sh là script cuối cùng cần phải kích hoạt sau khi chạy script.sh. Không sử dụng exec ở giữa file script trừ trường hợp muốn cắt ngang script.sh.

Nếu vô ý sử dụng exec ở giữa file script, đoạn code nằm sau exec sẽ bị bỏ qua ngay cả khi child_script.sh đã xử lý xong. Lý do là vì ngay khi sử dụng exec, process dành cho script.sh đã bị khai tử, thành ra, nó không có cơ sở để thực thi những đoạn code nằm sau.

3. Demo

Trong một thư mục bất kỳ hãy tạo nội dung hai file script.shchild_script.sh như sau:

script.sh

#!/bin/zsh

echo "this is script.sh"
sleep 1
./child_script.sh

child_script.sh

#!/bin/zsh

echo "this is child_script.sh"
sleep 20

Tình huống hiện tại, exec không được sử dụng, khi chạy script.sh ; Ta sẽ thấy có hai process. Sử dụng lệnh ps -a để xem danh sách process.

  • pid: 1 718 953 → script.sh
  • pid: 1 718 976 → child_script.sh
[1] Không sử dụng exec
[1] Không sử dụng exec

Và tiếp theo, khi thêm exec vào trước ./child_script.sh trong file script.sh, ta sẽ chỉ thấy có một process là:

  • pid: 1 718 065 → child_script.sh
[2] Sử dụng exec
[2] Sử dụng exec

Bài phân tích này kết thúc ở đây, chúc các bạn tìm được cách tiếp cận hợp lý khi viết script trong từng trường hợp cụ thể.

Cảm ơn đồng nghiệp của tôi là anh Duy đã dành thời gian quý báu của mình để giúp tôi hiểu thêm về exec.

Cách sửa lỗi Microsoft Teams: “We're sorry—we've run into an issue.”

19/07/2022 Window

Tôi gặp vấn đề khó chịu này khi sử dụng cùng lúc 2 tài khoản Microsoft Teams trên Window 10. Lỗi này xảy ra khi tôi chuyển đổi giữa hai account. Để khắc phục vấn đề này các bạn hãy làm như sau.

[1] We're sorry—we've run into an issue.
[1] We're sorry—we've run into an issue.

.

Tôi gặp vấn đề khó chịu này khi sử dụng cùng lúc 2 tài khoản Microsoft Teams trên Window 10. Lỗi này xảy ra khi tôi chuyển đổi giữa hai account. Để khắc phục vấn đề này các bạn hãy làm như sau.

Bước 1: Vào %LocalAppData%\Microsoft\Teams\current

LocalAppData là enviroment variable có giá trị chính là C:\Users\nguye\AppData\Local\ Tùy vào tên username mà giá trị này có thể thay đổi. Tuy nhiên khi paste %LocalAppData%\Microsoft\Teams\current vào File Explorer, File Explorer sẽ tự trỏ vào thư mục cần thiết.

[2] File Explorer
[2] File Explorer

Bước 2: Chỉnh compatibility mode của file Teams.exe thành Window 8.

[3] Teams.exe Properties
[3] Teams.exe Properties

Đã xong, bạn có thể vào lại Microsoft Team và tận hưởng thành quả!