シェルスクリプト

カレントディレクトリのファイル名一覧をテキストファイルに書き出す

find . -maxdepth 1 -type f -name "*.png" \
-exec basename {} .png \; \
> list.txt

-maxdepth 階層フィルタ -type ファイル種類フィルタ -name 名前フィルタ -exec バッチ処理コマンド ※エスケープしたセミコロン;記号が必要

quartzでObsidianを公開

  1. ghとghqでquartzをクローン

※コマンド説明は下記ページ参照 https://qiita.com/itkrt2y/items/0671d1f48e66f21241e2

gh repo fork jackyzha0/quartz --fork-name your_repo_name --clone=false
ghq get git@github.com:YOUR_USERNAME/your_repo_name.git
cd $(ghq root)/github.com/YOUR_USERNAME/your_repo_name
npm i
npx quartz create
  1. quartz/contentに公開するmdファイルを用意

  2. github pageの公開

  3. 1度github上にプッシュ

  4. github上で以下の設定変更

  5. Settings > Environments -> github pagesのルールを削除
  6. Settings > GitHub Pages > Build and deployment -> Github Actionsに変更

  7. quartz/.github/workflows/deploy.ymlに以下のgithub actionを作成

name: Deploy Quartz site to GitHub Pages
 
on:
  push:
    branches:
      - v4
 
permissions:
  contents: read
  pages: write
  id-token: write
 
concurrency:
  group: "pages"
  cancel-in-progress: false
 
jobs:
  build:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0 # Fetch all history for git info
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - name: Install Dependencies
        run: npm ci
      - name: Build Quartz
        run: npx quartz build
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: public
 
  deploy:
    needs: build
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

参考 https://mizzy.org/blog/2025/08/30/1/

sketchfabで断面アニメーション

blenderブーリアンは反映されない →各タイムフレームのモデルをシークエンスで書き出す

以下スクリプトを利用

import bpy

obj = bpy.context.active_object  # Boolean modifier付きのモデルを選択
start_frame = 1  # アニメーション開始フレーム
end_frame = 100  # 終了フレーム
collection = bpy.data.collections.new("MeshSequence")  # 新しいコレクション作成
bpy.context.scene.collection.children.link(collection)

track_name = "CrossSectionAnimation"  # 共通のNLAトラック名

for frame in range(start_frame, end_frame + 1):
    bpy.context.scene.frame_set(frame)
    dup_obj = obj.copy()
    dup_obj.data = obj.data.copy()
    dup_obj.animation_data_clear()
    bpy.context.scene.collection.objects.link(dup_obj)
    collection.objects.link(dup_obj)
    bpy.context.view_layer.objects.active = dup_obj
    for mod in dup_obj.modifiers:
        if mod.type == 'BOOLEAN':
            bpy.ops.object.modifier_apply(modifier=mod.name)
    
    # Scaleをそのフレームだけ(1,1,1)にキー、他のフレームでは(0,0,0)
    dup_obj.scale = (0, 0, 0)  # デフォルトを0に
    dup_obj.keyframe_insert(data_path="scale", frame=frame - 1)
    dup_obj.keyframe_insert(data_path="scale", frame=frame + 1)
    dup_obj.scale = (1, 1, 1)  # このフレームで表示
    dup_obj.keyframe_insert(data_path="scale", frame=frame)
    
    # アクションをNLAトラックにプッシュ
    if dup_obj.animation_data is None:
        dup_obj.animation_data_create()
    action = dup_obj.animation_data.action
    if action:
        # NLAトラックを取得または作成
        if not dup_obj.animation_data.nla_tracks:
            track = dup_obj.animation_data.nla_tracks.new()
            track.name = track_name
        else:
            track = dup_obj.animation_data.nla_tracks.get(track_name)
            if not track:
                track = dup_obj.animation_data.nla_tracks.new()
                track.name = track_name
        # アクションをstripとして追加
        strip = track.strips.new(action.name, frame, action)
        # 元のアクションをクリア(オプション)
        dup_obj.animation_data.action = None

# 平面のアニメーションも同じNLAトラックに統合(平面オブジェクトを選択して実行、またはここに追加)
# 例: plane = bpy.data.objects['Plane']  # 平面の名前を指定
# plane.animation_data.action を同様にプッシュ

# Graph EditorでscaleのInterpolationをConstantに手動調整

※フレームごとの表示モデルの切り替えはvisibilityプロパティはsketchfabは非対応のため、スケールアニメーションを利用

yt-dlpによる保存

①シークレットウィンドウでyoutubeにログイン ②https://www.youtube.com/robots.txtを新規タブで開く ③Get cookies.txt LOCALLYアドオンでキャッシュをテキストファイルで保存 ④シークレットウィンドウを閉じる

※複数端末で行う場合は端末情報が更新されない場合がある

yt-dlp --cookies ./cookies.txt ‘https://www.youtube.com/playlist?list=UUMOZlDXzGoo7d44bwdNObFacg’ --write-thumbnail --embed-thumbnail --embed-metadata --write-sub --socket-timeout 30 --download-archive "finished.txt" --ignore-errors  --output "%(upload_date)s-%(title)s.%(ext)s" --retries 3 -t mp4