Skip to content

Instantly share code, notes, and snippets.

View lxzheng's full-sized avatar

Lingxiang Zheng lxzheng

  • Xiamen University
View GitHub Profile
@lxzheng
lxzheng / c_api.h
Created July 22, 2023 03:29
tflite 2.13.0 c api in tensorflow-lite-2.13.0.aar
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@lxzheng
lxzheng / rec.sh
Last active October 6, 2022 14:23
ubuntu用ffmpeg对指定窗口区域录屏,同时录制声音。## know bug:若窗口太靠近屏幕边缘,有可能引起录制区域超出屏幕范围而失败。
#!/bin/bash
if [[ "$1" == "" ]]; then
echo usage: $0 file.mp4
exit
fi
export LANG=C
echo "select the window with mouse for recording:"
geo=`xwininfo |grep geometry`
loc=${geo#*geometry }
size=${loc%%+*}
@lxzheng
lxzheng / del_local_route.sh
Created March 5, 2022 07:12
del local network route add by vpn incorrectly
for i in {2..7}
do
sudo route del -net 192.168.1.$[2**i] netmask 255.255.255.$[256-2**i]
done
for i in 0 3
do
sudo route del -net 192.168.1.$i netmask 255.255.255.255
done
@lxzheng
lxzheng / rp4_usb_gadget_ethernet_uart.md
Last active July 16, 2022 02:52
raspberrypi 4 USB OTG gadget ethernet

树莓派4虚拟网卡与串口终端

树莓派在启动时, 会从SD卡里读取一些系统配置参数. 包括硬件功能等,这些参数配置储存在/boot/config.txt文件中。在linux内核启动时,可以指定一些相关的启动参数,在树莓派中,内核命令行启动参数存放在/boot/cmdline.txt。在树莓派4中启动USB虚拟网卡或串口终端需要修改这两个文件

USB 虚拟网卡配置

修改/boot/config.txt

在文件的[pi4][all]小节中添加如下配置。关于config.tx文件的详细说明参见 树莓派文档

@lxzheng
lxzheng / usb-freedos.txt
Last active October 16, 2018 15:27
install free dos and bios flash tools to usb disk
#download freedos iso img FD12CD.iso from http://www.freedos.org/
#download bios file and uzip to bios dir
#create an empty disk image
dd if=/dev/zero of=dos48m.img bs=1k count=48k
#install free dos to disk img
qemu-system-x86_64 -cdrom FD12CD.iso dos48m.img -boot d
#after installed the free dos, mount the disk image and copy bios flash files into the img.
sudo losetup -P -f dos48m.img
losetup -j dos48m.img
#mount the foud out loop dev loop19p1
@lxzheng
lxzheng / autoipv6
Last active January 1, 2018 16:23
setup ipv6 when network up
#!/bin/sh
INTERFACE=$1 # 状态发生变化的网络接口
STATUS=$2 # 网络接口的新状态:up, down, vpn-up, vpn-down
IF_WIFI=wlp2s0
IF_ETH=enp0s25
IPV4_DEV=ppp0
ISATAP_ROUTER=210.34.219.49
XMU_IPV6_PREFIX=2001:da8:e800:45c0:200:5efe
LANG=en