Skip to content

Instantly share code, notes, and snippets.

View maildrop's full-sized avatar

Mikito TOGURO maildrop

View GitHub Profile
@maildrop
maildrop / wow64.cpp
Created July 22, 2023 03:11
プロセスが WOW64上で動いてるかどうかを判定 もしくは、ホストのnative アーキテクチャを判定
#include <tchar.h>
#include <windows.h>
#include <iostream>
#include <locale>
int main(int,char*[])
{
std::locale::global( std::locale{""} );
USHORT processMachine;
@maildrop
maildrop / README.md
Last active February 1, 2024 06:53
Apache Maven を docker から使う

introduction

Javaのバージョン

Debian 11 Java 11 Debian 12 Java 17

Debian では、alternatives で使用する系を変更することができますが、これはシステムワイドに影響を及ぼすので実用上クロスコンパイルをする必要があります。 そこで、バージョン毎にapache-mavenとjavacをコンテナ化してdocker上でコンパイル環境を用意するモチベーションが生まれます。

ファイル

@maildrop
maildrop / hidkeyremap.plist
Created March 30, 2023 13:24
macOS hid keyremap - lanchctl で Windowsの 変換無変換 を使用可能な状態にする。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.iogilab.hidkeyremap</string>
<key>ProgramArguments</key>
<array>
#include <iostream>
#include <type_traits>
#include <iterator>
#include <initializer_list>
#include <tuple>
#include <array>
#include <memory>
#include <algorithm>
#include <cassert>
(with-current-buffer (get-buffer "mit")
; tramp-sh.el L.4228 intramp-open-shell format HISTFILE
(format "HISTFILE=%s"
(tramp-shell-quote-argument
(let ((tramp-path
(tramp-sh-handle-expand-file-name
(let ((tramp-path default-directory))
(string-match (nth 0 tramp-file-name-structure) tramp-path)
(format "/%s:%s%s:%s"
(match-string (nth 1 tramp-file-name-structure) tramp-path)
@maildrop
maildrop / README.md
Last active August 4, 2022 09:12
vcredist_x64.exe を winget.exe で導入する

はじめに

C,C++ で作成したプログラムを配布する際には vc_redist.{x64,x86}.exe 通称 Microsoft Visutal C++ 再配布パッケージ を先に導入する必要があります。 このファイルは、VC\Redist\MSVC\v143\vc_redist.x64.exe 等のパスにあります

FOR /f "usebackq delims=" %a in ( `"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath ` ) DO echo "%~a\VC\Redist\MSVC\v143\vc_redist.x64.exe"

で取得できます。 (何故 cmd.exe で書いてあるかというと nmake でビルドする用につくってあったものをコピペしてきたから。)

しかしながら、ファイルサイズが少々あるのが難点と、vc_redist は、バージョンアップが行われる事が多々あるため、いつまでも古いバージョンを添付するのは避けたいという思いがあります。

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
# branches: [ "main" ]
tags:
@maildrop
maildrop / README.md
Last active October 14, 2024 23:41
Run maven from another directory , Apache Maven を別のディレクトリから動かすためのスクリプト

Apache Maven を別ディレクトリから動かすためのスクリプト

Apache maven は、基本的に「プロジェクトのルートディレクトリ」で起動させる必要がある。 これは、ソースコードツリーのコマンドラインから動かすときに大変面倒臭いことになるため

直近の pom.xml の位置を探す。その pom.xml に /project/parent/relativePath が指定されていた場合は、それはサブモジュールであると思い親のpom.xml のあるディレクトリに移動する mvn を実行する サブモジュールの場合は -am -pl オプションを追加して実行する スクリプトを作成した。

  • -am (--also-make) 依存関係の親に対しても実行する
@maildrop
maildrop / ignore_gcc_attribute.c
Created June 7, 2022 05:29
gcc 拡張の __atribute__ を無視するためのマクロ 一応一通りの機能の実装がなされたのは、3.4 らしい ので、それ以下の場合は無効化する。
/*
gcc 拡張の __atribute__ を無視するためのマクロ
一応一通りの機能の実装がなされたのは、3.4 らしい ので、それ以下の場合は無効化する。
*/
#include <stdlib.h>
#include <stdio.h>
/* Test for GCC 3.4.0 */
#if !( defined(__GNUC__) && \
( __GNUC__ > 3 || (__GNUC__ == 3 && (__GNUC_MINOR__ > 4 || (__GNUC_MINOR__ == 4 && __GNUC_PATCHLEVEL__ > 0 ) ))))
@maildrop
maildrop / vswhere.el
Created November 10, 2021 08:54
e-lisp で vswhere を使用して、最新版の installationPath を取得する
(let ((installation-path (substring ; vswhere から、最新版の installationPath を取得し、行末の改行文字を外す
(shell-command-to-string
(concat
(shell-quote-argument
(concat (file-name-as-directory (getenv "ProgramFiles(x86)"))
(file-name-as-directory "Microsoft Visual Studio" )
(file-name-as-directory "Installer")
"vswhere.exe"))
" -latest -property installationPath"))
0 -1)))