Skip to content

Instantly share code, notes, and snippets.

View yinyanfr's full-sized avatar

Yan yinyanfr

View GitHub Profile
@yinyanfr
yinyanfr / ts-merge.js
Last active September 1, 2023 11:03
Combines .ts video files from a directory or multiple directories into .mp4 files using ffmpeg.
#!/usr/bin/env node
/**
* @example node ts-merge.js ./videos output_folder
*/
const { execSync } = require("child_process");
const { readdirSync, writeFileSync, existsSync, mkdirSync } = require("fs");
const { join } = require("path");
@yinyanfr
yinyanfr / qbittorrent-pause-unregistered-torrents.js
Created August 4, 2023 15:55
Pause all unregistered torrents in Qbittorrent using the WebUI API
import qbittorrentAPI from "qbittorrent-api-v2"
async function pauseUnregisteredTorrents() {
const qbittorrent = await qbittorrentAPI.connect(
CONFIG.WebUIAddress,
CONFIG.Login,
CONFIG.Password
);
const torrents = await qbittorrent.torrents();
const unregistered = [];
@yinyanfr
yinyanfr / idpop.js
Created January 12, 2020 01:38
Building a menu for markdown html by adding an id to each h tag and collecting all the titles
// some safe html text parsed from a markdown file
// e.g. your awesome novel
let html = `
<h1>hhh1</h1>
<h2 class="title">hhh2<p>ppp</p></h2>
<h3>hhh3</h3>
<h4>hhh4</h4>
<h5>hhh5</h5>
`