Skip to content

Instantly share code, notes, and snippets.

View codedeep79's full-sized avatar

Nguyễn Trung Hậu codedeep79

View GitHub Profile
@codedeep79
codedeep79 / demo_oneapi.f90
Created October 4, 2025 03:21
Chương trình demo bằng Fortran sau khi cài Intel oneAPI Fortran Compiler (ifort / ifx).
program demo_oneapi
implicit none
integer, parameter :: n = 500
real(8), dimension(n,n) :: A, B, C
integer :: i, j, k
real(8) :: start_time, end_time
! Khởi tạo ma trận A, B
do i = 1, n
do j = 1, n
@codedeep79
codedeep79 / ifort.sh
Created October 4, 2025 03:09
script cài đặt Intel Fortran Compiler (ifort / ifx trong Intel oneAPI HPC Toolkit) cho hầu hết các distro Linux phổ biến (Ubuntu/Debian, CentOS/RHEL/Fedora, Arch).
#!/usr/bin/env bash
# Script cài đặt Intel Fortran Compiler (ifort/ifx) trên Linux
# Hỗ trợ: Ubuntu/Debian, CentOS/RHEL/Fedora, Arch (AUR)
set -e
echo "🔎 Phát hiện hệ điều hành..."
if [ -f /etc/os-release ]; then
. /etc/os-release
DISTRO=$ID
@codedeep79
codedeep79 / hello_mpi.f90
Created October 4, 2025 02:53
Chương trình Fortran song song với MPI
program hello_mpi
use mpi
implicit none
integer :: rank, size, ierr
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)
call MPI_Comm_size(MPI_COMM_WORLD, size, ierr)
@codedeep79
codedeep79 / mpi.sh
Created October 4, 2025 02:43
Script Bash tự động cài MPI (MPICH hoặc OpenMPI) trên mọi distro Linux
#!/usr/bin/env bash
# Script cài MPI (OpenMPI hoặc MPICH) trên mọi distro Linux
# Dùng: ./mpi.sh [openmpi|mpich]
# Nếu không truyền tham số => mặc định cài OpenMPI
set -e
MPI_IMPL=${1:-openmpi} # openmpi hoặc mpich
echo "🔍 Phát hiện distro Linux..."
@codedeep79
codedeep79 / SqliteProfilerUltimate.py
Last active August 22, 2025 04:21
SQLite Workload Profiler
#!/usr/bin/env python3
# Yêu cầu: Python3, rich, subprocess, perf
import subprocess, sys, os, time, sqlite3
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
from rich.live import Live
from rich.prompt import Prompt
@codedeep79
codedeep79 / gen_scylla_yaml.py
Created August 10, 2025 06:17
Tạo mẫu file scylla.yaml tối ưu dựa trên input phần cứng (CPU core, RAM, NVMe, NUMA).
def generate_scylla_yaml(n_cpu, ram_gb, n_nvme, numa_nodes, use_row_cache=True):
ram_mb = ram_gb * 1024
memory = int(ram_mb * 0.7)
memtable_heap = int(memory * 0.25)
row_cache = 8192 if use_row_cache else 0
num_io_queues = n_nvme * numa_nodes
compaction_throughput = 256
yaml = f"""\
# Generated ScyllaDB configuration sample
@codedeep79
codedeep79 / scylla_scheduler_test.sh
Last active August 10, 2025 03:00
Script này được thiết kế để kiểm tra và tối ưu I/O Scheduler cho ScyllaDB trên hệ thống Debian hoặc các hệ điều hành Linux tương tự, chạy được cả trên môi trường bare metal lẫn trên các nền tảng đám mây phổ biến như AWS, GCP, Azure, VMware, OpenStack...
#!/bin/bash
set -e
DATA_PATH="${1:-/var/lib/scylla}"
echo "=== [1/6] Phát hiện thiết bị chứa dữ liệu ScyllaDB ($DATA_PATH) ==="
DEVICE=$(df "$DATA_PATH" | tail -1 | awk '{print $1}' | sed 's/[0-9]*$//')
DEVICE_NAME=$(basename "$DEVICE")
if [ -z "$DEVICE" ]; then
@codedeep79
codedeep79 / regex_training.md
Last active August 9, 2025 04:57
File dữ liệu test “đa vũ trụ” để luyện hết các pattern trong bộ Regex Hard Mode Training Pack. Dành cho trang web http://www.maxmind.io.vn/2025/08/regex-nang-cao-trong-notepad-bo-training-pack-voi-lookahead-recursion-and-parsing-phuc-tap.html
====================[ LOG SAMPLE ]====================
2025-08-08 15:32:55 [INFO] Server started at http://localhost:8080
2025-08-08 15:33:10 [ERROR] syntax error at line 23
2025-08-08 15:33:12 [WARN] Deprecated API usage
192.168.1.10 GET /index.html 200
8.8.8.8 GET /malicious.php?id=19 404
172.20.0.5 POST /api/data 500
http://example.com?param=1234567890123456789012345678901234567890
@codedeep79
codedeep79 / The current Visual Studio version does not support targeting .NET 8.0. Either target .NET 7.0 or lower, or use Visual Studio version 17.8 or higher.md
Last active January 6, 2025 05:21
The current Visual Studio version does not support targeting .NET 8.0. Either target .NET 7.0 or lower, or use Visual Studio version 17.8 or higher

The error message NETSDK1209 indicates that your current version of Visual Studio does not support targeting .NET 8.0:

  • Update the .csproj file to target a supported version of .NET, such as .NET 7.0.
    • Open the .csproj file.

    • Find the <TargetFramework> element.

    • Change the value to net7.0 or a lower version.

      <TargetFramework>net7.0</TargetFramework>
#!/bin/bash
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \