Skip to content

Instantly share code, notes, and snippets.

View lixingcong's full-sized avatar
😂
Face With Tears of Joy...

Lixingcong lixingcong

😂
Face With Tears of Joy...
View GitHub Profile
@lixingcong
lixingcong / main-nowcoder.cpp
Last active April 14, 2024 08:51
牛客网、力扣CPP本机demo
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
//#include <cmath>
#include <cstdio>
//#include <limits>
#include <stack>
#include <queue>
@lixingcong
lixingcong / sysctl.conf
Last active December 1, 2023 12:26
适用于个人的Linux VPS内核调优
# 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
# 系统所有进程一共可以打开的文件数量, 每个套接字也占用一个文件描述字
@lixingcong
lixingcong / remove-first-line-of-markdown.py
Created October 26, 2023 05:58
从Notion导出的markdown删掉第一行的同名标题
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)
@lixingcong
lixingcong / muse-lxc.zsh-theme
Last active October 12, 2023 02:45
zsh theme: muse-lxc
#!/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
@lixingcong
lixingcong / Makefile
Last active January 13, 2023 01:51
C/C++ Makefile template
# 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))
@lixingcong
lixingcong / Employee.cpp
Created December 29, 2022 09:09
Qt implicitly shared class demo 隐式共享
#include "Employee.h"
#include <QString>
class EmployeeData : public QSharedData
{
public:
EmployeeData()
: id(-1)
{}
@lixingcong
lixingcong / my_site.conf
Last active October 18, 2022 06:23
nginx autoindex timezone setting
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;
}
@lixingcong
lixingcong / dl_move_files_to_test.py
Last active June 18, 2022 16:07
深度学习,递归地移动某目录下所有文件到别处,用于划分测试集
#!/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
@lixingcong
lixingcong / curl-head.php
Created November 11, 2017 01:57
php-curl send HEAD request
<?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
@lixingcong
lixingcong / chnroute_update.txt
Last active September 28, 2021 09:44
chinaroute路由表更新命令
路由表使用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