This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export http_proxy="127.0.0.1:7890" | |
export https_proxy="127.0.0.1:7890" | |
alias python='/usr/local/bin/python3.10' | |
PATH=~/android/bin:$PATH | |
alias ..="cd .." | |
alias ..2="cd ../.." | |
alias ..3="cd ../../.." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* stb_image - v2.29 - public domain image loader - http://nothings.org/stb | |
no warranty implied; use at your own risk | |
Do this: | |
#define STB_IMAGE_IMPLEMENTATION | |
before you include this file in *one* C or C++ file to create the implementation. | |
// i.e. it should look like this: | |
#include ... | |
#include ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generate random MAC address | |
public static String randomMACAddress() { | |
Random rand = new Random(); | |
byte[] macAddr = new byte[6]; | |
rand.nextBytes(macAddr); | |
macAddr[0] = (byte) (macAddr[0] & (byte) 254); | |
StringBuilder sb = new StringBuilder(18); | |
for (byte b : macAddr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 按分辨率压缩 | |
public Bitmap compressBitmap(Bitmap tmpBitmap) { | |
int w = tmpBitmap.getWidth() ; | |
int h = tmpBitmap.getHeight() ; | |
Matrix matrix = new Matrix(); | |
float scaleWidth = 800f / w; | |
float scaleHeight = 600f / h; | |
matrix.postScale(scaleWidth , scaleHeight); | |
Bitmap endBitmap = Bitmap. createBitmap( tmpBitmap, 0 , 0 , tmpBitmap.getWidth() , tmpBitmap.getHeight() , matrix, true ) ; | |
return endBitmap ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOCAL_PATH := $(call my-dir) | |
include $(CLEAR_VARS) | |
LOCAL_SRC_FILES := binder_client.cpp | |
LOCAL_SHARED_LIBRARIES := liblog libcutils libbinder libutils | |
LOCAL_MODULE := binder_client | |
include $(BUILD_EXECUTABLE) | |
include $(CLEAR_VARS) | |
LOCAL_SRC_FILES := binder_server.cpp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOCAL_PATH := $(call my-dir) | |
include $(CLEAR_VARS) | |
LOCAL_SRC_FILES := unix_server.c | |
LOCAL_MODULE := unixServer | |
LOCAL_SHARED_LIBRARIES := liblog | |
LOCAL_PRELINK_MODULE := false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a. Download | |
http://datahammer.de/downloads.html | |
7yuv_2.5_amd64.tar.gz | |
issue1: | |
error while loading shared libraries: libQtOpenGL.so.4: cannot open shared object file: No such file or directory | |
Solve: | |
sudo add-apt-repository ppa:rock-core/qt4 | |
sudo apt-get update | |
sudo apt-get install libqtcore4 #optional |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"configurations": [ | |
{ | |
"name": "Linux", | |
"includePath": [ | |
"${workspaceFolder}/**" | |
], | |
"defines": [], | |
"compilerPath": "/usr/bin/gcc", | |
"cStandard": "c17", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <dirent.h> | |
#include <string.h> | |
void get_cpu_load() { | |
FILE* fp = popen("uptime | awk '{print $(NF-2)}'", "r"); | |
if (fp == NULL) { | |
printf("Failed to get CPU load.\n"); | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1 | |
interface ISerialPort { | |
oneway tx(uint8_t data); | |
rx() generates (uint8_t data); | |
}; | |
// SerialPort.h - generated by hidl-gen | |
struct SerialPort : public V1_0::ISerialPort { | |
// Methods from ::vendor:: labworks::serialport::V1 0::ISerialPort follow. |
NewerOlder