https://developers.google.com/protocol-buffers/docs/overview

 

Overview  |  Protocol Buffers  |  Google Developers

Protocol buffers provide a language-neutral, platform-neutral, extensible mechanism for serializing structured data in a forward-compatible and backward-compatible way. It’s like JSON, except it's smaller and faster, and it generates native language bind

developers.google.com

serialize 플랫폼으로 Google 의 Protocol Buffers 라는 솔루션이 있다. C++, C#, Dart, Go, Java, Kotlin, Python 등 다양한 언어를 지원하고 protocol 간의 하위 호환성이 좋아서 네트워크 통신이나 db 에 blob 형태로 데이터 저장할 때 유용하다.

https://developers.google.com/protocol-buffers/docs/encoding#structure

 

Encoding  |  Protocol Buffers  |  Google Developers

Encoding Stay organized with collections Save and categorize content based on your preferences. This document describes the protocol buffer wire format, which defines the details of how your message is sent on the wire and how much space it consumes on dis

developers.google.com

scalar 값을 저장할 때 int32, int64 등은 VARINT 방식으로 저장된다.

10010110 00000001        // Original inputs.
 0010110  0000001        // Drop continuation bits.
 0000001  0010110        // Put into little-endian order.
 10010110                // Concatenate.
 128 + 16 + 4 + 2 = 150  // Interpret as integer.

작은 숫자의 경우 작은 저장 공간을 사용할 수 있다. int32 같은 경우 int64 와 type 호환도 가능하다.

https://developers.google.com/protocol-buffers/docs/encoding#signed-ints
 

Encoding  |  Protocol Buffers  |  Google Developers

Encoding Stay organized with collections Save and categorize content based on your preferences. This document describes the protocol buffer wire format, which defines the details of how your message is sent on the wire and how much space it consumes on dis

developers.google.com

음수의 경우 two's complement 방식이라면 항상 최대 저장공간을 사용하게 된다. sint32, sint64 type 을 사용하면 ZigZag 인코딩을 사용해서 저장 공간을 줄일 수 있다. 음수 값이 자주 사용되는 상황이면 sintN 형식을 사용을 고려해볼만 하다.

Signed Original Encoded As
0 0
-1 1
1 2
-2 3
... ...
0x7fffffff 0xfffffffe
-0x80000000 0xffffffff

 

728x90

https://learn.microsoft.com/ko-kr/windows/win32/api/winuser/nf-winuser-getasynckeystate

 

GetAsyncKeyState 함수(winuser.h) - Win32 apps

함수가 호출될 때 키가 작동 또는 중단되었는지 여부와 GetAsyncKeyState에 대한 이전 호출 후 키를 눌렀는지 여부를 확인합니다.

learn.microsoft.com

윈도우즈 프로그램에서 키를 눌렀는지 상태 확인용으로 사용하는 GetAsyncKeyState 함수는 입력 값으로 int vKey 를 받는다.

SHORT GetAsyncKeyState(
  [in] int vKey
);

WinUser.h 에 아래와 같이 vKey 가 정의되어 있다. shift, ctrl 은 보이는데 alt 키가 보이지 않았다.

...
#define VK_SHIFT          0x10
#define VK_CONTROL        0x11
#define VK_MENU           0x12
#define VK_PAUSE          0x13
#define VK_CAPITAL        0x14
...

검색 해보니 VK_MENU 가 Alt 키에 대응되는 virtual key code 였다.

https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

 

Virtual-Key Codes (Winuser.h) - Win32 apps

The following table shows the symbolic constant names, hexadecimal values, and mouse or keyboard equivalents for the virtual-key codes used by the system. The codes are listed in numeric order.

learn.microsoft.com

 

728x90

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html

 

Retrieve instance metadata - Amazon Elastic Compute Cloud

For Instances built on the Nitro System, IMDS can be reached from your own network when a network appliance within your VPC, such as a virtual router, forwards packets to the IMDS address, and the default source/destination check on the instance is disable

docs.aws.amazon.com

aws ec2 인스턴스 정보를 가져오고 싶을 때 메타데이터를 이용하면 된다.

