Skip to content

Instantly share code, notes, and snippets.

View castaneai's full-sized avatar
🥳
Watching anime

castaneai castaneai

🥳
Watching anime
View GitHub Profile
@castaneai
castaneai / gameserver.go
Last active November 29, 2023 05:54
Agones high density GameServer example with label locking method.
package main
import (
"context"
"log"
"os"
"os/signal"
"syscall"
"time"
@castaneai
castaneai / open_process.go
Created December 14, 2014 16:30
WinAPI OpenProcess in Golang
package main
import (
"fmt"
"syscall"
"unsafe"
)
type Process uintptr
@castaneai
castaneai / crista.py
Created January 11, 2018 17:48
clip studio paint -> png
import sqlite3
data = open('test.clip', 'rb').read()
sqlite_head = data.index(b'SQLite format 3')
with open('test.sqlite3', 'wb') as dbf:
dbf.write(data[sqlite_head:])
sqlite = sqlite3.connect('test.sqlite3')
image_data = sqlite.execute('select ImageData from CanvasPreview').fetchone()[0]
with open('test.png', 'wb') as imf:
imf.write(image_data)
@castaneai
castaneai / struct.py
Created August 6, 2015 06:17
python binary struct class
import struct
class Struct:
_fields = None # type: tuple
_size = None # type: int
@classmethod
def size(cls):
if cls._size is None:
@castaneai
castaneai / 00_mvvm.md
Last active October 29, 2020 15:22
[C#, WPF] MVVMで簡単なアプリを作成

[C#, WPF] MVVMで簡単なアプリを作成

実行画面

実行画面

設計図

設計図

@castaneai
castaneai / GameObjectExtension.cs
Created November 8, 2015 17:01
Unity3d SceneManager
using UnityEngine;
namespace Assets.Scripts
{
public static class GameObjectExtension
{
public static void AddChild(this GameObject parent, GameObject child)
{
var instantiatedObject = GameObject.Instantiate(child);
instantiatedObject.transform.parent = parent.transform;
@castaneai
castaneai / easeljs_detect_collision.js
Last active August 31, 2020 10:27
detecting collisions between two DisplayObjects with EaselJS (CreateJS)
window.onload = function() {
// 初期設定
var canvas = document.createElement("canvas");
canvas.width = 500;
canvas.height = 250;
document.body.appendChild(canvas);
var stage = new createjs.Stage(canvas);
// 追従する箱
var box = new createjs.Shape();
@castaneai
castaneai / _mp4_parser_go.md
Last active July 4, 2020 10:50
mp4 parsing
@castaneai
castaneai / ptes.cpp
Created January 29, 2020 08:31
ptes
#include "../headers/EARTH_PT3.h"
#include "../headers/EX_Buffer.h"
#include "Windows.h"
int main(void)
{
auto dll = LoadLibrary(L"SDK_EARTHSOFT_PT3.dll");
auto newBusFunc = reinterpret_cast<EARTH::PT::Bus::NewBusFunction>(GetProcAddress(dll, "_"));
EARTH::PT::Bus* bus;
@castaneai
castaneai / hexs-bin-convert.js
Last active September 3, 2019 16:58
converting HexString <-> Uint8Array with javascript
/**
* "1A 2B 3C" のような16進数表記文字列をバイト配列に変換する
*/
$scope.hexs2bytes = function(hexs) {
return hexs.split(' ').map(function(h) { return parseInt(h, 16) });
};
/**
* バイト配列を"1A 2B 3C"のような16進数表記文字列に変換する
*/