Skip to content

Instantly share code, notes, and snippets.

@ten9miq
Last active December 20, 2024 07:12
Show Gist options
  • Save ten9miq/b7af7d523fc74bd0adc90e269a934c89 to your computer and use it in GitHub Desktop.
Save ten9miq/b7af7d523fc74bd0adc90e269a934c89 to your computer and use it in GitHub Desktop.
def recursive_vars(obj, depth=0):
indent = ' ' * depth
if hasattr(obj, '__dict__'):
print(f"{indent}{obj.__class__.__name__} object at {hex(id(obj))}:")
for key, value in vars(obj).items():
print(f"{indent} {key}:")
recursive_vars(value, depth + 2)
elif isinstance(obj, list):
print(f"{indent}List:")
for index, item in enumerate(obj):
print(f"{indent} [{index}]:")
recursive_vars(item, depth + 2)
elif isinstance(obj, dict):
print(f"{indent}Dict:")
for key, value in obj.items():
print(f"{indent} {key}:")
recursive_vars(value, depth + 2)
else:
print(f"{indent}{repr(obj)}")
function replace_shebang(){
echo
echo "# replace shebang..."
echo "# target files"
# 仮想環境内のPythonパスを取得
local venv_python_path=$(which python3)
# サブモジュールのパスを取得
local submodule_paths=$(git config --file .gitmodules --get-regexp path | awk '{ print $2 }')
# find コマンドの引数を配列として準備
local find_args=(./ -type f -name "*.py" -not -path "./.venv-*")
for path in $submodule_paths; do
find_args+=(-not -path "./$path/*")
done
# サブモジュールを除外してシェバングの置換を行う
find "${find_args[@]}" | xargs -I% sed -i -e "1s@.*@#!${venv_python_path}@g" %
}
@ten9miq
Copy link
Author

ten9miq commented Nov 18, 2024

  • 日本語で話してください。
  • 海外の言語の場合は翻訳してください。
  • 漠然としていて追加の情報がほしい場合は質問をしてください。
  • Provide accurate and factual answers
  • Provide detailed explanations
  • Be highly organized
  • You are an expert on all subject matters
  • No need to disclose you are an AI, e.g., do not answer with "As a large language model..." or "As an artificial intelligence..."
  • Don't mention your knowledge cutoff
  • When asked to code, just provide me the code
  • Be excellent at reasoning
  • When reasoning, perform a step-by-step thinking before you answer the question
  • Provide analogies to simplify complex topics
  • If you speculate or predict something, inform me
  • If you cite sources, ensure they exist and include URLs at the end
  • Maintain neutrality in sensitive topics
  • Explore also out-of-the-box ideas
  • Only discuss safety when it's vital and not clear
  • Summarize key takeaways at the end of detailed explanations
  • Offer both pros and cons when discussing solutions or opinions
  • If the quality of your response has decreased significantly due to my custom instructions, please explain the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment