Skip to content

Instantly share code, notes, and snippets.

@c51303
c51303 / dictionary changed size during iteration.md
Created December 15, 2023 09:15
RuntimeError: dictionary changed size during iteration

错误

 for key in dict.keys():
     if not dict[key]:
         del dict[key]

调整

for key in dict.copy().keys():
@c51303
c51303 / How_to_delete_a_folder_or_files_recursively_from_an_S3_bucket.md
Last active December 15, 2023 08:45
How to delete a folder or files recursively from an S3 bucket?

递归删除指定路径下所有对象,包括子目录下的对象

import os
import sys
import boto3
from collections import deque
import multiprocessing
@c51303
c51303 / 自由是一种责任.md
Created September 26, 2023 09:31
张维迎:自由是一种责任

张维迎:自由是一种责任

发表于 2017 年 07 月 08 日 由 LIXINDAI 【本文为7月1日上午,张维迎教授在2017年北大国家发展研究院毕业典礼上的演讲。】

同学们好!首先祝贺大家毕业!

“北大人”是一种光环,也是意味着责任,特别是对我们这个苦难深重、饱受蹂躏的民族的责任。

@c51303
c51303 / navicat_reset_trial.sh
Created September 5, 2023 10:38 — forked from tuxity/navicat_premium_reset_trial.sh
Reset Navicat Premium 15/16 remaining trial days
#!/bin/bash
set -e
file=$(defaults read /Applications/Navicat\ Premium.app/Contents/Info.plist)
regex="CFBundleShortVersionString = \"([^\.]+)"
[[ $file =~ $regex ]]
version=${BASH_REMATCH[1]}
@c51303
c51303 / fastapi.md
Last active August 25, 2023 08:51
py.arch.fastapi

Fastapi

FastAPI 是一个用于构建 API 的现代、快速(高性能)的 web 框架,使用 Python 3.6+ 并基于标准的 Python 类型提示。 Typer 命令行应用,是 FastAPI 的小同胞。它想要成为命令行中的 FastAPI。


关键特性

@c51303
c51303 / pdf2image.md
Last active August 16, 2023 10:11
PDF文件转换图片

pdftoppm

sudo apt install poppler-utils
pdftoppm -jpeg filename.pdf filename.jpg

imagemagick

@c51303
c51303 / xfce.md
Last active August 15, 2023 03:43
linux.gui.xfce

调优

FAQ

How to add new application to XFCE menu list

desktop file

@c51303
c51303 / nt9.zsh-theme
Created August 15, 2023 03:21
debian_.oh-my-zsh_custom_themes_nt9.zsh-theme
local ret_status="%{%F{magenta}%}🚀%{$reset_color%}"
local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%} "
function _prompt_char() {
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
echo "%{%F{blue}%}±%{%f%k%b%}"
else
echo '%{%F{magenta}%}🚀%{%f%k%b%}'
fi
}