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 / Ubuntu no permissions.md
Last active October 10, 2023 09:01
no permissions (missing udev rules)?
cfm880@cfm880:~$ adb devices
List of devices attached
93CY18K0U	no permissions (missing udev rules? user is in the plugdev group); see [http://developer.android.com/tools/device.html]

cfm880@cfm880:~$ lsusb
Bus 002 Device 002: ID 18d1:4ee7 Google Inc. Nexus/Pixel Device (charging + debug)
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 0e0f:0008 VMware, Inc. Virtual Bluetooth Adapter
Bus 001 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
@CFM880
CFM880 / android9.patch
Last active April 19, 2023 14:57
Android AOSP 9
project art/
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index b9d51c1125..f034a3db4f 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -504,6 +504,11 @@ MemMap* MemMap::MapFileAtAddress(uint8_t* expected_ptr,
DCHECK(ContainedWithinExistingMap(expected_ptr, byte_count, error_msg))
<< ((error_msg != nullptr) ? *error_msg : std::string());
flags |= MAP_FIXED;
@CFM880
CFM880 / aosp.patch
Last active September 11, 2023 05:52
AOSP检测隐私政策patch
project frameworks/base/
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index db5dcc5c264b..404db6dfaf64 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -741,6 +741,7 @@ public class Activity extends ContextThemeWrapper
OnCreateContextMenuListener, ComponentCallbacks2,
Window.OnWindowDismissedCallback,
AutofillManager.AutofillClient, ContentCaptureManager.ContentCaptureClient {
@CFM880
CFM880 / java_download.sh
Created January 29, 2023 12:49 — forked from wavezhang/java_download.sh
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@CFM880
CFM880 / conv.sh
Last active December 3, 2019 11:50
批量GB2312转UTF-8
#!/bin/bash
function gbk2utf(){
file="$1"
echo "处理文件 '$file' ..."
iconv -f gb2312 -t UTF-8 -c "$file" > tmp
mv -f tmp "$file"
}
function getdir(){
for element in `ls $1`
@CFM880
CFM880 / 01reset_code.sh
Created July 6, 2019 12:18
teamcity Android build shell
#!/usr/bin/env bash
git_hash=kkkk
if [ -z $git_hash ];
then
echo "$i 是空字符串"
else
git reset --hard ${git_hash}
fi
@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]}
@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 / 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 / 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
}