Ansible

ansibleの使い方 install brew install ansible 接続確認 ❯ cat hosts [server] xxx.xxx.xxx.xxx 実行 ❯ ansible server -i hosts -m ping -u ubuntu 18.183.206.58 | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" }, "changed": false, "ping": "pong" } playbook適用 ❯ cat playbook.yml --- - name: Update web servers hosts: server remote_user: ubuntu become: true tasks: - name: Run the equivalent of "apt-get update" as a separate step ansible.builtin.apt: update_cache: yes syntax-check ansible-playbook playbook.yml --syntax-check dryrun ansible-playbook playbook.yml -i hosts -C -D 適用 ansible-playbook playbook.yml -i hosts playbookの探し方 https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html ...

July 12, 2022 · 1 min · motoki yoan

Journalctl の使い方

忙しい人向け journalctl -u mariadb.service -xe serviceを指定する journalctl -u mariadb.service tailする journalctl -e tail -f journalctl -f 詳細情報 journalctl -xe

July 10, 2022 · 1 min · motoki yoan

Multiplayer Game Programming読本

multiplayer game programmingという本を気になる部分だけつまみ食いして読んでいる 今日はChapter 4にあった"Compression"をまとめる 英語の見出しは本文のタイトルを引用し、日本語の見出しは私がみやすさでつけたもの Compression マルチプレイのリアルタイム性のあるゲームであればあるほど、通信するオブジェクトと頻度が増え必要な通信帯域が増加する そのため、可能な限り無駄な情報は削減して通信を行う必要がある この章では低レベルな圧縮方法の紹介を行っている Sparse Array Compression 本で扱っているサンプルゲームでは名前を128byteまで許容されている。 名前の配列に128byteの配列を利用するのがプログラムとしては妥当だが、128byte使い切らないユーザーも含まれるため不要なスペースができてしまう。 そこで、名前長 + 名前というバイト列にする事で余計なスペースを除去するという圧縮方法 Entropy Encoding 以下の章ではオブジェクトの方向と回転を表す7つのfloatの圧縮方法について記載されている 参考書ではbyte配列を渡す想定をしているが、理解を助けるために下記のような構造体の形式で書いていく // 合計 28byte type XXX struct { type Location struct { x float y float z float } type Quartunion struct { qx float qy float qz float qw float } } 頻出する状態には短いデータを与えましょう。という内容 サンプルゲームではキャラがほとんどY=0のポジションにいる特性を利用してY=0ならばtrue, そうでなければfalse+floatの情報を送っている // 合計 24byte + 1bit type XXX struct { type Location struct { x float ybit bool y float z float } type Quartunion struct { qx float qy float qz float qw float } } Fixed point Locationの他の2軸の圧縮をする この内容はゲームの特性と相談になるが、整数値にすることでサイズを減らそうというもの 本では縦横に40000(おそらくpx)が表現できれば良いため、int16でよいという内容だった ...

May 11, 2022 · 2 min · motoki yoan

git restoreってなんだ

不適切なファイルをgit addしてしまいました weblog % git add content/posts/git-restore.md weblog % git status On branch main Your branch is up to date with 'origin/main'. Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: content/posts/git-restore.md こういった場合 git reset <FILE>を使ってunstagedにしていました が、上の例にもあるけど、git restoreを使えというサジェストが出ています そもそも気がついたときのログにはadd/rmのサジェストも出ています Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) git add/rm: commitされた内容を更新する git restore: working directoryの内容を破棄する という違いがあるようです 今回のように間違ってaddしてしまった場合は、git restoreの方が正しそうです。 試してみます。 ...

January 8, 2021 · 1 min · motoki yoan

もともとJavaプロジェクトでKotlinをインポートさせたい

やりたいこと JavaのプロジェクトにKotlinを入れたい 発生した状況 build.gradleの差分 diff --git a/build.gradle b/build.gradle index xxxxxxxxxx..xxxxxxxx --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ plugins { id '...' id '...' id '...' + id 'org.jetbrains.kotlin.jvm' version '1.4.10' } + +compileKotlin { + kotlinOptions.jvmTarget = '1.8' +} エラー (正確にはSuccessを返しているが、buildで失敗する) > Task :prepareKotlinBuildScriptModel UP-TO-DATE <ij_msg_gr>JEE project import errors<ij_msg_gr><ij_nav>/path/to/project/build.gradle<ij_nav><i><b>root project 'example': Web Facets/Artifacts will not be configured properly</b><eol>Details: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':runtimeClasspath'.<eol>Caused by: org.gradle.internal.locking.LockOutOfDateException: Resolved 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10' which is not part of the dependency lock state</i> Could not resolve: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10 Could not resolve: org.jetbrains.kotlin:kotlin-stdlib:1.4.10 Could not resolve: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 Could not resolve: org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10 Could not resolve: org.jetbrains:annotations:13.0 KotlinDslScriptsParameter(correlationId=176802187286571, scriptFiles=[]) => StandardKotlinDslScriptsModel(scripts=[], commonModel=CommonKotlinDslScriptModel(classPath=[], sourcePath=[], implicitImports=[]), dehydratedScriptModels={}) - took 0.0 secs Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings BUILD SUCCESSFUL in 1s エラーの意味がよくわからずドハマリ…(Facets??, Artifacts??) ...

January 8, 2021 · 2 min · motoki yoan