Skip to content

Instantly share code, notes, and snippets.

View spiritedRunning's full-sized avatar
🎯
Focusing

Zach Liu spiritedRunning

🎯
Focusing
View GitHub Profile
@spiritedRunning
spiritedRunning / .bashrc
Created March 9, 2024 02:35
bashrc 默认配置
export PATH="$PATH:/home/rockchip/android-studio/bin"
alias ..="cd .."
alias ..2="cd ../.."
alias ..3="cd ../../.."
alias ..4="cd ../../../../"
alias ..5="cd ../../../../.."
/* 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 ...
@spiritedRunning
spiritedRunning / NetUtil.java
Created January 14, 2024 16:18
mac address
// 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) {
// 按分辨率压缩
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 ;
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
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
@spiritedRunning
spiritedRunning / 7yuv_2.5_amd64
Last active November 4, 2023 09:22
7yuv install
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
@spiritedRunning
spiritedRunning / c_cpp_properties.json
Created October 9, 2023 14:13
vscode reading android framework code
[
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
@spiritedRunning
spiritedRunning / sys.c
Created July 5, 2023 04:58
linux system state
#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;
}
@spiritedRunning
spiritedRunning / ISerialPort.hal
Last active March 14, 2023 05:18
implemation serial HAL
// 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.