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
@yousong
yousong / qemustart.sh
Last active April 21, 2020 04:08
Run OpenWrt/LEDE on QEMU virtual machines with LAN and WAN network.
# The file is now part of OpenWrt repo:
#
# https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=scripts/qemustart;hb=HEAD
#
#
@yousong
yousong / META-INF-content.md
Last active April 6, 2017 15:16
Patch for compiling meizuosc/m35x kernel with GCC 5

machine_match imei.dat to see if "machine not match"

@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
@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

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
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.
#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 {
@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")