Skip to content

Instantly share code, notes, and snippets.

@igotit-anything
igotit-anything / com_cobs_tx.py
Last active July 28, 2026 02:29
COM Tx with COBS encoded frame
# com 포트 송신
import serial # PySerial
import time
from cobs import cobs # pip install cobs 필요
def run_serial_tx():
port = "COM15"
baudrate = 1000000 # baud rate 1 Mbps. USB CDC 로 인식된 com에서는 이 설정값이 통신속도 제한하지 않음. 아무거나 기록해됨.
@igotit-anything
igotit-anything / com_simple.py
Last active July 28, 2026 02:15
com port receiving basic
import serial # PySerial
import time
def run_serial_receiver():
port = "COM15"
baudrate = 1000000 # baud rate 1 Mbps. USB CDC 로 인식된 com에서는 이 설정값이 통신속도 제한하지 않음. 아무거나 기록해됨.
try:
# 1. COM 포트 오픈 (타임아웃은 non-blocking을 위해 0으로 설정 가능)
ser = serial.Serial(
@igotit-anything
igotit-anything / com_que_thread.py
Last active July 28, 2026 02:15
com 통신 후처리 스레드
import serial # PySerial
import time
# que, thread 위해 포함.
import queue
import threading
# [스레드 핵심 1] 멀티스레드 안전한 전역 큐 버퍼 생성
# maxsize 지정하여 소비가 밀릴 때 메모리가 무한히 늘어나는 것 방지.
@igotit-anything
igotit-anything / com_simple_tx.py
Last active July 28, 2026 02:15
PySerial TX Simple
# com 포트 송신
import serial # PySerial
import time
def run_serial_tx():
port = "COM15"
baudrate = 1000000 # baud rate 1 Mbps. USB CDC 로 인식된 com에서는 이 설정값이 통신속도 제한하지 않음. 아무거나 기록해됨.
# 송신할 임의의 데이터 정의 (원하는 바이트 값을 바이트 배열로 기록)
@igotit-anything
igotit-anything / gist:8ea565863984879eb41cbfa7f42c2ca8
Created April 28, 2026 03:47
Visual Studio 파일 인코딩 변환 . 한글깨짐 해결 . PowerShell 명령어
Get-ChildItem -Recurse -Include *.cpp, *.h, *.cs, *.hpp | ForEach-Object {
$filePath = $_.FullName
# 1. 파일의 첫 3바이트를 읽어 BOM 확인
$bytes = [System.IO.File]::ReadAllBytes($filePath)
$isUtf8Bom = $bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF
if ($isUtf8Bom) {
Write-Host "이미 UTF-8 BOM임 (건너뜀): $($_.Name)" -ForegroundColor Yellow
@igotit-anything
igotit-anything / CyAddOnInstrument.cs
Created January 17, 2026 11:54
Ninjascript AddOns Instrument Subscribe
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
@igotit-anything
igotit-anything / CyAddOnHelloNinja.cs
Last active January 17, 2026 08:46
ninja script
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
@igotit-anything
igotit-anything / CFixStatusDlg.cpp
Last active January 11, 2026 03:43
CDialogEx template
/// .h
#include "resource.h"
class CFixStatusDlg : public CDialogEx
{
DECLARE_DYNAMIC(CFixStatusDlg)
public:
explicit CFixStatusDlg(CWnd* pParent = nullptr);
/*
2025.11.25
파일명 : CyTool_Candle_2_Sqlite_Multi.mq5
여러 종목의 캔들 데이터를 SQLite DB 로 저장.
mt5 의 아무챠트에서 실행해도 사용자 입력에서 지정된 여러 심볼들의 과거 캔들 확보하여 DB 파일로 저장.
모든 심볼의 메타 데이터 테이블.
테이블명 : A_SymbolMeta
//@version=6
strategy("Simple SMA Cross Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// ───────────── Input Parameters ─────────────
fastLen = input.int(9, title="Fast MA Length")
slowLen = input.int(21, title="Slow MA Length")
takeProfit = input.float(2.0, title="Take Profit %", step=0.1)
stopLoss = input.float(1.0, title="Stop Loss %", step=0.1)
// ───────────── Indicators ─────────────