This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define WIN32_LEAN_AND_MEAN | |
#define NOMIMNAX | |
#include <Windows.h> | |
#include <processthreadsapi.h> | |
// If this parent process is killed before the hosted process gets the time to initialize (especially when the system is busy), | |
// the "Application Error" dialog will pop up with error code 0xc0000142 (STATUS_DLL_INIT_FAILED) | |
// as noted in the Note: | |
// | |
// https://learn.microsoft.com/en-us/windows/console/creating-a-pseudoconsole-session#creating-the-hosted-process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define WIN32_LEAN_AND_MEAN | |
#define NOMINMAX | |
#include <Windows.h> | |
#include <array> | |
#include <cstdio> | |
#include <chrono> | |
#include <thread> | |
#include <vector> | |
constexpr int FileCount = 1024; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define WIN32_LEAN_AND_MEAN | |
#define NOMINMAX | |
#include <Windows.h> | |
#include <AclAPI.h> | |
#include <psapi.h> | |
#include <sddl.h> | |
#include <cassert> | |
#include <cstdio> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://blog.kyubuns.dev/entry/2023/04/22/201156 | |
// | |
// IReadOnlyDictionary<TKey, TValue> は、IEnumerable<KeyValuePair<TKey, TValue>> を | |
// 実装できるためには invariant でなければならない (いつもの)。 KeyValuePair<TKey, TValue> はもちろん invariant だから。 | |
// | |
// IReadOnlyDictionary で返さなくてよければもっといろいろできるのだが。 | |
// でもやっぱり標準の型である IReadOnlyDictionary をインターフェースにしたいこともありがちで。 | |
using System.Collections; | |
using System.Diagnostics.CodeAnalysis; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define WIN32_LEAN_AND_MEAN | |
#define NOMINMAX | |
#include <Windows.h> | |
#include <cassert> | |
#include <cstdio> | |
namespace | |
{ | |
void PrintLastError(const char* name) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Improved Interpolated Strings を濫用して、 string 以外の結果を生成してみる。 | |
using System.Runtime.CompilerServices; | |
using System.Text; | |
/* | |
args[0] = C:\Program Files\dotnet\dotnet.exe | |
args[1] = build | |
args[2] = Sugoi App\Sugoi App.sln | |
args[3] = --nologo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# すべての Visual Studio インスタンスを更新する。管理者権限で実行する。 | |
#Requires -Version 7.0 | |
$vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" | |
$vs_installer = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" | |
$instances = & $vswhere -prerelease -format json -sort | ConvertFrom-Json | |
# 古いバージョンから更新する | |
[array]::Reverse($instances) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
#include <cstdio> | |
#include <cstdio> | |
#include <cstring> | |
#include <sys/socket.h> | |
#include <unistd.h> | |
constexpr int SocketMaxFdsPerCall = 1; | |
struct CmsgFds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# order-only prerequisites の使用例: 自動生成されるヘッダファイル | |
# https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html#Prerequisite-Types | |
all: app | |
PROTO_SRCS = foo.proto bar.proto | |
CC_SRCS = app.cc foo.pb.cc bar.pb.cc | |
CC_OBJS = $(CC_SRCS:.cc=.o) | |
-include $(PROTO_SRCS:.proto=.proto.d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
#include <stdio.h> | |
#include <signal.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <stdbool.h> | |
#include <memory.h> |
NewerOlder