Skip to content

Instantly share code, notes, and snippets.

View nidbCN's full-sized avatar
🇨🇳
zZ

hollis gaein nidbCN

🇨🇳
zZ
View GitHub Profile
@nidbCN
nidbCN / guide_to_ffmpeg_autogen.md
Last active February 21, 2025 17:13
A Beginner's Guide to FFmpeg.AutoGen

A Beginner's Guide to FFmpeg.AutoGen

Introduction

FFmpeg.AutoGen is an auto-generated unsafe bindings for C#/.NET and Mono. It can be used in C#/.NET to invoke ffmpeg's C/C++ libraries.

The usage is the same as C/C++ API so you can refer to ffmpeg official documents. However, in C#/.NET, we need to load the libraries first, which confused me for a long time.

Here I concluded the some useful information for beginners to start using ffmpeg.AutoGen.

@nidbCN
nidbCN / compress_all.ps1
Last active February 20, 2025 16:16
Blog image compress and standardizing script
$TARGET_WIDTH = 1620
$widthDictionary = @{}
$maxWidth = 0
foreach ($f in Get-ChildItem -File *.jpg, *.png, *.bmp) {
$info = magick identify -format "%w" "$($f.Name)"
$width = $info -as [int]
$widthDictionary[$f.Name] = $width
Write-Output "Compare $($f.Name) size $width with $maxWidth"
@nidbCN
nidbCN / LoadFfMpeg.cs
Last active March 24, 2026 18:44
FFmpeg.Autogen configure ffmpeg libraries and initialize
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using CameraCaptureBot.Core.Configs;
using FFmpeg.AutoGen.Abstractions;
using FFmpeg.AutoGen.Bindings.DynamicallyLinked;
using FFmpeg.AutoGen.Bindings.DynamicallyLoaded;
using Microsoft.Extensions.Options;
namespace CameraCaptureBot.Core;
@nidbCN
nidbCN / convert_to_jxl.ps1
Created September 26, 2024 11:39
Media Scripts
$ext = ".jpg"
foreach ($img in Get-Item "*$($ext)") {
$jxlName = $img.Name.Replace($img.Extension, ".jxl")
Write-Host "converting $($img.Name) to JPEG-XL."
magick $img.Name -define jxl:effort=7 -define jxl:distance=0 -quality 100 "$($jxlName)"
magick identify "$($jxlName)"
}
import axios from 'axios'
import { Message } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
// create an axios instance
const service = axios.create({
baseURL: 'http://localhost:8887',
// baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
@nidbCN
nidbCN / partition.sh
Created March 13, 2023 13:09
Disk part for ceph devices
# sdb~e: 4x 1T DATA disk
# nvme0~1n1: 2x 3T META disk
# metadata: 2x(2x(50G DB + 10G WAL))
#!/bin/bash
NVME_DISK_LIST=("/dev/nvme0n1" "/dev/nvme1n1")
DATA_DISK_NUM=4
WAL_SIZE=10240
@nidbCN
nidbCN / mac.c
Created March 1, 2023 10:35
C Linux get macaddress via ioctl
#include <stdlib.h>
#include <errno.h>
#include <netinet/in.h>
#include <net/if.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#define MAC_ADDRESS_LENGTH (6)
@nidbCN
nidbCN / SwaggerConfig.java
Last active March 16, 2023 08:48
swagger with spring boot2
package cn.gaein.java.course_evaluation.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;