Skip to content

Instantly share code, notes, and snippets.

View hmjfk's full-sized avatar
:octocat:
unknown

Denkousi hmjfk

:octocat:
unknown
  • Japan
View GitHub Profile

D言語の注釈に合致する正規表現

(/\*[\s\S]*?\*/)|(/\+[\s\S]*?\+/)|(^[ \t]*//.*)

注釈だけ前処理し、注釈のない記述を閲覧したいときに便利。

@hmjfk
hmjfk / standardCodingRules.md
Created March 25, 2026 01:40
C言語関連の標準作法規約

-fno-rtti -fno-exceptions -ffreestanding -fno-druntime

# SPDX-License-Identifier: Apache-2.0
# Gitbash command exec function
function bashInitCmd()
{
$currentDir = '/' + $(Get-Location) -replace '\\', '/' -replace ':', ''
return "cd " + $currentDir + " && "
}
function bashCmdExec([String] $cmd, [String] $Args)
{
$bashCmd = $(bashInitCmd) + $cmd + $Args

pipで依存関係を修復する方法

pipで作業していると、こんな報告を受けることがある。

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
package x.y.z requires package1<x.y.z, but you have package1 x.y.z which is incompatible.
Successfully installed package-x.y.z

これは依存関係地獄といって、場合によってはとても厄介な問題だ。だが、pipの場合はたいてい次のような手順を踏めば問題を解決することができる。

  1. pip checkで壊れている依存関係を調べる。pipdeptreeがあれば依存関係を樹形図で表示してくれるので便利である。大量に依存関係が表示されるため、必要に応じてPOSIXのgrepやPowerShellのSelect-Stringで絞り込むとよい。

Autotool系構築装置使用上の注意点

Autotool系を採用した開発物で、構築設定を試行錯誤する場合など、複数回に渡って構築を行う場合は、以下の記録体をdir検索してから削除する必要がある。 そうしないと、C言語のmacro展開が失敗したときのように構築手順がアベコベになる。 原因は、なぜかAutotool系が構築手順などの生成物を上書きしないことによるものである。 ただし、途中で構築に失敗して再開する場合は、この問題は発生しない。

  • config.log
  • config.status
  • libtool
  • config.h (記録体の先頭に、/* config.h. Generated from config.h.in by configure. */とある場合に限る。)
  • Makefile
yt-dlp --embed-thumbnail --embed-subs --sub-langs all --embed-metadata --embed-chapters -f "bv+ba/best" [video-URL...]
Video title Rename -> Add `-o "[title].%(ext)s"` option.
`ERROR: Unable to download video: [Errno 2] No such file or directory:` -> Add `-o` option. see https://github.com/yt-dlp/yt-dlp/blob/master/README.md#output-template
Unknown Error -> Add `--downloader ffmpeg` option.
@hmjfk
hmjfk / gccの警告引数.md
Last active January 18, 2026 10:03

通常推奨されるgccの警告用引数

各種安全coding規約向けである。

-std=c2y -pedantic-errors -fanalyzer -Werror -Wextra


-Wconversion -Wsign-conversion -Wformat=2
-Wmissing-declarations -Wpacked -Wshadow -Wundef -Wunsafe-loop-optimizations
-Wuseless-cast -Wzero-as-null-pointer-constant -Wswitch-default