$ curl http://169.254.169.254/latest/meta-data/
$ curl http://[fd00:ec2::254]/latest/meta-data/
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
events/
hostname
iam/
instance-action
instance-id
instance-type
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups
services/

curl 같은 프로그램으로 위와 같은 IPv4 IPv6 url 을 입력하면 된다.

$ curl -sL http://169.254.169.254/latest/meta-data/public-ipv4
24.xxx.xxx.xxx

public-ipv4 나 instance-type 를 가끔 사용하게 된다.

https://stackoverflow.com/questions/625644/how-to-get-the-instance-id-from-within-an-ec2-instance

 

How to get the instance id from within an ec2 instance?

How can I find out the instance id of an ec2 instance from within the ec2 instance?

stackoverflow.com

curl 대신에 ec2-metadata 라는 콘솔 명령어를 사용할 수도 있다.

728x90

예전에는 xml 로 백업 지원했는데 광고 사이트 폐쇄 후 재구축에 이용된다는 핑계로 기능이 사라져버렸다. 다음 블로그 폐쇄나 이번 카카오 사태로 티스토리 블로그 데이터가 접근하지 못할 수도 있다는 생각이 들어서 백업을 알아봤다.

https://tistory.github.io/document-tistory-apis/

 

소개 · GitBook

No results matching ""

tistory.github.io

티스토리에서 제공하는 Open API 를 이용해서 백업 프로그램을 짤 수 있었다.

https://luckygg.tistory.com/m/332

 

티스토리 블로그 백업 프로그램 v2.6, 무료 배포합니다!

티스토리 블로그는 백업 기능을 제공하지 않지만, Tistory Open API 를 제공하는데요. 이 API를 이용하여 티스토리 백업 프로그램을 제작해 보았습니다. 해당 프로그램을 사용하여 여러분의 티스토리

luckygg.tistory.com

여유가 있으면 직접 작성했겠지만 일단 다른 분이 작업해 둔 프로그램을 이용했다. 게시물 당 하나의 폴더에 html + 첨부 파일 형태로 백업 해주는 프로그램 이었다.

오래전 데이터는 마이그레이션이 잘못되어 있어 첨부파일 백업이 되지 않았다. 

https://wnw1005.tistory.com/m/500

 

티스토리 백업 방법

[관련 게시물] 기존 티스토리 콘텐츠 백업 작업 티스토리는 과거 블로그 내의 글들을 TTXML 형식의 파일로 손쉽게 백업할 수 있는 기능을 제공했었습니다. 그러나 2016년 12월 21일에 데이터 백업 기

wnw1005.tistory.com

다른 분이 정리해주신 내용을 참고할만 하다.

시간 나면 다른 플랫폼으로 이전하기 쉽도록 xml/json + 첨부파일 형태로 백업하는 작업을 해봐야겠다.

728x90
$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   48 bits physical, 48 bits virtual
CPU(s):                          16
On-line CPU(s) list:             0-15
Thread(s) per core:              2
Core(s) per socket:              8
Socket(s):                       1
Vendor ID:                       AuthenticAMD
CPU family:                      23
Model:                           1
Model name:                      AMD Ryzen 7 1700 Eight-Core Processor
Stepping:                        1
CPU MHz:                         2994.384
BogoMIPS:                        5988.76
Hypervisor vendor:               Microsoft
Virtualization type:             full
L1d cache:                       256 KiB
L1i cache:                       512 KiB
L2 cache:                        4 MiB
L3 cache:                        16 MiB
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Full AMD retpoline, IBPB conditional, STIBP disabled, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxs
                                 r sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl t
                                 sc_reliable nonstop_tsc cpuid extd_apicid pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 mo
                                 vbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a
                                  misalignsse 3dnowprefetch osvw topoext ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2
                                 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero xsaveerptr virt
                                 _ssbd arat

linux 장비 cpu 개수 확인할 때는 lscpu 라는 명령어를 사용하면 된다.

https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/view-cpu-options.html

 

인스턴스의 CPU 옵션 보기 - Amazon Elastic Compute Cloud

