Skip to content

Instantly share code, notes, and snippets.

View niugm's full-sized avatar
🎯
Focusing

OutofMemory niugm

🎯
Focusing
View GitHub Profile
@niugm
niugm / ffmpeg.md
Last active November 16, 2022 10:48 — forked from v5tech/ffmpeg.md
ffmpeg视频合并、格式转换、截图

使用ffmpeg合并MP4文件

ffmpeg -i "Apache Sqoop Tutorial Part 1.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i "Apache Sqoop Tutorial Part 2.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "Apache Sqoop Tutorial Part 3.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts
ffmpeg -i "Apache Sqoop Tutorial Part 4.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate4.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermediate3.ts|intermediate4.ts" -c copy -bsf:a aac_adtstoasc "Apache Sqoop Tutorial.mp4"
@niugm
niugm / utils.js
Created October 19, 2022 08:29
[utils] JavaScript utils functions #javascript #node.js
const fs = require('fs-extra');
const path = require('path');
function readdirSyncRecursive(dir, fileList = []) {
const files = fs.readdirSync(dir);
files.forEach((file) => {
const filePath = path.join(dir, file);
if (fs.statSync(filePath).isDirectory()) {
readdirSyncRecursive(filePath, fileList);
} else {
@niugm
niugm / resolution.rs
Created October 19, 2022 02:23
[Video Resolution] #rust #windows
use windows::Graphics::SizeInt32;
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Resolution {
Native,
_720p,
_1080p,
_1440p,
_2160p,
_4320p,
@niugm
niugm / BlackHoleAVCaptureAudioPreviewOutput.swift
Created December 22, 2021 16:08 — forked from banjun/BlackHoleAVCaptureAudioPreviewOutput.swift
Set AVCaptureSession output to BlackHole or another arbitrary device by an output device name
private let audioOutput: AVCaptureAudioPreviewOutput = {
let audioOutput = AVCaptureAudioPreviewOutput()
audioOutput.volume = UserDefaults.standard.volume
struct Device {
var name: String?
var uid: String?
}
var devicesProperty = AudioObjectPropertyAddress(mSelector: kAudioHardwarePropertyDevices, mScope: kAudioDevicePropertyScopeOutput, mElement: kAudioObjectPropertyElementWildcard)
var devicesSize: UInt32 = 0
@niugm
niugm / WindowCapture.swift
Created December 22, 2021 16:08 — forked from banjun/WindowCapture.swift
specific window capture implementation memo for https://github.com/mzp/HeartVoice
import Cocoa
import CoreGraphics
import Vision
struct TargetWindow {
let id: CGWindowID
let bounds: CGRect
init?(appName: String, windowTitle: String) {
guard let windows = CGWindowListCopyWindowInfo(.optionAll, kCGNullWindowID) as? [[String: Any]] else { return nil }
@niugm
niugm / es.sh
Created July 22, 2016 05:34 — forked from rajraj/es.sh
Install ElasticSearch on CentOS 6
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
upstream backend {
server 127.0.0.1:3000;
}
server {
listen 80;
access_log /var/log/nginx/yoursite.access.log;
error_log /var/log/nginx/yoursite.error.log;