Skip to content

Instantly share code, notes, and snippets.

View yousong's full-sized avatar
🖐️
flexing my fingers

Yousong Zhou yousong

🖐️
flexing my fingers
View GitHub Profile
<6>[256282.769730] mtk_soc_eth 1e100000.ethernet eth0: port 2 link down
<6>[256578.881271] mtk_soc_eth 1e100000.ethernet eth0: port 2 link up
<3>[264861.388401] mtk_soc_eth 1e100000.ethernet eth0: transmit timed out
<6>[264861.400996] mtk_soc_eth 1e100000.ethernet eth0: dma_cfg:80000067
<6>[264861.413302] mtk_soc_eth 1e100000.ethernet eth0: tx_ring=0, base=0eac0000, max=0, ctx=2914, dtx=2707, fdx=2707, next=2914
<6>[264861.435210] mtk_soc_eth 1e100000.ethernet eth0: rx_ring=0, base=0d910000, max=0, calc=911, drx=912
<6>[264861.855749] mtk_soc_eth 1e100000.ethernet: 0x100 = 0x3860190c, 0x10c = 0x80818
<6>[264861.870450] mtk_soc_eth 1e100000.ethernet: reset pse
<0>[264861.888311] skbuff: skb_over_panic: text:8033dc64 len:1568 put:1568 head:8ee1dc60 data:8ee1dca2 tail:0x8ee1e2c2 end:0x8ee1e2c0 dev:eth0
<6>[264861.889769] mtk_soc_eth 1e100000.ethernet: PPE started
<6>[256282.769730] mtk_soc_eth 1e100000.ethernet eth0: port 2 link down
<6>[256578.881271] mtk_soc_eth 1e100000.ethernet eth0: port 2 link up
<3>[264861.388401] mtk_soc_eth 1e100000.ethernet eth0: transmit timed out
<6>[264861.400996] mtk_soc_eth 1e100000.ethernet eth0: dma_cfg:80000067
<6>[264861.413302] mtk_soc_eth 1e100000.ethernet eth0: tx_ring=0, base=0eac0000, max=0, ctx=2914, dtx=2707, fdx=2707, next=2914
<6>[264861.435210] mtk_soc_eth 1e100000.ethernet eth0: rx_ring=0, base=0d910000, max=0, calc=911, drx=912
<6>[264861.855749] mtk_soc_eth 1e100000.ethernet: 0x100 = 0x3860190c, 0x10c = 0x80818
<6>[264861.870450] mtk_soc_eth 1e100000.ethernet: reset pse
<0>[264861.888311] skbuff: skb_over_panic: text:8033dc64 len:1568 put:1568 head:8ee1dc60 data:8ee1dca2 tail:0x8ee1e2c2 end:0x8ee1e2c0 dev:eth0
<6>[264861.889769] mtk_soc_eth 1e100000.ethernet: PPE started
set -o errexit
set -o pipefail
set -o xtrace
ip netns del ns0 || true
ip netns del ns1 || true
ip netns add ns0
ip netns add ns1
@yousong
yousong / golang-many-args-many-members.sh
Created December 5, 2018 03:56
build time, executable size with varying number of func args, struct members
na() {
a_params=("a1 string")
a_vars=("a1")
a_args=("\"a1\"")
a_members=("a1 string")
for i in `seq 2 $n`; do
a_params+=(", a$i string")
a_vars+=(", a$i")
a_args+=(", \"a$i\"")
a_members+=("; a$i string")
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
struct buf_t {
From 40429a3a60dd3f3d7a04cc6934d8bd28db4edc61 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 20 Apr 2018 15:54:37 +0800
Subject: [PATCH] emulator: load libGLES_android.so from /system dir
Existence of /vendor/lib64/egl/ will cause qemu.gles to be set to 2.
Which will result in the libGLES_android.so to have no chance to be
loaded at all. It's part of the frameworks anyway, so treble should not
be an issue.

Links

https://github.com/wongsyrone/openwrt-1/blob/master/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr2041n-v1.c

https://github.com/wongsyrone/openwrt-1/issues/24

http://www.openwrt.org.cn/bbs/thread-19738-1-1.html
@yousong
yousong / intro.md
Last active January 24, 2018 08:54
memory leak in sort command of coreutils-8.4-31.el6

I noticed this issue when a --merge sort was killed because of oom. It shouldn't.

Sort utility built from vanilla coreutils-8.4.tar.xz was not affected.

Sort utility built from coreutils-8.4-31.el6.src.rpm fails and valgrind show that it was caused by coreutils-i18n.patch

The issue was caused by calls to mbsrtowcs, wcsrtombs which will modify *src to NULL causing later free() to fail.

The code snippet

@yousong
yousong / install-adb.sh
Last active September 9, 2016 11:26
Tools for android devs
#!/bin/sh
BASEURL="https://github.com/corbindavenport/nexus-tools/raw/master/bin"
PREFIX="$HOME/.usr"
BINDIR="$PREFIX/bin"
install_bin() {
local f