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.go
Created August 31, 2026 01:37
minimal http server(golang)
// https://github.com/kgolding/go-simple-http-server/blob/master/main.go
package main
import (
"flag"
"fmt"
"log"
"net/http"
"strconv"
)
@lixingcong
lixingcong / openwrt-change-intf-mac.sh
Created August 17, 2026 06:04
openwrt改变接口的mac地址
#!/bin/sh
# OpenWrt random mac address changer
# https://github.com/krabelize/openwrt-random-mac-changer
interface="wlan0"
current_mac=$(ifconfig ${interface} | grep "HWaddr" | awk '{print$5}')
new_mac=$(dd if=/dev/random bs=1 count=3 2>/dev/null | hexdump -C | head -1 | cut -d' ' -f2- | awk '{ print "34:36:3b:"$1":"$2":"$3 }')
if [ $? -eq 0 ]; then
@lixingcong
lixingcong / socat-relay-tcp.sh
Created June 15, 2026 02:02
socat tcp relay script
SOCAT=/usr/bin/socat
print_help() {
echo "Usage: $0 [--bind-v6] <--bind PORT> [--remote-v6] <--remote-ip IP> <--remote-port PORT>"
exit 1
}
BIND_PORT=
BIND_IP_VER=4
@lixingcong
lixingcong / copy_link.sh
Last active May 12, 2026 09:05
copy or make link
@lixingcong
lixingcong / remove_bitwarden_json_key.py
Created March 25, 2026 02:33
移除bitwarden导出json的无关键
# 用于bitwarden导出的明文json文件,删除对应的json键
# 目的是用于BeyondCompare或者meld手工对比两份密码库的差异
import json
def remove_key(d: dict, k: str):
if k in d:
del d[k]
def cleanup(filename:str):
@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 / 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 / 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 / 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