Skip to content

Instantly share code, notes, and snippets.

View xiangchu0's full-sized avatar

xiangchu xiangchu0

View GitHub Profile
@xiangchu0
xiangchu0 / percona-server-5.7.x-build-notes.md
Last active May 3, 2019 07:18
percona-server-5.7.x-build-notes

dependencies debian9.x

apt install gcc g++ cmake make automake autoconf libtool git scons \
flex bison libncurses5 libncurses5-dev libreadline5 libreadline-dev \
libaio1 libaio-dev libev4 libev-dev \
curl libcurl3 libcurl4-openssl-dev libssl-dev zlib1g-dev

boost_1_68_0

@xiangchu0
xiangchu0 / .Xresources
Last active September 4, 2017 14:50
siweixiang_dot_file_config
! Terminal: xterm
xterm.locale:true
xterm.utf8: true
xterm*utf8Title:true
xterm*fontMenu*fontdefault*Label:Default
xterm*faceName:xos4 Terminus Regular:antialias=true:pixelsize=12
xterm*faceNameDoublesize:WenQuanYi Micro Hei Mono:pixelsize=12:antialias=true
@xiangchu0
xiangchu0 / placement_new_issues_with_gcc6
Created September 9, 2017 07:30
placement new issues with gcc6
There seems to be a misunderstanding in the following parts.
src/boost/function/function_template.hpp at line 572
src/boost/function/function_base.hpp at line 308
Here are the errors as reported by gcc:
src/boost/function/function_template.hpp:572:11: error: placement new constructing an object of type 'network_boost::algorithm::detail::token_finderF<network::detail::normalize_path_segments(network::string_view)::<lambda(char)> >' and size '8' in a region of type 'char' and size '1' [-Werror=placement-new=]
src/boost/function/function_base.hpp:308:13: error: placement new constructing an object of type 'network_boost::detail::function::functor_manager_common<network_boost::algorithm::detail::token_finderF<network::detail::normalize_path_segments(network::string_view)::<lambda(char)> > >::functor_type {aka network_boost::algorithm::detail::token_finderF<network::detail::normalize_path_segments(network::string_view)::<lambda(char)> >}' and size '8' in a region of type 'char' and size '1' [-Werror=placement-ne
@xiangchu0
xiangchu0 / qemu-system-aarch64.txt
Created November 2, 2017 06:53
qemu-aarch64-launch-example
qemu-system-aarch64 -smp 2 -m 1024 -M virt -bios QEMU_EFI.fd -nographic \
-device virtio-blk-device,drive=image \
-drive if=none,id=image,file=xenial-server-cloudimg-arm64-uefi1.img \
-device virtio-blk-device,drive=cloud \
-drive if=none,id=cloud,file=cloud.img \
-netdev user,id=user0 -device virtio-net-device,netdev=user0 -redir tcp:2222::22 \
-cpu cortex-a57
@xiangchu0
xiangchu0 / tuntest.c
Created January 18, 2018 01:09
tuntest-icmp
/*
iptables -t mangle -A PREROUTING -p icmp -j MARK --set-mark 0x15
iptables -t mangle -A PREROUTING -p udp -j MARK --set-mark 0x15
iptables -t mangle -A PREROUTING -p tcp -j MARK --set-mark 0x15
echo 1 > /proc/sys/net/ipv4/ip_forward
ip rule add fwmark 0x15 lookup 100
ip route add 0.0.0.0/0 dev tun0 table 100
@xiangchu0
xiangchu0 / gcc-musl
Last active January 18, 2024 05:51
gcc cross compile
#!/bin/sh -ex
# http://git.z3bra.org/cross/file/cross-gcc.html
# Couple of useful links:
# + http://wiki.osdev.org/GCC_Cross-Compiler
# + http://wiki.osdev.org/Cross-Compiler_Successful_Builds
# + https://git.framasoft.org/Ypnose/solyste/blob/master/scripts/create-crossenv
# + http://kegel.com/crosstool/
# + https://github.com/GregorR/musl-cross/tree/master/patches
#
# 0. download gcc, binutils, gmp, mpc, mpfr
@xiangchu0
xiangchu0 / build_env.org
Last active September 23, 2020 11:43
openwrt environment
#!/bin/bash
WRT_HOME=$(cd "$(dirname "$0")"; pwd)
echo "script_path: $WRT_HOME"

G_GCC=$(sed -n -E -e 's/^CONFIG_GCC_VERSION="(.*?)"$/\1/p' ${WRT_HOME}/.config)
G_LIBC=$(sed -n -E -e 's/^CONFIG_LIBC="(.*?)"$/\1/p' ${WRT_HOME}/.config)
G_PKG_ARCH=$(sed -n -E -e 's/^CONFIG_TARGET_ARCH_PACKAGES="(.*?)"$/\1/p' ${WRT_HOME}/.config)
G_ARCH=$(sed -n -E -e 's/^CONFIG_ARCH="(.*?)"$/\1/p' ${WRT_HOME}/.config)
@xiangchu0
xiangchu0 / host-network-setup.sh
Created April 18, 2018 10:00 — forked from x2c3z4/host-network-setup.sh
Run OpenWrt on QEMU virtual machines with LAN and WAN network.
#
# The following script will
# - Create Linux bridge $BR_WAN, $BR_LAN
# - Install IP addresses and basic routes
# - Enable proxy_arp on $BR_WAN
# - Enable ip_forward
# - Enable MASQUERADE on $IF_INET
# - $BR_LAN, $BR_WAN has to be allowed in ~/.usr/etc/qemu/bridge.conf
#
@xiangchu0
xiangchu0 / pstack
Created July 24, 2018 02:20
pstack
#!/bin/sh
function __pstack() {
if test ! -r /proc/$1; then
echo "Process $1 not found." 1>&2
exit 1
fi
# GDB doesn't allow "thread apply all bt" when the process isn't
# threaded; need to peek at the process to determine if that or the