이 페이지에 작업이 필요하다는 점을 알려 주셔서 감사합니다. 실망시켜 드려 죄송합니다. 잠깐 시간을 내어 설명서를 향상시킬 수 있는 방법에 대해 말씀해 주십시오.

docs.aws.amazon.com

 

728x90
START_TIME=$(date +%s)

sleep 1

END_TIME=$(date +%s)

echo "It took $(($END_TIME - $START_TIME)) seconds to sleep of 1 second..."

linux shell 스크립트에서 경과 시간을 측정하고 싶을 때는 date 명령을 이용하면 된다.

참고 : https://code-maven.com/measure-elapsed-time-in-shell

 

Measure elapsed time in Linux shell using time and date

 

code-maven.com

 

728x90

형상 관리 시스템이 svn 으로 다시 돌아갔다. 탐색기에서는 TortoiseSVN 이 있어서 편하게 쓰고 있지만 Visual Studio 에서 log 나 blame 을 사용하려고 확장 프로그램 검색해보니 TortoiseSVN 연동해주는 TSVN 이 있었다. 마우스 오른쪽 메뉴로 TortoiseSVN 을 연동시켜주는 프로그램이다.

https://marketplace.visualstudio.com/items?itemName=SamirBoulema.TSVN 

 

TSVN 2019 - Visual Studio Marketplace

Extension for Visual Studio - Control TortoiseSVN from within Visual Studio

marketplace.visualstudio.com

 

728x90
728x90

모니터 옵션 조절 버튼을 여러번 눌러야 입력을 HDMI1 와 HDMI2 로 바꿀 수 있어 귀찮았다. 입력을 바꿀 수 있는 프로그램이 있나 싶어서 검색해봤다.

먼저 검색된 방법은 AutoHotKey 매크로로 SetVCPFeature, GetVCPFeatureAndVCPFeatureReply 를 호출하는 방식이었다. 내 PC에서는 동작하지 않았다.

https://www.clien.net/service/board/lecture/9611475

 

[미립자팁?] PC에서 단축키로 모니터의 입력소스(DVI/HDMI) 변경하기 : 클리앙

모니터에 DDC/CI라는 PC에서 모니터의 설정을 제어할 수 있는 규격이 있습니다. 보통 캘리브레이션을 할 때 많이 사용하는것 같더군요. 이제 이 인터페이스를 이용하여 간편하게 PC에서 Input Source

www.clien.net

https://kimsgomul.tistory.com/278

 

[펌] 모니터 입력소스(DVI/HDMI) 변경을 PC 단축키로 하기

모니터 한대에 PC 2대를 연결해서 사용하고 있는데 모니터 아래 메뉴 버튼을 눌러 입력소스를 바꾸는게 귀찮고 불편하다. 모니터 인풋소스를 변경하는 소프트웨어가 있는지 찾아봤는데 모니터

kimsgomul.tistory.com

https://www.entechtaiwan.com/util/moninfo.shtm

 

EnTech Taiwan | Utilities | Monitor Asset Manager

Monitor Asset Manager is a Plug and Play monitor information utility that works under all 32-bit and 64-bit versions of Windows. It is fully multi-monitor-capable, and unlike similar reporting utilities queries the monitor directly rather than relying on p

www.entechtaiwan.com

다음으로 걸린 프로그램이 ControlMyMonitor 이었다.

http://www.nirsoft.net/utils/control_my_monitor.html

 

View and modify the settings of your monitor (VCP Features)

View and modify the settings of your monitor (Also known as VCP Features), like brightness, contrast, sharpness, red/green/blue color balance, and more...

www.nirsoft.net

모니터 설정을 바꿀 수 있는 VCP Features 를 모니터마다 제공하는데 이를 이용하는 방식이다. 위 매크로와 같은 api 를 사용하는 것 같다.

실행하면 모니터와 통신을 통해 지원되는 VCP Code 와 현재, 최대, 지원되는 값을 보여준다.

오른쪽 마우스 메뉴나 F6 을 눌러 속성을 바꿀 수 있다. Current Value 값을 입력에 대응되는 값으로 바꾸면 입력이 변경된다.

