Skip to content

Instantly share code, notes, and snippets.

View architectureman's full-sized avatar

architectureman architectureman

View GitHub Profile

Sử dụng thư viện test-ids-generator kết hợp với một quy trình quản lý data-test-id bằng CSV. Giải pháp chi tiết:

// scripts/generate-test-ids.js
const fs = require('fs');
const csv = require('csv-parse/sync');
const path = require('path');
@architectureman
architectureman / Yaml
Created November 12, 2024 03:24
Migration
version: '3.8'
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
@architectureman
architectureman / draft_portfolio_optimizer.py
Last active November 26, 2024 02:32
Draft Portfolio Optimize Basic
import yfinance as yf
import pandas as pd
import numpy as np
from pypfopt import EfficientFrontier
from pypfopt import risk_models
from pypfopt import expected_returns
from datetime import datetime, timedelta
# Định nghĩa danh sách cổ phiếu
tickers = ['AAPL', 'GOOGL', 'MSFT', 'AMZN', 'META', 'TSLA', 'NVDA', 'JPM']
@architectureman
architectureman / update_optimze_portfolio.py
Last active December 18, 2024 07:52
Fix bug ticker smaller than risk-free rate
CONFIG = {
'MAX_PORTFOLIO_POINT_GENERATE_ATTEMPTS': 100,
'DEFAULT_RISK_FREE_RATE': 0.02,
'DEFAULT_LOOKBACK_DAYS': 365,
'MAX_TICKERS': 20
}
#------------------------------------------------------------------------------------------------------------------------
def safely_fetch_stock_data(
@architectureman
architectureman / Ticket_Approval.md
Created December 3, 2024 09:34
Integration Ticket Approval Base On Keycloak & Casbin

Ticket Approval System Design Document

1. System Architecture Overview

graph TD
    Client["Client Application"]
    LB["Load Balancer"]
    API["API Gateway"]
 Auth["Keycloak Server"]
{
"status": "success",
"portfolio_analysis": {
"performance_metrics": {
"initial": {
"return": -17.82,
"volatility": 104.56,
"sharpe_ratio": -0.1896
},
"optimized": {
@architectureman
architectureman / iframe.md
Created December 11, 2024 08:45
Hook iframe

Để chèn thêm tham số vào tất cả các request header của iframe trước khi gửi đi, bạn có thể sử dụng một số phương pháp sau:

  1. Sử dụng JavaScript:
// Ghi đè phương thức createElement của iframe
const originalCreateElement = document.createElement;
document.createElement = function(tagName) {
    const element = originalCreateElement.call(document, tagName);
    
    if (tagName.toLowerCase() === 'iframe') {
@architectureman
architectureman / stress_test.md
Created December 12, 2024 07:28
stress_test_postgres_golang

Okay, I can help you write a Go program to benchmark and stress test a PostgreSQL database using SELECT, INSERT, and DELETE operations. Here's a comprehensive example with explanations:

1. Project Setup:

  • Create a new Go project:
    mkdir postgres-benchmark
    cd postgres-benchmark
    go mod init postgres-benchmark
@architectureman
architectureman / assets_converter.md
Last active December 17, 2024 15:29
portfolio_assets_currency_converter

Tài liệu chi tiết thiết kế CSDL quản lý tài sản đa tiền tệ

1. Giới thiệu tổng quan

Hệ thống được thiết kế để quản lý tài sản với khả năng xử lý nhiều loại tiền tệ khác nhau. Cho phép người dùng theo dõi, quản lý các giao dịch tài sản và xem giá trị quy đổi giữa các đồng tiền.

2. Chi tiết từng bảng và mối quan hệ

2.1. Bảng Users (Người dùng)

Mục đích

  • Lưu trữ thông tin người dùng trong hệ thống
@architectureman
architectureman / dotfile.md
Last active December 20, 2024 06:12
Dotfiles

Tôi sẽ giúp bạn xây dựng một project dotfiles toàn diện. Hãy chia nhỏ project thành các phần để dễ quản lý và triển khai:

  1. Cấu trúc thư mục:
dotfiles/
├── flake.nix
├── flake.lock
├── install.sh
├── configs/
│   ├── neovim/