This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Kcptun server | |
Requires=network.target | |
After=network-online.target | |
[Service] | |
Type=simple | |
User=ken | |
RemainAfterExit=yes | |
Environment="MODE=fast3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.config/fish/events/ | |
# 改变目录事件 | |
function __on_pwd_changed --on-variable PWD | |
check_directory_for_new_repository | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# ## Dependencies: | |
# brew install gdrive | |
# ## Setup: | |
# gdrive account add | |
# Recursive function to download files in a folder | |
gdrive_download_files() { | |
local folder_id=$1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import click | |
from decimal import Decimal | |
from itertools import permutations, product | |
def calculate24(nums): | |
ops = list(product(["+", "-", "*", "/"], repeat=3)) # 所有可能的运算符组合 | |
num_perms = list(permutations([Decimal(n) for n in nums])) # 所有可能的数字组合 | |
result = False | |
solutions = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deduplicate(ls: list, selector=lambda x: x) -> list: | |
seen = set() | |
return [x for x in ls if (e := selector(x)) not in seen and (seen.add(e) or True)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh /etc/rc.common | |
START=00 | |
. /lib/functions/preinit.sh | |
start() { | |
[ -e /data/overlay ] || mkdir /data/overlay | |
[ -e /data/overlay/upper ] || mkdir /data/overlay/upper | |
[ -e /data/overlay/work ] || mkdir /data/overlay/work |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#### | |
# Split MySQL dump SQL file into one file per table | |
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump | |
#### | |
if [ $# -lt 1 ] ; then | |
echo "USAGE $0 DUMP_FILE [TABLE]" | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mmexport#############.jpg | |
# 微信导出的文件抹去了全部 exif 信息 | |
# 文件名后有13个数字, 前十位为时间戳(秒数),后三位可能是毫秒,不需要 | |
exiftool -P -overwrite_original -d "%s" '-DateTimeOriginal<${filename;m/(\d{10})/;$_=$1}' mmexport*.jpg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_overlap(ranges): | |
""" | |
Check if there is overlap in a list of ranges | |
""" | |
sorted_ranges = sorted(ranges, key=lambda x: x[0]) | |
for i in range(len(sorted_ranges) - 1): | |
if sorted_ranges[i][1] > sorted_ranges[i+1][0]: | |
return True | |
return False | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ping | |
apt install iputils-ping | |
# netstat | |
apt install net-tools |
NewerOlder