Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am penglei on github.
  • I am penglei (https://keybase.io/penglei) on keybase.
  • I have a public key ASCgnWjQaq4myVegOjs_zsm-5r19fSRIMOYsCeeabaOBrAo

To claim this, I am signing this object:

#!/bin/bash
iptables -t nat -N VIP-SERVICES
iptables -t nat -N VIP-DISTRIBUTION-NGINX
iptables -t nat -N VIP-DISTRIBUTION-NGINX-1
iptables -t nat -N VIP-DISTRIBUTION-NGINX-2
iptables -t nat -N VIP-POSTROUTING
iptables -t nat -I PREROUTING -j VIP-SERVICES
iptables -t nat -I OUTPUT -j VIP-SERVICES
@penglei
penglei / a-qemu-install-debian-arm64.sh
Last active April 5, 2023 09:07
run qemu-aarch64 on macOS
#!/bin/bash
#qemu-img create -f qcow2 disk.qcow2 20G
#qemu-img create -f qcow2 varstore.img 128M
debian_iso=debian-9.6.0-arm64-xfce-CD-1.iso
qemu-system-aarch64 -smp cpus=6 -M virt -cpu max -m 2G -nographic \
-drive file=QEMU_EFI.img,if=pflash,format=raw \
-drive file=varstore.img,if=pflash \
-drive file=disk.qcow2,if=virtio \
-drive file=$debian_iso,if=virtio,format=raw
#!/bin/bash
config_file=config.json
cat << EOF > $config_file
{
"signing": {
"default": {
"expiry": "87600h"
},
"profiles": {
@penglei
penglei / penglei.zsh-theme
Last active June 27, 2022 07:24
my oh-my-zsh theme
#based on steeef theme
#run bellow command in terminal to show color list
#: spectrum_ls
function _penglei_theme_info_sep {
echo "%{$FG[245]%}|%{$reset_color%}"
}
# Determine our shell
@penglei
penglei / CMakeLists.txt
Created December 28, 2020 03:38
CLion config istio-proxy
cmake_minimum_required(VERSION 3.15)
project(istio-proxy)
macro(print_all_variables)
message(STATUS "print_all_variables------------------------------------------{")
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
message(STATUS "print_all_variables------------------------------------------}")
@penglei
penglei / network-restart.sh
Created January 25, 2021 08:16 — forked from tachang/network-restart.sh
Cleanly restart the default libvirt network
#!/bin/bash
#
# Yury V. Zaytsev <yury@shurup.com> (C) 2011
#
# This work is herewith placed in public domain.
#
# Use this script to cleanly restart the default libvirt network after its
# definition have been changed (e.g. added new static MAC+IP mappings) in order
# for the changes to take effect. Restarting the network alone, however, causes
# the guests to lose connectivity with the host until their network interfaces
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@penglei
penglei / macos-ramdisk.md
Created May 12, 2023 15:28 — forked from htr3n/macos-ramdisk.md
Creating RAM disk in macOS

Built-in

diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://XXXXX`

where XXXXX is the size of the RAM disk in terms of memory blocks.

Notes:

-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEZFqvPRYJKwYBBAHaRw8BAQdA3Vgen6Cu8jje4PgglBdd4Zwsyp4YWA7dsUVs
/VZ18ge0G3BlbmdsZWkgPHBlbmdsZWlAeWJ5dGUub3JnPoiQBBMWCgA4FiEENU5u
tuafzaO8obO3s0bUg3byXssFAmRazykCGwEFCwkIBwMFFQoJCAsFFgIDAQACHgUC
F4AACgkQs0bUg3byXsvu6AEA/bG5HdA3w5VnKjqh/6X3IBIqeGD3kgVspSedtOdw
+zUA/3Z876SHRNQHPw3clfjnyw5nIKKekTWXhuJAPWTpPq4IuDMEZFqwTRYJKwYB
BAHaRw8BAQdARY0HjbH7azmVOGL6WpmCGb7GrP3p9bgU0Uq/4GIy+IWI7wQYFgoA
IBYhBDVObrbmn82jvKGzt7NG1IN28l7LBQJkWrBNAhsCAIEJELNG1IN28l7LdiAE
GRYKAB0WIQTekuh6sEYBIRbQN1WaE4Qyev94UgUCZFqwTQAKCRCaE4Qyev94Uvyg