Skip to content

Instantly share code, notes, and snippets.

View XiaochenCui's full-sized avatar
🌴
On vacation

Xiaochen Cui XiaochenCui

🌴
On vacation
View GitHub Profile
@XiaochenCui
XiaochenCui / wireguard.conf
Created August 12, 2021 01:17 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
@XiaochenCui
XiaochenCui / gdb-cheatsheet.md
Last active August 20, 2019 13:45
gdb cheat sheet

Layout

  • layout split : Displays source, disassembly and command windows.
  • layout regs : Displays register window.
  • ctrl-x + a : reset layout

Registers

  • i r <register_name> : print a single register, e.g i r rax, i r eax
  • x/Nx addr : Display a hex dump of N words starting at virtual address addr. If N is omitted, it defaults to 1. addr can be any expression.
  • x/Ni addr : Display the N assembly instructions starting at addr. Using $eip as addr will display the instructions at the current instruction pointer.

k8s service iptables

初始

[root@node1 ~]# ifconfig -a
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.33.3.1  netmask 255.255.255.0  broadcast 0.0.0.0
        inet6 fe80::42:edff:fea4:ed64  prefixlen 64  scopeid 0x20<link>
        ether 02:42:ed:a4:ed:64  txqueuelen 0  (Ethernet)
gateway_1   | time="2019-07-01T03:11:43.355216683Z" level=info msg="response: 232307015a48525a31564732454a4f30324738564c0100061307010b0b1328" _source="inline_server/main.go:263"
gateway_1   | time="2019-07-01T03:11:43.355539853Z" level=debug msg="integralPackage: 232307fe4f3931534133354958313338554742494a0100061307010b0b1ede" _source="gateway/splitter_inline.go:71"
gateway_1   | time="2019-07-01T03:11:43.356061739Z" level=debug msg="frag: " _source="gateway/splitter_inline.go:44"
gateway_1   | time="2019-07-01T03:11:43.356307058Z" level=debug msg="checksum: da" _source="pkg/bcc.go:10"
gateway_1   | time="2019-07-01T03:11:43.357224651Z" level=debug msg="command flag: 2" _source="gateway/response.go:12"
gateway_1   | time="2019-07-01T03:11:43.357654491Z" level=debug msg="update: YV8VI9ZAH2I8EEK00" _source="gateway/connections.go:18"
gateway_1   | qemu: uncaught target signal 11 (Segmentation fault) - core dumped
@XiaochenCui
XiaochenCui / kafka-cheat-sheet.md
Created June 20, 2019 07:52 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@XiaochenCui
XiaochenCui / devops-cheatsheet.md
Last active June 20, 2019 05:45
devops cheasheet

Hbase shell

  • count rows of a table
    hbase org.apache.hadoop.hbase.mapreduce.RowCounter <tablename>

Kafka

  • count message of a topic

./bin/kafka-run-class.sh kafka.tools.GetOffsetShell

@XiaochenCui
XiaochenCui / note.md
Created May 9, 2019 06:21
Network Issues
@XiaochenCui
XiaochenCui / note.md
Created May 8, 2019 02:42
Network library, knowledge, etc.