This file contains 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
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <algorithm> | |
#include <cstring> | |
//#include <cmath> | |
#include <cstdio> | |
//#include <limits> | |
#include <stack> | |
#include <queue> |
This file contains 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
# source from phuslu | |
# https://phus.lu/sysctl.conf | |
# bbr | |
net.core.default_qdisc=fq | |
net.ipv4.tcp_congestion_control=bbr | |
net.ipv4.tcp_retries2 = 8 | |
# 系统所有进程一共可以打开的文件数量, 每个套接字也占用一个文件描述字 |
This file contains 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
from pathlib import Path | |
# /tmp/1.txt获取方式 | |
# find /path/to/dir -type f -name '*.md' > /tmp/1.txt | |
with open("/tmp/1.txt", 'r') as mdList: | |
for md in mdList: | |
filepath = md.strip() | |
filename = Path(md).stem | |
#print(filename) |
This file contains 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 zsh | |
# update: 2023-10-12 | |
# source | |
# https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/muse.zsh-theme | |
# search all git colors | |
# grep -o "ZSH_THEME_GIT_[A-Z_]\+" ~/.oh-my-zsh/lib/git.zsh | sort | uniq | |
# bash color list |
This file contains 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
# Get top dir | |
# https://github.com/imp/dnsmasq/blob/master/Makefile | |
TOP_DIR != pwd | |
TOP_DIR ?= $(CURDIR) | |
BIN_DIR := $(TOP_DIR)/bin | |
TARGET := $(BIN_DIR)/SimulateServer | |
OBJ_DIR := $(TOP_DIR)/obj | |
OBJECTS := $(patsubst %.cpp, %.o, $(wildcard *.cpp)) |
This file contains 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
#include "Employee.h" | |
#include <QString> | |
class EmployeeData : public QSharedData | |
{ | |
public: | |
EmployeeData() | |
: id(-1) | |
{} |
This file contains 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
location ^~ /demo { | |
alias /var/www/demo/; | |
autoindex on; | |
# set to on means use localtime | |
autoindex_localtime on; | |
# show size with unit 'MB' instead of 'Byte' | |
autoindex_exact_size off; | |
} |
This file contains 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 python3 | |
# -*- coding: utf-8 -*- | |
# | |
# 递归移动某个文件夹下的所有文件到另一个文件,作为深度学习划分测试集 | |
# 2022-06-18 | |
# | |
# 参数: | |
# python3 main.py -s <SRC-DIR> -d <DEST-DIR> -p <MOVE-PERCENT> | |
# 例子: | |
# python3 main.py E:\image-src E:\image-dest -p 90 |
This file contains 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
<?php | |
// https://stackoverflow.com/questions/1545432/what-is-the-easiest-way-to-use-the-head-command-of-http-in-php | |
$dst_url='http://qq.com/'; | |
// create a new cURL resource | |
$ch = curl_init(); | |
// set URL and other appropriate options |
This file contains 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
路由表使用cidrmerge进行合并 | |
cat route.txt| cidrmerge > route_merged.txt | |
https://github.com/karlpilkington/cidrmerge | |
ipip.net中国大陆路由表(每两个月更新一次) | |
wget https://github.com/17mon/china_ip_list/raw/master/china_ip_list.txt -O /tmp/route.txt | |
ChinaRoute ipv4路由表 | |
wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' | awk -F\| '/CN\|ipv4/ { printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > /tmp/route.txt |
NewerOlder