Skip to content

Instantly share code, notes, and snippets.

@Tukki
Tukki / markdown.md
Last active June 15, 2026 11:49
markdown download

【核心角色与目标】 你是一个专业的知识管理专家。你的任务是将用户与 AI 之间的深度长对话,提炼为符合 Obsidian 语法标准的结构化 Markdown 笔记,并提供文笔记下载地址

【结构规范】 输出的 Markdown 必须严格包含以下结构:

  1. YAML Frontmatter:包含 tags(提炼 1-3 个精准标签)和 date
  2. H1 标题:精炼概括整场对话的核心主旨。
  3. 宏观总结区 (Callout):使用 Obsidian 的 > [!summary] 核心探讨与关键结论 引用块,将对话中最具洞察力的 3-4 个宏观结论进行提炼排版。
  4. 脉络对照区:使用 ## 🧭 原始对话脉络与 Q&A 对照 作为二级标题,按时间线或逻辑顺序列出原始对话的演进。
@Tukki
Tukki / .cvimrc
Last active August 30, 2018 09:49
my cVim config
" Settings
set nohud
set nosmoothscroll
set noautofocus " The opposite of autofocus; this setting stops
" sites from focusing on an input box when they load
set typelinkhints
let searchlimit = 30
let scrollstep = 70
let barposition = "bottom"
@Tukki
Tukki / setattr_test.py
Last active September 26, 2016 11:23
python setattr test
# _*_ coding: utf-8 _*_
# http://stackoverflow.com/questions/12798653/does-setattr-and-getattr-slow-down-the-speed-dramatically
# run: time python setattr_test.py
class O(object):
pass
o = O()
for i in xrange(10000000):
setattr(o, 'a', 1) # python setattr_test.py 1.44s user 0.01s system 99% cpu 1.449 total
Error: jedi-vim failed to initialize Python: jedi#setup_py_version: Vim(pyfile):Traceback (most recent call last): (in function jedi#init_python[3]..<SNR>90_init_python[48]..jedi#setup_py_version, line 18)
各种修复, 重装无果, 最后把root权限下的thefuck, colorama 卸载掉, 修复..
https://github.com/davidhalter/jedi-vim/issues/526
@Tukki
Tukki / gist:89db933126b7796130ec
Created January 14, 2016 06:57
在virtualenv里面使用bpython
http://stackoverflow.com/questions/11172379/python-and-bpython-using-different-pythonpaths-in-virtualenv
在virtualenv里面安装, 或修改 .bash/.zshrc
bpython() {
if test -n "$VIRTUAL_ENV"
then
PYTHONPATH="$(python -c 'import sys; print ":".join(sys.path)')" \
command bpython "$@"
else
@Tukki
Tukki / gist:fa9eeff81e2fe9f2868c
Created November 29, 2015 06:40
linux查看目录大小
du -hsc *
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()
@Tukki
Tukki / gist:e6a79f9bf93ad7530348
Created June 30, 2015 04:50
shell判断脚本的当前目录. bash/zsh
if [ -n "$BASH" ] ; then
_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
_basepath=$(dirname "$_DIR")
fi
if [ -n "$ZSH_VERSION" ]; then
_DIR="$(dirname $(cd -P -- "$(dirname -- "$0")" && pwd -P))"
_basepath=$_DIR
fi
@Tukki
Tukki / gist:4a931174a829e0b01b51
Created November 17, 2014 09:24
sqlalchemy reflecting all tables
Reflecting All Tables at Once
The MetaData object can also get a listing of tables and reflect the full set. This is achieved by using the reflect() method. After calling it, all located tables are present within the MetaData object’s dictionary of tables:
meta = MetaData()
meta.reflect(bind=someengine)
users_table = meta.tables['users']
addresses_table = meta.tables['addresses']
@Tukki
Tukki / django_handler500_example
Created November 8, 2014 15:49
django handler500 示例
Index: home/moo/workspace/django-trunk/docs/request_response.txt
===================================================================
--- /home/moo/workspace/django-trunk/docs/request_response.txt (revision 6657)
+++ /home/moo/workspace/django-trunk/docs/request_response.txt (working copy)
@@ -588,3 +588,29 @@
That takes care of setting ``handler500`` in the current module. As you can see
in ``django/conf/urls/defaults.py``, ``handler500`` is set to
``'django.views.defaults.server_error'`` by default.
+
+Here is example how to log the exception using Python logging API and