Skip to content

Instantly share code, notes, and snippets.

@imaedat
imaedat / commands.md
Last active October 20, 2025 14:07
各種コマンドのメモ

tshark

tshark -tad -n -P -l -i lo -Yssl -dtcp.port==10443,ssl -Ossl
オプション 意味
-tad 絶対時刻、日付付き、でタイムスタンプを表示
-n 名前解決をしない
@imaedat
imaedat / cpp_memo.md
Last active November 2, 2025 17:09
C++メモ

静的解析ツール

cppcheck --enable=all *.cpp

clang-tidy --checks='-*,clang-analyzer-*,-clang-diagnostic-error,modernize-*,-modernize-use-trailing-return-type,performance-*,bugprone-*' *.cpp
# インクルードパスを追加したい場合は `--extra-arg=-Ipath/to/include`
@imaedat
imaedat / make-cert.bash
Last active July 26, 2024 14:34
プライベートCA証明書とホスト証明書の作成
# プライベートCA証明書(と秘密鍵)
openssl req -x509 -nodes -newkey rsa:4096 -extensions v3_ca -days 3650 -subj "/CN=localhost" -keyout cakey.pem -out cacert.pem
# ホスト秘密鍵と証明書
openssl req -nodes -newkey rsa:4096 -subj "/CN=localhost" -keyout hostkey.pem | \
openssl x509 -req -days 3650 -CAcreateserial -CA cacert.pem -CAkey cakey.pem -out hostcert.pem \
-extfile <(printf "basicConstraints=CA:FALSE\nauthorityKeyIdentifier=keyid,issuer\nsubjectKeyIdentifier=hash\nsubjectAltName=DNS:localhost,IP:127.0.0.1")
@imaedat
imaedat / demangle.cpp
Created March 26, 2024 15:12
デマングルした型名を得る
#include <cxxabi.h>
#include <typeinfo>
std::string typename_(const char *raw_name)
{
int status;
char *n = abi::__cxa_demangle(raw_name, 0, 0, &status);
std::string name(n);
free(n);
@imaedat
imaedat / hexdump.c
Last active February 25, 2024 22:02
コピペ用簡易 hexdump 関数
void hexdump(const void *buf, size_t size)
{
if (size == 0) {
return;
}
const unsigned offsets[] = {
48, 46, 44, 42, 40, 38, 36, 33,
31, 29, 27, 25, 23, 21, 19, 16,
};