Skip to content

Instantly share code, notes, and snippets.

@fafucoder
fafucoder / main.go
Created May 18, 2022 02:04 — forked from zupzup/main.go
Example for Basic AST Traversal in Go
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/printer"
"go/token"
"log"
"os"
dawn@node-3:~$ kubectl ko trace kube-system/kube-ovn-pinger-4tm8h 192.168.101.1 icmp
+ kubectl exec ovn-central-7c95745dc4-v8rb5 -n kube-system -- ovn-trace --ct=new ovn-default 'inport == "kube-ovn-pinger-4tm8h.kube-system" && ip.ttl == 64 && icmp && eth.src == 00:00:00:17:34:1A && ip4.src == 10.19.0.5 && eth.dst == 00:00:00:F9:34:7E && ip4.dst == 192.168.101.1'
# icmp,reg14=0x5,vlan_tci=0x0000,dl_src=00:00:00:17:34:1a,dl_dst=00:00:00:f9:34:7e,nw_src=10.19.0.5,nw_dst=192.168.101.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=0,icmp_code=0
ingress(dp="ovn-default", inport="kube-ovn-pinger-4tm8h.kube-system")
---------------------------------------------------------------------
0. ls_in_port_sec_l2 (ovn-northd.c:4520): inport == "kube-ovn-pinger-4tm8h.kube-system" && eth.src == {00:00:00:17:34:1a}, priority 50, uuid d80aa01b
next;
1. ls_in_port_sec_ip (ovn-northd.c:4188): inport == "kube-ovn-pinger-4tm8h.kube-system" && eth.src == 00:00:00:17:34:1a && ip4.src == {10.19.0.5}, priority 90, uuid 04b1a887
next
@fafucoder
fafucoder / rbenv-install-and-using.md
Created November 23, 2018 09:08 — forked from sandyxu/rbenv-install-and-using.md
使用 rbenv 安装和管理Ruby版本

常用的几个 Ruby 版本管理工具有:rvmrbenv,ry,rbfu。rvm 应该是最早出现、使用最多的,因为过于强大以至于违背了某个 Linux 软件开发原则,所以出现了很多轻便的替代者,其中来自 37signals 的 rbenv 就很受欢迎。ry 和 rbfu 看上去更轻便,不过使用不广泛。之前使用过rvm, 这次尝试下rbenv。

我的环境是 Ubuntu14.04

1. 安装 rbenv

rbenv的源代码托管在github,在终端中,从 github 上将 rbenv 源码 clone 到本地,然后设置 $PATH。

git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
@fafucoder
fafucoder / TrueColour.md
Created October 30, 2018 08:27 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"