Skip to content

Instantly share code, notes, and snippets.

@realfirst
realfirst / MyClass.java
Last active June 4, 2024 06:02
java playground
import java.lang.reflect.*;
class MyClass {
private String privateField = "privateValue";
public MyClass() {}
public MyClass(String arg) {
this.privateField = arg;
@realfirst
realfirst / tmux-cheatsheet.markdown
Created April 24, 2024 12:19 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#!/bin/bash
# Source https://stackoverflow.com/questions/36651091/how-to-install-packages-in-linux-centos-without-root-user-with-automatic-depen
pkgname=$1
if [ -z $pkgname ]; then
echo "Usage: ./non-root-yum-install.sh pkgname-here"
exit 1
fi
rand=$(openssl rand -base64 6)
@realfirst
realfirst / a-clash-tproxy-gateway.md
Created November 20, 2023 14:19 — forked from phlinhng/a-clash-tproxy-gateway.md
Clash as transparent proxy gateway via TPROXY

Notes

  1. If your local network use public IP ranges instead of private ones, make sure to add respecive RETURN rules to iptables to prevent looping issue
  2. Set clash as DHCP's only DNS server to allow domain-based filter (shunting) rules work
  3. Use lsof -i udp:53 to check if clash's DNS module work fine, otherwise you may have to kill systemd-resolved and any other processes occupying the UDP 53 port
  4. The given scripts will NOT hangle the traffic of gateway itself since it is not recommend to do so. If you want to redirect the egress traffic of the gateway, the following material may be useful

Reference

@realfirst
realfirst / define.py
Created August 3, 2022 02:57 — forked from lambdamusic/define.py
Access osx dictionary in python
#!/usr/bin/env python
"""
# Version
2021-08-31
# Tested on
Python 3.9
http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_wn-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd-moby-thesaurus-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd-web1913-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_elements-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd-vera-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd-jargon-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_foldoc-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd-easton-2.4.2.tar.bz2
http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_hitchcock-2.4.2.tar.bz2
@realfirst
realfirst / macos brew
Last active July 21, 2020 10:39
macos brew
brew install emacs-plus@28 --with-no-titlebar --with-modern-sexy-v1-icon
@realfirst
realfirst / docker & k8s
Last active July 10, 2020 15:35
docker & k8s
将本地docker镜像放入minikube环境
docker save altinity/clickhouse-operator | (eval $(minikube docker-env) && docker load)
docker编译go module dockerfile 代理环境设置
ENV GOPROXY https://goproxy.cn
run clickhouse
docker run -d --name clickhouse-server --ulimit nofile=262144:262144 --volume=$HOME/cl-store:/var/lib/clickhouse yandex/clickhouse-server:20.3
@realfirst
realfirst / url.txt
Created June 11, 2019 03:54
useful url
Parquet File format - Storage details
http://letsexplorehadoop.blogspot.com/2016/09/parquet-file-format-storage-details.html
@realfirst
realfirst / url.txt
Created June 11, 2019 03:54
useful url
Parquet File format - Storage details
http://letsexplorehadoop.blogspot.com/2016/09/parquet-file-format-storage-details.html