Skip to content

Instantly share code, notes, and snippets.

View xeecos's full-sized avatar

xeecos xeecos

View GitHub Profile
@xeecos
xeecos / imx179.c
Last active September 1, 2025 00:56
imx179 sensor driver
#include <media/imx179.h>
#define IMX179_ID 0x0179
#define IMX179_ID_ADDRESS 0x0002
#define IMX179_STREAM_CONTROL_REG 0x0100
#define IMX179_STREAM_ENABLE 0x01
#define IMX179_STREAM_DISABLE 0x00
#define IMX179_SW_RESET 0x0103
#define IMX179_FINE_INTEG_TIME_HIGH 0x0200
#define IMX179_FINE_INTEG_TIME_LOW 0x0201
@xeecos
xeecos / fourcc.h
Last active July 8, 2025 09:47
mp4 file fix duration
#ifndef FOURCC_H
#define FOURCC_H
#define MKTAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
#define FOURCC_ftyp MKTAG('f','t','y','p')
#define FOURCC_moov MKTAG('m','o','o','v')
#define FOURCC_mvhd MKTAG('m','v','h','d')
#define FOURCC_trak MKTAG('t','r','a','k')
#define FOURCC_tkhd MKTAG('t','k','h','d')
@xeecos
xeecos / byteswap.h
Created June 24, 2025 10:01
websocket for c++
/* Macros and inline functions to swap the order of bytes in integer values.
Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
@xeecos
xeecos / json.c
Last active June 24, 2025 14:30
req json param
svr.Post("/task", [](const Request &req, Response &res)
{
struct Task task;
json info;
int action = 0;
if(req.has_param("action"))
{
action = atoi(req.get_param_value("action").c_str());
}
if(req.has_file("task"))
@xeecos
xeecos / file.c
Last active June 25, 2025 00:59
linux directory list, get,add,delete file
#include "json.hpp"
#include <filesystem>
namespace fs = std::filesystem;
using json = nlohmann::json;
typedef enum FILE_ACTION
{
READ = 0,
UPLOAD,
@xeecos
xeecos / time.c
Last active June 24, 2025 09:02
linux. set system time
#include <time.h>
#include <sys/time.h>
void setSystemTime(int year, int month, int day, int hour, int minute, int second)
{
struct tm *p = new struct tm();
p->tm_year = year - 1900;
p->tm_mon = month - 1;
p->tm_mday = day;
p->tm_hour = hour;
@xeecos
xeecos / rgb2yuv.c
Last active June 18, 2025 09:24
查表法实现RGB888转YUV420SP
struct YUV2RGB
{
unsigned short Y_R[256],Y_G[256],Y_B[256],U_R[256],U_G[256],U_B[256],V_R[256],V_G[256],V_B[256];
};
static YUV2RGB yuv2rgb;
static inline int initYUVTables()
{
for(int i = 0; i < 256; i++)
{
@xeecos
xeecos / test.cc
Created April 21, 2025 09:03
test wasm
#include <emscripten/bind.h>
#include <emscripten/val.h>
val print_test(const char* infile, const char* outfile)
{
val ret = val::object();
//processing
ret.set("res", 0);
return ret;
}
@xeecos
xeecos / init.gradle.kts
Created October 28, 2024 04:33
全局替换gradle下载源,放到~/.gradle/下
/**
* Description: Set up mirrors for Gradle Globally
*/
val MAVEN_REPOSITORY_URL = "https://mirrors.cloud.tencent.com/nexus/repository/maven-public"
val CENTER_REPOSITORY_URL = "https://maven.aliyun.com/repository/jcenter"
val GOOGLE_REPOSITORY_URL = "https://maven.aliyun.com/repository/google"
val GRADLE_PLUGIN_REPOSITORY_URL = "https://maven.aliyun.com/repository/gradle-plugin"
gradle.settingsEvaluated {
pluginManagement {
@xeecos
xeecos / main.dart
Created August 21, 2024 07:56
flutter tab bar and push pop page example
import 'package:flutter/material.dart';
import 'pages.dart';
void main() {
runApp(const CPMain());
}
// ignore: must_be_immutable
class CPMain extends StatefulWidget {
const CPMain({super.key});