Skip to content

Instantly share code, notes, and snippets.

@td2sk
td2sk / setup.sh
Last active January 14, 2023 15:51
Raspberry Pi 2 に Home Assistant を導入する
# 公式サイトにある Docker を使った手順では Addon 導入ができないなど機能制限が多い
# 推奨は Home Assistant Operating System の導入だが、 Raspberry Pi OS に入れたい場合は以下手順を取る
# この手順では AppArmor や cgroups などセキュリティ周りの設定が不完全になることに注意
# 導入後に設定画面の指示に従って適宜修正が必要
# docker を入れる
curl https://get.docker.com | sh
# 一旦再起動
@td2sk
td2sk / README.md
Created September 8, 2022 14:31
support Waifu Diffusion on Google Colab Free

Google Colab 無料枠で Waifu Diffusion を動かす

概要

  • Waifu Diffusion を Colab 無料枠で動かそうとするとメモリが溢れてしまう
    • wd-v1-2-full-ema.cpkt には画像生成するだけなら不要な情報が乗っているため
  • 本来ならfull-emaでないモデルを用意すべき
  • 暫定案としてVRAMに直接ロードするようパッチを当てると、メモリが節約できてギリギリ動作する

対応

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@td2sk
td2sk / txt2img.ipynb
Created August 29, 2022 14:32
jupyter notebook for Stable Diffusion txt2img
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@td2sk
td2sk / README.md
Last active September 6, 2022 06:10
prompt correction patch for Stable Diffusion txt2.img.py

Stable Diffusion 意味補正計算パッチ

Stable Diffusion のプロンプト上で足し算や引き算ができるようオプションを追加するパッチ

使い方例

ピラミッドを20%だけ日本に寄せる

# 計算式は ピラミッド + 20% * (日本 - エジプト)
# プロンプトは pyramid + 0.2 (japan - egypt) となる
@td2sk
td2sk / beatsaber_compress_songs_for_bmbf.py
Created August 12, 2022 11:16
Beat Saber の未圧縮曲ディレクトリを BMBF 用の zip ファイルに変換する Python スクリプト
"""Beat Saber の未圧縮ディレクトリを zip 形式に変換する
Beat Saber の曲ディレクトリが以下のようになっているとき
* 親ディレクトリ
* 曲ディレクトリ1
* 曲ディレクトリ2
* 曲ディレクトリ3
以下を出力する
-- This is free and unencumbered software released into the public domain.
local function cubic_bezier_implicit(t, p1, p2)
return p1 * (1-t) ^ 2 * t + p2 * (1-t) * t ^ 2 + t ^ 3
end
local function t_search(x, p1, p2)
if x == 0 then
return 0
elseif x == 1 then
diff --git a/avrdude/Makefile.am b/avrdude/Makefile.am
index 1d915b0..be277c8 100644
--- a/avrdude/Makefile.am
+++ b/avrdude/Makefile.am
@@ -66,7 +66,7 @@ avrdude_CFLAGS = @ENABLE_WARNINGS@
libavrdude_a_CFLAGS = @ENABLE_WARNINGS@
libavrdude_la_CFLAGS = $(libavrdude_a_CFLAGS)
-avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB_1_0@ @LIBUSB@ @LIBFTDI1@ @LIBFTDI@ @LIBHID@ @LIBELF@ @LIBPTHREAD@ -lm
+avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB_1_0@ @LIBUSB@ @LIBFTDI1@ @LIBFTDI@ @LIBFTD2XX@ @LIBHID@ @LIBELF@ @LIBPTHREAD@ -lm
#!/usr/bin/perl
######################################################################
#
# File : split_bootimg.pl
# Author(s) : William Enck <[email protected]>
# Description : Split appart an Android boot image created
# with mkbootimg. The format can be found in
# android-src/system/core/mkbootimg/bootimg.h
#
# Thanks to alansj on xda-developers.com for