Skip to content

Instantly share code, notes, and snippets.

View tsanghan's full-sized avatar
🏠
Working from home

tsanghan

🏠
Working from home
View GitHub Profile
@tsanghan
tsanghan / README.md
Created April 15, 2024 04:40 — forked from aojea/README.md
kube-proxy nftables and iptables vs a Service with 100k endpoints

kube-proxy nftables and iptables vs a Service with 100k endpoints

Background

Iptables performance is limited mainly by two reasons:

The kernel community moved to nftables as replacement of iptables, with the goal of removing the existing performance bottlenecks. Kubernetes has decided to implement a new nftables proxy because of this and another reasons explained in more detail in the corresponding KEP and during the Kubernetes Contributor Summit in Chicago 2023 on the session [Iptables, end of

@tsanghan
tsanghan / etcdclient.yml
Created November 28, 2023 07:48 — forked from aojea/etcdclient.yml
etcdclient for using on kind deployments (full credit to maulioin) https://mauilion.dev/posts/etcdclient/
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
component: etcdclient
tier: debug
name: etcdclient
namespace: default
spec:
@tsanghan
tsanghan / get-docker-layers.sh
Created April 11, 2023 07:26 — forked from ben0x539/get-docker-layers.sh
pull manifest + layers from a docker image with curl with progress meter visible
#! /usr/bin/env bash
set -euo pipefail
api() {
local type endpoint registry image arg url
type=$1 endpoint=$2 registry=$3 image=$4 arg=$5
url="https://$registry/v2/$image/$endpoint/$arg"
curl --config - <<<"-u $ARTIFACTORY_CREDS" -H "Accept: $type" "$url"
}
@tsanghan
tsanghan / api_backends.conf
Created March 7, 2022 12:37 — forked from nginx-gists/api_backends.conf
Deploying NGINX Plus as an API Gateway, Part 1
upstream warehouse_inventory {
zone inventory_service 64k;
server 10.0.0.1:80;
server 10.0.0.2:80;
server 10.0.0.3:80;
}
upstream warehouse_pricing {
zone pricing_service 64k;
server 10.0.0.7:80;
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
@tsanghan
tsanghan / instructions.md
Created January 15, 2022 06:05 — forked from oprypin/instructions.md
systemd user unit + timer example

Save these files as ~/.config/systemd/user/some-service-name.*

Run this now and after any modifications: systemctl --user daemon-reload

Try out the service (oneshot): systemctl --user start some-service-name

Check logs if something is wrong: journalctl -u --user-unit some-service-name

Start the timer after this user logs in: systemctl --user enable --now some-service-name.timer

@tsanghan
tsanghan / terminal-capture.md
Created December 22, 2021 15:32 — forked from worldofprasanna/terminal-capture.md
Multiple screen terminal capture using asciinema & tmux

Commands Reference

  1. Start a new tmux named session tmux new -s terminal-capture
  2. Split the screen using these commands,
  • vertical split <C-b>"
  • horizontal split <C-b>%
  1. To navigate between the panes,
  • To goto Left pane <C-b> left-key
  • To goto Right pane <C-b> right-key
  • To goto Top pane up-key
@tsanghan
tsanghan / json2yaml
Created December 14, 2021 10:18 — forked from mboersma/json2yaml
JSON to YAML one-liner
python3 -c 'import sys, yaml, json; j=json.loads(sys.stdin.read()); print(yaml.safe_dump(j))'

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

#!/bin/bash
#
# Install required apt packages
#
REQUIRED_PKG=(apt-transport-https \
zsh \
ansible \
powerline \
python3 \
python3-powerline \