Skip to content

Instantly share code, notes, and snippets.

Avatar
😂
Face With Tears of Joy...

Lixingcong lixingcong

😂
Face With Tears of Joy...
View GitHub Profile
@lixingcong
lixingcong / sysctl.conf
Last active Oct 6, 2021
适用于个人的Linux VPS内核调优
View sysctl.conf
# 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 / chnroute_update.txt
Last active Sep 28, 2021
chinaroute路由表更新命令
View chnroute_update.txt
路由表使用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
@lixingcong
lixingcong / php-client_get.php
Last active Jul 5, 2021
PHP测试POST/GET/JSON解析ECHO的demo
View php-client_get.php
<?php
function get($url, $hostname, $data=NULL)
{
$fullUrl=$url;
if(NULL!==$data){
$fullUrl.= '?'.http_build_query($data);
}
@lixingcong
lixingcong / muse-lxc.zsh-theme
Last active Jun 5, 2021
zsh theme: muse-lxc
View muse-lxc.zsh-theme
#!/usr/bin/env zsh
# update: 2021-06-05
# 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 / demo1.cpp
Last active Apr 14, 2021
C各种指针:数组指针,函数指针,回调函数,指针的引用,指针的指针
View demo1.cpp
#include <iostream>
#include "math.h"
// 数组指针
using namespace std;
const int COL = 2;
void printRowData(int* p)
View build-shadowsocks.sh
#!/bin/bash
# Update: 2021-03-17
# Modified by lixingcong
# Fork from https://github.com/necan/shadowsocks-libev-static-build
# Attention: modified from https://github.com/shadowsocks/shadowsocks-libev/blob/master/docker/mingw/build.sh
# The script does not need to run as root
@lixingcong
lixingcong / fetchUrl_gzip.php
Created Feb 8, 2021 — forked from mgng/fetchUrl_gzip.php
file_get_contents で Accept-Encoding:gzip 指定
View fetchUrl_gzip.php
<?php
function fetchUrl( $url, $gzip = false ) {
$raw = file_get_contents( $url, false, $context = stream_context_create( array(
'http' => array(
'method' => 'GET',
'header' => 'Accept-Encoding:' . ( $gzip ? 'gzip,deflate' : 'identity' ) . "\r\n",
)
) ) );
if ( $raw === false ) {
@lixingcong
lixingcong / delete_git_submodule.md
Created Dec 30, 2020 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.
View delete_git_submodule.md

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@lixingcong
lixingcong / GitBashHere.reg
Last active Dec 29, 2020
添加"git bash"到右键菜单
View GitBashHere.reg
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]
@lixingcong
lixingcong / curl-head.php
Created Nov 11, 2017
php-curl send HEAD request
View curl-head.php
<?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