모니터 입력이 변경되면 해당 모니터와 연결된 장비에서 제어해야 한다. 만약 DVI - PC, HDMI - 노트북 인 상태에서 입력을 HDMI 로 변경하면 PC에서는 더 이상 입력을 변경할 수 없고 노트북에서만 DVI 로 변경할 수 있다.

> ControlMyMonitor.exe /SetValue \\.\DISPLAY2\Monitor0 60 4

 /SetValue <Monitor String> <VCP Code> <Value> 같은 명령줄이 지원된다.

디스플레이 변경 바로 가기를 만들어서 작업표시줄에 연결시켜 사용하고 있다. 내 모니터의 경우 VCP Code 60 이 'Input Select' 에 대응되고 4 가 HDMI2 였다.

노트북에서 ControlMyMonitor 가 인식되지 않는 문제가 있었다. hdmi 2 포트 usb 케이블에 hdmi 가 연결되어 있었는데 사용하고 싶은 hdmi 케이블을 노트북에 직접 연결했더니 인식되었다.

> ControlMyMonitor.exe /SetValue Primary 60 4

<Monitor String> 이 환경에 따라 바뀌기도 한다. Primary, Secondary 같은 문자열을 지원하니 주모니터를 변경할 경우에는 Primary 를 사용하는 것이 오류 가능성을 줄일 수 있었다.

728x90

윈도우즈11 에서 불편한 점이 있다면 탐색기 우클릭 메뉴에서 더 많은 옵션 표시를 눌러야 전에 사용하던 메뉴가 보이는 점이다.

> reg.exe add “HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32” /f /ve

예전처럼 보고 싶다면 위와 같이 레지스트리를 추가하고 재부팅하면 된다. 탐색기만 재시작( taskkll /f /im explorer.exe) 해도 된다.

> reg.exe delete “HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}” /f

되돌리고 싶다면 레지스트리에서 해당 값을 지우고 재부팅하면 된다.

https://crone.tistory.com/471#:~:text=%EB%B0%94%ED%83%95%ED%99%94%EB%A9%B4%EC%97%90%EC%84%9C%20%EC%9A%B0%ED%81%B4%EB%A6%AD%20%EB%B2%84%ED%8A%BC%EC%9D%84%20%EB%88%84%EB%A5%B4%EA%B2%8C%EB%90%98%EB%A9%B4%20Windows11%20%EB%B2%84%EC%A0%84%EC%97%90%EC%84%9C%EB%8A%94%20%EC%9C%84%EC%99%80%20%EA%B0%99%EC%9D%B4,Shift%2BF10%20%EB%B2%84%ED%8A%BC%EC%9D%84%20%ED%81%B4%EB%A6%AD%ED%95%98%EC%97%AC%20%EC%84%A0%ED%83%9D%ED%95%98%EC%97%AC%EC%95%BC%EB%A7%8C%20%EA%B8%B0%EC%A1%B4%EA%B3%BC%20%EA%B0%99%EC%9D%80%20%ED%99%94%EB%A9%B4%EC%9D%B4%20%ED%99%95%EC%9D%B8%EB%90%A9%EB%8B%88%EB%8B%A4

 

Windows11 바탕화면 우클릭 더 많은 옵션 표시 기본값 설정방법

Windows11 버전부터는 전반적인 디자인요소가 일부 변경되었는데 생각외로 바탕화면에서의 우클릭 버튼은 자주 사용하게 됩니다 물론 사용자의 사용패턴마다 전혀 사용하지 않는 사용자도 있겠

crone.tistory.com

@echo off
cls
reg add "HKCU\software\classes\clsid\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
reg query HKEY_CURRENT_USER\software\classes\clsid\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32
echo InprocServer32 키가 보이면 설정이 된 것입니다.
echo 3초 뒤에 윈도우 탐색기가 재시작됩니다.
echo 작업중인 것이 있으면 Ctrl+C를 눌러 중지하세요.
echo 윈도우 탐색기 재시작 후에도 안 되면 PC를 재기동해야 합니다.
timeout /t 3 >nul
taskkill /f /im explorer.exe & start explorer

누가 만들어 둔 위와 같은 내용의 배치 파일을 받았는데 어디서 받았는지 모르겠다. ;;

728x90

+ Recent posts