Skip to content

Instantly share code, notes, and snippets.

View satorunooshie's full-sized avatar
👻

Satoru Kitaguchi satorunooshie

👻
View GitHub Profile
@satorunooshie
satorunooshie / request.go
Created July 19, 2022 03:46
App Store Server Notifications V2でドキュメントに存在しないフィールドを保存する
type Payload struct {
// 省略.
Type *string `json:"type"`
WebOrderLineItemID *string `json:"webOrderLineItemId"`
Unknown map[string]json.RawMessage `json:"-"`
}
// NOTE: omitempty など json tag を追加する場合は修正が必要.
func (r *Payload) UnmarshalJSON(b []byte) error {
rv := reflect.ValueOf(r).Elem()
@satorunooshie
satorunooshie / list.csv
Last active July 19, 2022 09:37
App Store Server Notifications V2 notification type list
type description subtype
CONSUMPTION_REQUEST 返金リクエスト開始
DID_CHANGE_RENEWAL_PREF サブスクリプションプランをアップグレード・ダウングレード 1. UPGRADE 2. DOWNGRADE
DID_CHANGE_RENEWAL_STATUS サブスクリプションの自動更新を再度有効化・無効化 1. AUTO_RENEW_ENABLED 2. AUTO_RENEW_DISABLED
DID_FAIL_TO_RENEW サブスクリプションの購入失敗 1. GRACE_PERIOD(決済猶予期間のため使用可能) 2. ''(利用停止できる)
DID_RENEW サブスクリプション正常更新 1. BILLING_RECOVERY(期限切れのサブスクリプションが更新成功) 2. ''(自動更新成功)
EXPIRED サブスクリプションが期限切れ 1. VOLUNTARY(更新を無効にして期限切れ) 2. PRICE_INCREASE(値上げに同意せず期限切れ)
GRACE_PERIOD_EXPIRED サブスクリプションを更新せずに決済猶予期間が終了したため利用停止できる
OFFER_REDEEMED プロモーション・オファーまたはオファーコードの引き換え 1. INITIAL_BUY 2. RESUBSCRIBE 3. UPGRADE 4. DOWNGRADE 5. ''(利用中のサブスクリプションのオファーの引き換え)
PRICE_INCREASE システムが自動更新できるサブスクリプションの価格上昇をユーザーに通知 1. PENDING 2. ACCEPTED(同意した場合もしくは同意が不要の場合)
@satorunooshie
satorunooshie / notification_type.diff
Created July 19, 2022 09:41
App Store Server Notifications v1とv2の変更点
- INITIAL_BUY
- INTERACTIVE_RENEWAL
- CANCEL
- PRICE_INCREASE_CONSENT
+ OFFER_REDEEMED
+ EXIRED
+ GRACE_PERIOD_EXPIRED
+ PRICE_INCREASE
@satorunooshie
satorunooshie / service.go
Last active July 20, 2022 06:20
video synthesis sample code
package service
import (
"bytes"
"context"
"fmt"
"io"
"os/exec"
)
@satorunooshie
satorunooshie / Dockerfile
Created December 10, 2023 12:40
Dockerfile for debugging Vim
FROM ubuntu:latest
RUN apt update -y && apt install -y git gettext \
libtinfo-dev libacl1-dev \
libgpm-dev build-essential \
file gdb && \
\
git clone --depth 1 https://github.com/vim/vim.git && \
cd ./vim && make && make install && \
sed -i -e "s?^#\(CFLAGS = -g$\)?\1?g" ./src/Makefile && \
@satorunooshie
satorunooshie / vim-startuptime.json
Last active May 9, 2025 00:56
vim-startuptime.json
{"schemaVersion":1,"style":"for-the-badge","label":"startuptime","message":"17.33 msec","logoColor":"#019733","color":"brightgreen","namedLogo":"vim"}
@satorunooshie
satorunooshie / example-vim-startuptime-actions.yaml
Created May 30, 2024 14:08
example of vim-startuptime GitHub Actions
name: vim-startuptime
on: [push, pull_request]
env:
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
jobs:
measure-speed:
runs-on: ubuntu-latest
@satorunooshie
satorunooshie / create-openai-lambda-layer.sh
Created April 21, 2025 19:41
create openai lambda layer
mkdir -p lambda-layer/python && \
pip3 install \
--platform manylinux2014_x86_64 \
--target=lambda-layer/python \
--implementation cp \
--python-version 3.11 \
--only-binary=:all: \
--no-deps \
openai>=1.0.0 \
pydantic>=2.0.0 \
@satorunooshie
satorunooshie / create_reproducible_zip.py
Created May 6, 2025 00:46
Create Reproducible ZIP Archives
import zipfile
import os
import sys
def create_reproducible_zip(source_dir, output_path, exclude_prefix=None):
with zipfile.ZipFile(output_path, "w", zipfile.ZIP_DEFLATED) as zf:
for root, _, files in os.walk(source_dir):
for file in sorted(files):
full_path = os.path.join(root, file)
rel_path = os.path.relpath(full_path, source_dir)