Articles

OCamlでfloatの符号の反転

OCamlではデータ型ごとに別の演算子が定義されているので(二項演算だけでなく単行演算も)他のプログラミング言語のようにfloat型の数値の

tar ballが .gzだろうが.xzだろうが.zstだろうが解凍してやる!

TL;DR #!/bin/bash untar_by_file_type() { if [[ "$1" == "application/x-tar" ]]; then tar -xvf "$2" elif [[ "$1" == "application/gzip" ]]; then tar -zxvf "$2" elif [[ "$1" == "application/x-xz" ]]; then tar -Jxvf "$2" elif [[ "$1" == "application/zstd" ]]; then tar --use-compress-program unzstd -xvf "$2" fi } untar() { if [[ "$1" == "" ]]; then echo "usage: untar <archive-filename>" exit 1 fi untar_by_file_type "$(file -b --mime-type "$1")" "$1"

[Android/kotlin] 端末にインストールしてあるアプリのパッケージを取得する

Android+kotlin インストールしてあるアプリのパッケージ名の取得 val pm = packageManager val packageInfoList = pm.getInstalledPackages(PackageManager.GET_ACTIVITIES or PackageManager.GET_SERVICES) for (packageInfo in packageInfoList) { val pkg = pm.getLaunchIntentForPackage(packageInfo.packageName) if (pkg != null) { val packageName = packageInfo.packageName val className = pkg.component?.className ?: "" Timber.i(packageName) Timber.i(className) } else { Timber.i(packageInfo.packageName) } }

[Excel]JAN-13とインジケータからGTIN-14を計算する

JAN-13とインジケータからGTIN-14を計算する関数 TD, TL A B C D 1 インジケータ JAN-13 GTIN-14 2 1 4549414003260 =CONCATENATE(TEXT(B2, “0”), LEFT(TEXT(C2, “0000000000000”), 12), TEXT(10 - MOD(SUM(VALUE(MID(C2, 1, 1)), VALUE(MID(C2, 3, 1)), VALUE(MID(C2, 5, 1)), VALUE(MID(C2, 7, 1)), VALUE(MID(C2, 9, 1)), VALUE(MID(C2,

RustでLLVM IRを扱いたいのにinkwellのコンパイルにコケる

error: No suitable version of LLVM was found system-wide or pointed to by LLVM_SYS_110_PREFIX. Consider using `llvmenv` to compile an appropriate copy of LLVM, and refer to the llvm-sys documentation for more information. llvm-sys: https://crates.io/crates/llvm-sys llvmenv: https://crates.io/crates/llvmenv --> /Users/tsunekawataiki/.cargo/registry/src/github.com-1ecc6299db9ec823/llvm-sys-110.0.1/src/lib.rs:486:1 | 486 | / std::compile_error!(concat!( 487 | | "No suitable version of LLVM was found system-wide or pointed 488 | | to by LLVM_SYS_", 489 | | env!("CARGO_PKG_VERSION_MAJOR"), ... | 496