Skip to content

Instantly share code, notes, and snippets.

@MizunagiKB
MizunagiKB / protobuf_json.py
Last active March 20, 2022 04:34
jsonを読み込んでProtocol buffersで定義された形式でバイナリを出力するPythonコードのサンプル
import google.protobuf.json_format
import test_pb2
# test.proto
# $ protoc --python_out=. test.proto
"""
syntax = "proto3";
message Test {
bool b_value = 1;
@MizunagiKB
MizunagiKB / il_discovery.ipynb
Last active October 17, 2021 04:23
Illust discovery
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MizunagiKB
MizunagiKB / ExportPageGroupLayer.arscript
Last active September 26, 2021 07:24
特定のグループ名をPNG出力するARScript(要UTF-16LEで保存)
//===========================================================================
//===========================================================================
// ArtRage Script File.
//===========================================================================
//===========================================================================
//===========================================================================
// Version Block - Script version and ArtRage version:
//===========================================================================
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MizunagiKB
MizunagiKB / python_20210314.py
Last active March 14, 2021 12:38
indexの使用方法についての解説
def main():
# index関数は、リストに保存されている物と一致している
# ものを検索します。
# 複数存在している場合は、先に見つかったインデックスを戻します。
# 見つからない場合は ValueError という例外が発生します。
# -----------------------------------------------------------------------
# 数値や文字列が格納されたリストの例)
@MizunagiKB
MizunagiKB / pyxel_line_2.py
Last active February 21, 2021 23:47
位置履歴を使ったレーザーの描画(2)
import pyxel
import math
# レーザーの長さ
MAX_LASER_HISTORY = 8
# レーザー色(お好みで)
LASER_COLOR = [2, 2, 2, 2, 8, 9, 10, 7]
# レーザーの長さとレーザー色の数が一致しているかのチェック
# (数が誤っているとエラーを出して教えてくれます)
assert MAX_LASER_HISTORY == len(LASER_COLOR)
@MizunagiKB
MizunagiKB / pyxel_line_1.py
Last active February 22, 2021 00:53
位置履歴を使ったレーザーの描画(1)
import pyxel
# レーザーの長さ
MAX_LASER_HISTORY = 8
# レーザー色(お好みで)
LASER_COLOR = [7, 6, 5, 1, 1, 1, 1, 1]
# レーザーの長さとレーザー色の数が一致しているかのチェック
# (数が誤っているとエラーを出して教えてくれます)
assert MAX_LASER_HISTORY == len(LASER_COLOR)
@MizunagiKB
MizunagiKB / testcode.html
Created January 10, 2021 08:59
three.js sample
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
}
</style>
</head>
@MizunagiKB
MizunagiKB / pyxel_demo_rotation.py
Last active September 6, 2020 06:05
プレイヤーの周囲を回転するオプションのサンプル
"""プレイヤーの周囲を回転するオプションのサンプル
"""
import math
import pyxel
SCREEN_W = 256
SCREEN_H = 240
GAME_FPS = 60
MIN_RADIUS = 10