Skip to content

Instantly share code, notes, and snippets.

View auxten's full-sized avatar
🛠️
Coding

Auxten Wang auxten

🛠️
Coding
View GitHub Profile
@auxten
auxten / export-parquet.py
Last active November 14, 2024 09:40
Export PostgreSQL table to 10 Parquet files with chDB in 15 lines
import chdb
# Get total rows
total_rows = int(chdb.query("""
SELECT COUNT(*)
FROM postgresql('192.168.3.135', 'sample_db', 'users', 'postgres', 'mysecretpassword')
""").bytes().strip())
# Calculate rows per file
rows_per_file = -(-total_rows // 10) # Ceiling division
@auxten
auxten / direct.yaml
Last active November 14, 2024 05:42
clash-rules
payload:
- DOMAIN-SUFFIX,tailscale.com
- DOMAIN-KEYWORD,quickconnect
- DOMAIN-SUFFIX,linrc.com
- DOMAIN-SUFFIX,ts.net
- PROCESS-NAME,tailscale
- PROCESS-NAME,tailscaled
- DOMAIN-KEYWORD,derp
- DOMAIN-KEYWORD,tailscale
- DOMAIN-SUFFIX,r2.cloudflarestorage.com
@auxten
auxten / got.go
Last active June 22, 2024 12:43
clone git repo and put it into ${GOPATH}/src/github.com/org/repo like go get -d
package main
import (
"fmt"
"os"
"os/exec"
"strings"
)
func main() {
@auxten
auxten / README.md
Last active January 17, 2024 15:18 — forked from cld4h/README.md
Bypass the GFW; clash fake-ip and tproxy; iptables and transparent proxy on Linux; 在Linux上通过 iptables 以及 clash 配置透明代理用于本机及局域网翻墙网关; Linux 翻墙路由器配置

This article show you the ultimate way to set up a transparent proxy on Linux using clash and iptables to bypass the GFW in China.

We use:

You can go to github gist to download all files mentioned in this article.

@auxten
auxten / cla.md
Last active December 5, 2023 06:21
chdb cla

chDB Individual Contributor License Agreement v1.0

Based on ClickHouse Individual Contributor License Agreement v1.0

Thank you for your interest in chDB (https://github.com/chdb-io/chdb). In order to clarify the intellectual property license granted with Contributions from any person or entity, the author of chDB, Github User Name:[auxten] (https://github.com/auxten) ("Author")must have a Contributor License Agreement ("CLA") on file that has been signed, accepted or otherwise agreed to by each contributor, indicating agreement to the license terms below.

You accept and agree to the following terms and conditions for Your previous, present and future Contributions submitted to the Author. Except for the license granted herein to the Author and recipients of software distributed by the Author, You reserve all right, title, and interest in and to Your Contributions.

  1. Definitions. "You" (or "Your") shall mean the undersigned person/entity, which is the copyright owner or legal entity authorized by the cop
@auxten
auxten / alloc.cpp
Created June 1, 2023 07:56
aws s3 download pre allocate disk space
#include <iostream>
#include <fstream>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/HeadObjectRequest.h>
#include <aws/s3/model/GetObjectRequest.h>
@auxten
auxten / bench_chdb_dataframe.py
Last active May 29, 2023 02:53
Bench different impl of running chdb directly on dataframe
import os
import time
import pandas as pd
import pyarrow as pa
import chdb
import subprocess
# file size 117MB
data_path = '/home/Clickhouse/bench/hits_0.parquet'
@auxten
auxten / uniswap_v2_trading_data.py
Created May 7, 2023 12:23
chdb on uniswap_v2_trading_data
import chdb
data_path = "/home/Clickhouse/bench/uniswap_v2_trading_data/*.csv"
small_data_path = "/home/Clickhouse/bench/uniswap_v2_trading_data/v2_trading_history_14025747.csv"
print("Sample: ",
chdb.query(f"select * from file('{data_path}', 'CSVWithNames') limit 10", "PrettyCompact").data())
print("Count: ", chdb.query(f"select count(*) from file('{data_path}', 'CSVWithNames')").data())
# ret = chdb.query(
@auxten
auxten / gist:707804b51d72468ad5ecb8252f12dcb0
Created April 23, 2023 06:57
chdb on c6a.4xlarge with 500g gp2
[0.4361737529999914,0.05658163800001148,0.056433019999985845],
[0.45631013700000267,0.06661815199998955,0.06499360399999432],
[1.2878869360000067,0.12046150599996963,0.12141279399997984],
[1.0351253719999818,0.19584039699998357,0.19377196099998173],
[2.000329340999997,1.3100056389999963,1.3103087160000086],
[1.8184413650000124,0.9605992319999928,0.9637660029999893],
[0.4596347169999717,0.0655916599999955,0.06513699300001008],
[0.45521096900000657,0.07589728199997126,0.07560694400001466],
[1.4177663510000116,0.7329907230000003,0.7416720749999968],
[3.5959058509999977,0.901890944999991,0.891994880000027],
@auxten
auxten / git-alias.sh
Last active July 20, 2023 08:42
git alias
alias ga='git add'
alias gaa='git add --all'
alias gap='git apply'
alias gapa='git add --patch'
alias gau='git add --update'
alias gav='git add --verbose'
alias gb='git branch'
alias gbD='git branch -D'
alias gba='git branch -a'
alias gbd='git branch -d'