Skip to content

Instantly share code, notes, and snippets.

View IthacaDream's full-sized avatar
🎯
Focusing

Will IthacaDream

🎯
Focusing
  • BeiJing, China
View GitHub Profile
@IthacaDream
IthacaDream / git_ssh_proxy.md
Created August 8, 2024 12:04 — forked from chenshengzhi/git_ssh_proxy.md
git ssh 代理设置

仅为 GitHub 设置代理

git 代理

设置 git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
设置完成后, ~/.gitconfig 文件中会增加以下条目:

[http "https://github.com"]
    proxy = socks5://127.0.0.1:1086
@IthacaDream
IthacaDream / chatgpt-prompts.md
Last active October 12, 2025 13:14
chatgpt prompts

1. 扮演我的英语老师,用我给的单词构建故事

现在你来扮演我的英语老师,接下来的对话我会给你发几个英语单词,你要用我给出的单词编一个有趣的英文小故事。我发的英语单词会用括号括住,只有括号里面的单词才是你需要编成故事的,单词之间我会用逗号隔开。如果我的话里面没有括号,代表我不需要你进行编故事。这个故事你需要按照下面的模板进行回答。注意,该模板一共包括三部分,你必须将三部分都写出来。
当我发给你双引号中这句话时 "(instruction,Requests,submitted,models,improved)"
你需要按照下面的模板进行回答:

第一部分(英文原文):John was a data scientist who received a set of (instruction) to improve the accuracy of the (models) he had (submitted) for a project. He diligently followed the (requests) and spent days working on the code to make the necessary improvements. In the end, his hard work paid off and the accuracy of the models significantly (improved).
第二部分(汉语对照): 约翰是一位数据科学家,他收到了一组(instruction)来改进他为一个项目(submitted)的(model)的准确性。他勤奋地遵循了(requests),并花费了几天的时间修改代码以进行必要的改进。最终,他的辛勤工作得到了回报,模型的准确性显著(improved)了。
第三部分(词汇学习):

How to setup a practically free CDN

I've been using [Backblaze][bbz] for a while now as my online backup service. I have used a few others in the past. None were particularly satisfactory until Backblaze came along.

It was - still is - keenly priced at a flat $5 (£4) per month for unlimited backup (I've currently got just under half a terabyte backed-up). It has a fast, reliable client. The company itself is [transparent about their operations][trans] and [generous with their knowledge sharing][blog]. To me, this says they understand their customers well. I've never had reliability problems and everything about the outfit exudes a sense of simple, quick, solid quality. The service has even saved the day on a couple of occasions where I've lost files.

Safe to say, I'm a happy customer. If you're not already using Backblaze, [I highly recommend you do][recommend].

Taking on the big boys with B2

@IthacaDream
IthacaDream / part_video_to_gif.sh
Created March 19, 2021 03:46 — forked from devadvance/part_video_to_gif.sh
Create animated GIF and WebP from videos using ffmpeg
ffmpeg -ss $INPUT_START_TIME -t $LENGTH -i $INPUT_FILENAME \
-vf "fps=$OUTPUT_FPS,scale=$OUTPUT_WIDTH:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
-loop $NUMBER_OF_LOOPS $OUTPUT_FILENAME
# Change these placeholders:
# * $INPUT_START_TIME - number of seconds in the input video to start from.
# * $LENGTH - number of seconds to convert from the input video.
# * $INPUT_FILENAME - path to the input video.
# * $OUTPUT_FPS - ouput frames per second. Start with `10`.
# * $OUTPUT_WIDTH - output width in pixels. Aspect ratio is maintained.
def attach_foreignkey(objects, field, select_related=None):
"""
Shortcut method which handles a pythonic LEFT OUTER JOIN.
``attach_foreignkey(posts, Post.thread)``
"""
field = field.field
qs = field.rel.to.objects.filter(pk__in=distinct(getattr(o, field.column) for o in objects))
if select_related:
qs = qs.select_related(*select_related)