Skip to content

Instantly share code, notes, and snippets.

View CFM880's full-sized avatar
🎉
Focusing

Cheng Fangming CFM880

🎉
Focusing
View GitHub Profile
@CFM880
CFM880 / Readme.md
Created April 14, 2017 06:09 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@CFM880
CFM880 / conv.sh
Created February 20, 2019 14:59
iconv批量带目录转换编码(iconv batch with directory conversion encoding)
if [ $# != 4 ]
then
echo -e "\n脚本需要四个参数"
echo -e " 参数1: 原始编码格式\n 参数2:目标编码格式\n 参数3: 待转码的文件目录\n 参数4: 转码后的文件目录\n"
echo -e "示例: icon.sh from_encoding to_encoding in_dir out_dir\n"
exit
else
FROM_ENCODING=$1
TO_ENCODING=$2
IN_DIR=$3
@CFM880
CFM880 / build_lame_armv7.sh
Created April 23, 2019 00:25
lame Android Build shell
NDK_ROOT=$ANDROID_NDK
PREBUILT=$NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
PLATFORM=$NDK_ROOT/platforms/android-9/arch-arm
export PATH=$PATH:$PREBUILT/bin:$PLATFORM/usr/include:
export LDFLAGS="-L$PLATFORM/usr/lib -L$PREBUILT/arm-linux-androideabi/lib -march=armv7-a"
export CFLAGS="-I$PLATFORM/usr/include -march=armv7-a -mfloat-abi=softfp -O2"
export CPPFLAGS="$CFLAGS"
export CFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="$LDFLAGS"
NDK_ROOT=$ANDROID_NDK
PREBUILT=$NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
PLATFORM=$NDK_ROOT/platforms/android-9/arch-arm
export PATH=$PATH:$PREBUILT/bin:$PLATFORM/usr/include:
export LDFLAGS="-L$PLATFORM/usr/lib -L$PREBUILT/arm-linux-androideabi/lib -march=armv7-a"
export CFLAGS="-I$PLATFORM/usr/include -march=armv7-a -mfloat-abi=softfp -O2"
export CPPFLAGS="$CFLAGS"
export CFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="$LDFLAGS"
NDK_ROOT=$ANDROID_NDK
PREBUILT=$NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
PLATFORM=$NDK_ROOT/platforms/android-9/arch-arm
export PATH=$PATH:$PREBUILT/bin:$PLATFORM/usr/include:
export LDFLAGS="-L$PLATFORM/usr/lib -L$PREBUILT/arm-linux-androideabi/lib -march=armv7-a"
export CFLAGS="-I$PLATFORM/usr/include -march=armv7-a -mfloat-abi=softfp -O2"
export CPPFLAGS="$CFLAGS"
export CFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="$LDFLAGS"
@CFM880
CFM880 / replace_date.sh
Last active April 27, 2019 04:48
android系统打包,替换编译时间脚本
#!/bin/bash
function replaceDate() {
formfat_date="`LC_ALL='C' TZ='Asia/Shanghai' date -u`"
date_long="`date +%s`"
echo ${formfat_date}
echo ${date_long}
sed -i "s/ro.build.date=.*/ro.build.date=$formfat_date/g" build.prop
sed -i "s/ro.build.date.utc=.*/ro.build.date.utc=$date_long/g" build.prop
}
@CFM880
CFM880 / bat_git_clone_repos.sh
Created May 5, 2019 14:50
批量下载某个github账户下的repo
#!/bin/bash
curl https://api.github.com/users/zhanxiaokai/repos | grep "clone_url" | sed "s/ \"clone_url\": \"/ /g" | sed "s/\",/ /g" > clone_url.txt
cat clone_url.txt | while read line
do
git clone $line
done
@CFM880
CFM880 / push_to_more_one.sh
Created May 21, 2019 05:56
同时push文件到多台android设备上
#!/usr/bin/env bash
devices_info=`adb devices`
echo $devices_info
devices_info=`echo ${devices_info} | sed 's/^List of devices attached//'`
devices_info=(${devices_info})
device_names=""
for(( i=0;i<${#devices_info[@]};i++));
do
if [ $((i%2)) == 0 ]; then
device_names=${device_names}" "${devices_info[i]}
@CFM880
CFM880 / adb_options.sh
Last active May 21, 2019 06:03
根据id对应的视频文件下载对应的视频文件保存为id.mp4,同时生成局域网流媒体对应的json配置
#!/usr/bin/env bash
devices_info=`adb devices`
echo $devices_info
devices_info=`echo ${devices_info} | sed 's/^List of devices attached//'`
devices_info=(${devices_info})
device_names=""
for(( i=0;i<${#devices_info[@]};i++));
do
if [ $((i%2)) == 0 ]; then
device_names=${device_names}" "${devices_info[i]}