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 / demo1_static_cast.cpp
Last active February 28, 2018 11:20
Cast in C++
/*
static_cast<type>(var) 静态类型转换,编译的时c++编译器会做类型检查
基本类型(int,float...void*)能转换,通过继承关系的类之间也能相互转换
但是不能转换不同指针类型
*/
#include <iostream>
using namespace std;
struct S1{
@lixingcong
lixingcong / adblock-chrome.txt
Created April 8, 2018 09:05
AdBlock自定义规则
||https://imgcache.qq.com/ptlogin/v4/style/20/images/shouQ_v2/small_24_tiny.png
@lixingcong
lixingcong / grub2.cfg
Last active May 8, 2018 03:58
GRUB2 bootiing linux iso
menuentry "Boot Ubuntu ISO" {
set root=(hd1,msdos4)
set isofile=/lubuntu-16.04.3-desktop-amd64.iso
loopback loop $isofile
linux (loop)/casper/vmlinuz.efi persistent boot=casper iso-scan/filename="$isofile" quiet splash ro locale=zh_CN.UTF-8 noprompt --
initrd (loop)/casper/initrd.lz
}
menuentry "Boot ArchLinux ISO" {
@lixingcong
lixingcong / dante_acl.py
Created May 25, 2018 07:29
dante配置ACL生成器
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 用于打印dante.conf的socks pass/block的
# 目标规则(Target IPs)
# Document: https://www.inet.no/dante/doc/1.4.x/sockd.conf.5.html
TELEGRAM_PASS_CIDR=(
"91.108.4.0/22",
"91.108.8.0/21",
@lixingcong
lixingcong / nekosms_filter.py
Last active October 16, 2018 07:17
用于生成NekoSMS过滤规则的脚本
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Date: 2018-06-06
# NekoSMS filters print/encode
import json
# print keyword from json
def print_kw(filename):
@lixingcong
lixingcong / qt_gbk_main.cpp
Created June 27, 2018 04:01
Qt4 Qt5的GBK解码
#include <QCoreApplication>
#include <QDebug>
#include "qt_gbk_stringdecoder.h"
#include "qt_gbk_strs.h"
int main(int argc, char *argv[])
{
//QCoreApplication a(argc, argv);
#if QT_VERSION < 0x050000
@lixingcong
lixingcong / astyle_qt.conf
Created July 18, 2018 11:27
Astyle代码格式文件
--style=kr
--indent=spaces=4
--attach-inlines
--indent-cases
--indent-col1-comments
--break-blocks
--pad-oper
--align-pointer=type
--align-reference=type
--max-code-length=100
@lixingcong
lixingcong / Person.cpp
Created August 18, 2018 06:33
C++的pimpl机制demo
#include "Person.h"
#include "PersonPrivate.h"
#include "cpp14_pointers.h"
Person::Person(std::string name):
pimpl(std::make_unique<PersonPrivate>(name))
{
}
Person::~Person()
@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 / GitBashHere.reg
Last active December 29, 2020 10:12
添加"git bash"到右键菜单
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\background\shell\git_shell]
@="Git Ba&sh Here"
"Icon"="D:\\Program_Files\\Git\\git-bash.exe"
[HKEY_CLASSES_ROOT\Directory\background\shell\git_shell\command]
@="\"D:\\Program_Files\\Git\\git-bash.exe\" \"--cd=%v.\""
[HKEY_CLASSES_ROOT\Directory\shell\git_shell]