Skip to content

Instantly share code, notes, and snippets.

View pingkunga's full-sized avatar
🎯
Focusing

Chatri Ngambenchawong pingkunga

🎯
Focusing
View GitHub Profile
@pingkunga
pingkunga / .gitattributes
Created May 3, 2025 10:06
dotnet .gitattributes sample
# Normalize line endings for text files
# Set default behavior to automatically normalize line endings
* text=auto
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.cs text diff=csharp
*.csproj text
*.sln text
*.config text
@pingkunga
pingkunga / docker-compose.yaml
Last active April 12, 2025 23:46
jellyfin_hw_tran
services:
jellyfin:
image: jellyfin/jellyfin:latest
container_name: Jellyfin-HW-TRAN
# 1026:100 check on host > ls -n /volume1/docker/jellyfin_hw_tran
# user: 1026:100
environment:
TZ: Asia/Bangkok
volumes:
- /volume1/docker/jellyfin_hw_tran/config:/config:rw
class ATM:
def __init__(self, balance=0):
self.balance = balance
def deposit(self, amount):
if amount > 0:
self.balance += amount
return f"Deposit successful! New balance: ${self.balance:.2f}"
else:
return "Invalid deposit amount."
@pingkunga
pingkunga / docker-compose.yaml
Last active March 31, 2025 11:10
kavita docker compose
services:
kavita:
image: jvmilazz0/kavita:latest # Using the stable branch from the official dockerhub repo.
container_name: kavita
volumes:
- ./data/manga:/manga
- ./data/comics:/comics
- ./data/books:/books
- ./config:/kavita/config # /kavita/config must not be changed
environment:
@pingkunga
pingkunga / ProcessTransactionWithListAndDic.cs
Created March 18, 2025 02:48
Back to Basic: Fundamental Data Structure in C#
public static void ProcessTransactionWithOnlyList(IList<TransactionDTO> pTransactions, IList<PortfolioDTO> pPortfolios, IList<PortPriceSouceDTO> pPortPriceSources)
{
// Iterate through transactions and find corresponding portfolio
foreach (var transaction in pTransactions)
{
// Use LINQ to find the portfolio with the matching PortfolioId
var portfolio = pPortfolios.FirstOrDefault(p => p.PortfolioId == transaction.PortfolioId);
if (portfolio != null)
{
// You can save or process the transaction with the portfolio here
@pingkunga
pingkunga / NewMoverBoxSlowWithDevExpress
Last active March 18, 2025 02:48
Back to Basic: Fundamental Data Structure in C#
int[] selectedRows = this._sourceGridView.GetSelectedRows();
int[] sourceIndex = new int[selectedRows.Length];
for (int row = 0; row < selectedRows.Length; row++){
if (selectedRows[row] >= 0){
sourceIndex[row] = this._sourceGridView.GetDataSourceRowIndex(selectedRows[row]);
}
else{
sourceIndex[row] = selectedRows[row];
}
@pingkunga
pingkunga / OldMoverBoxSlowWithDevExpress
Created March 18, 2025 02:38
Back to Basic: Fundamental Data Structure in C#
int[] sourceIndex = new int[this._sourceGridView.SelectedRowsCount];
for (int row = this._sourceGridView.SelectedRowsCount - 1; row >= 0; row--){
if (_sourceGridView.GetSelectedRows()[row] >= 0){
sourceIndex[row] = this._sourceGridView.GetDataSourceRowIndex(this._sourceGridView.GetSelectedRows()[row]);
}
else{
sourceIndex[row] = this._sourceGridView.GetSelectedRows()[row];
}
}
@pingkunga
pingkunga / ProcessTransactionWithOnlyList.cs
Created March 18, 2025 02:26
Back to Basic: Fundamental Data Structure in C#
public static void ProcessTransactionWithOnlyList(IList<TransactionDTO> pTransactions, IList<PortfolioDTO> pPortfolios, IList<PortPriceSouceDTO> pPortPriceSources)
{
// Iterate through transactions and find corresponding portfolio
foreach (var transaction in pTransactions)
{
// Use LINQ to find the portfolio with the matching PortfolioId
var portfolio = pPortfolios.FirstOrDefault(p => p.PortfolioId == transaction.PortfolioId);
if (portfolio != null)
{
// You can save or process the transaction with the portfolio here
services:
psitransfer:
image: psitrax/psitransfer
environment:
- PSITRANSFER_DEFAULT_RETENTION=3600
- PSITRANSFER_PORT=8080
ports:
- '8602:8080'
volumes:
- './data:/data'
@pingkunga
pingkunga / csharp_dataStructures
Created February 28, 2025 00:57
# Data Structures: Big O Complexity, Use-Case, and Sample Code
# C# Data Structures: Big O Complexity, Use-Case, and Sample Code
## Array
### Big O Complexity
- Access: O(1)
- Search: O(n)
- Insert: O(n)
- Delete: O(n)
### Use-Case