Skip to content

Instantly share code, notes, and snippets.

View celeron633's full-sized avatar
👻
defunct

celeron633 celeron633

👻
defunct
View GitHub Profile
@celeron633
celeron633 / v2ray-tproxy-v2.sh
Created April 1, 2023 03:57
iptables script for v2ray transparent proxy
#!/bin/bash
INTERFACE_NAME='ens18'
REDIR_PORT='1088'
# 开启代理
start()
{
echo "start tproxy begin"
@celeron633
celeron633 / 01-netcfg.yaml
Created March 26, 2023 13:58
01-netcfg.yaml for netplan
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp1s0:
dhcp4: no
addresses: [192.168.31.2/24]
gateway4: 192.168.31.1
@celeron633
celeron633 / config.json
Created March 26, 2023 09:43
v2ray config support shadowsocks for windows with v2ray-plugin
{
"log": {
"loglevel": "info"
},
"inbounds": [
{
"port": "1",
"protocol": "trojan",
"settings": {
"clients": [
@celeron633
celeron633 / HttpClient.cc
Created March 25, 2023 10:40
HttpClient class use curl, support keep-alive
// created by chatgpt
#include <iostream>
#include <string>
#include <sstream>
#include <memory>
#include <cstdio>
#include <cstring>
#include <stdexcept>
#include <curl/curl.h>
@celeron633
celeron633 / config.json
Created March 25, 2023 01:49
personal v2fly config
{
"log": {
"loglevel": "info"
},
"inbounds": [
{
"listen": "127.0.0.1",
"port": 1234,
"protocol": "vmess",
"settings": {
@celeron633
celeron633 / v2ray_gateway.bat
Created March 16, 2023 13:16
windows cmd切换网络配置
echo off
@echo off&(cd/d "%~dp0")&(cacls "%SystemDrive%\System Volume Information" >nul 2>&1)||(color 4f&echo 请右键“以管理员身份运行”&echo.&pause&exit /b)
netsh interface ip set address "以太网" static 192.168.31.100 255.255.255.0 192.168.31.3 1
netsh interface ip set dns "以太网" static 8.8.8.8
pause
@celeron633
celeron633 / run.bat
Created March 15, 2023 15:22
bat管理员权限判断
@echo off&(cd/d "%~dp0")&(cacls "%SystemDrive%\System Volume Information" >nul 2>&1)||(color 4f&echo 请右键“以管理员身份运行”&echo.&pause&exit /b)
@celeron633
celeron633 / readme.txt
Created February 5, 2023 10:32
shadowsocks v2ray-plugin websocket over cloudfront plugin arg
mode=websocket;path=/;host=xxxxxx.cloudfront.net
@celeron633
celeron633 / readme.txt
Created February 4, 2023 05:55
acme.sh issue cert with dns
1. post issue request
acme.sh --issue -d example.com -d *.example.com --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please
2. add _acme-challenge TXT records(may be two or more, just add multiple records) in DNS vendor site
3. get cert
acme.sh --renew -d example.com -d *.example.com --yes-I-know-dns-manual-mode-enough-go-ahead-please
@celeron633
celeron633 / top_k.py
Created January 25, 2023 08:01
top k with python
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
def heapify(arr, i): #arr:数组。i:根节点 #向下调整函数
left = 2*i+1 #左节点
right = 2*i+2 #右节点
smallst = i #假设i根节点为最小
if left < k and arr[left] < arr[smallst]:
smallst = left#左子节点比最小还小则最小为右子节点
if right < k and arr[right] < arr[smallst]:
smallst = right#右子节点比最小还小则最小为右子节点