Skip to content

Instantly share code, notes, and snippets.

View tamanobi's full-sized avatar

Kohki YAMAGIWA tamanobi

View GitHub Profile
{
"ldsr_steps": 100,
"ldsr_cached": false,
"SCUNET_tile": 256,
"SCUNET_tile_overlap": 8,
"SWIN_tile": 192,
"SWIN_tile_overlap": 8,
"SWIN_torch_compile": false,
"control_net_detectedmap_dir": "detected_maps",
"control_net_models_path": "",
import subprocess
import json
url = 'URL_YOU_WANTED_TO_ADD_NOTEBOOK_LM'
notebook_id = 'YOUR_NOTEBOOK_ID'
at = "YOUR_AT"
cookie_str = """
YOUR_COOKIE
""".strip()
@tamanobi
tamanobi / send_file.bash
Last active January 31, 2024 03:35
他人にファイルを渡すときにめちゃくちゃ便利なやつ
#!/bin/bash
set -e
FILEPATH=$1
FILENAME=${FILEPATH##*/}
UUID=$2
# UUIDが未指定の場合、uuidgenで生成
if [ -z "$UUID" ]; then
@tamanobi
tamanobi / twitter.py
Last active November 30, 2023 14:00
Pocket API から取得した Twitter URL をもとにメディアを S3 に保存するやつ。ついでに XMP も仕込んでいる
import requests
from requests.exceptions import HTTPError
from pathlib import Path
import re
import boto3
from typing import List
import json
from libxmp import XMPFiles, XMPMeta, consts
import tempfile
@tamanobi
tamanobi / Makefile
Last active November 25, 2023 00:56
isucon
SHELL=/bin/bash
USER=$(shell whoami)
NOW:=$(shell date +%H:%M:%S)
BIN_NAME:=isuports
P_LANGUAGE=rust
SERVICE_NAME:=$(BIN_NAME).$(P_LANGUAGE).service
DB_PATH:=/etc/mysql
NGINX_PATH:=/etc/nginx
@tamanobi
tamanobi / graceful_shutdown.py
Last active December 27, 2022 02:42
Graceful shutdown on Python threading
import threading
import time
import requests
import queue
threads: list[threading.Thread] = []
stop_cue = queue.Queue(maxsize=1)
@tamanobi
tamanobi / decoder.py
Last active October 21, 2022 10:55
DTO や Entity などのクラス間をいい感じに変換する Decoder の構想
# coding: utf-8
from dataclasses import dataclass
class Result:
def __str__(self):
return f"<{self.__class__.__name__}: {self._value}>"
def is_ok(self) -> bool:
...
def ok(self):
@tamanobi
tamanobi / main.py
Last active June 15, 2022 07:27
inejctor の実験コード
from typing import Protocol
import injector
import os
class Repository(Protocol):
def get(id_: str) -> str: pass
def create(id_: str) -> str: pass
class RepoImpl(Repository):
@tamanobi
tamanobi / keybase.md
Created October 9, 2021 09:39
Keybase 認証のため

Keybase proof

I hereby claim:

  • I am tamanobi on github.
  • I am tamanobi (https://keybase.io/tamanobi) on keybase.
  • I have a public key ASCnK2TyB23ieP_TMncckI-5HcS5rqFu4z6qW_kjPqHFLQo

To claim this, I am signing this object:

@tamanobi
tamanobi / avro_cache.py
Last active September 19, 2021 17:10
DataFrame を AVRO としてキャッシュするデコレーター
# Copyright 2021 KOHKI YAMAGIWA
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE