Skip to content

Instantly share code, notes, and snippets.

Avatar

Ning "Alex" Kuang alexkuang0

View GitHub Profile
@alexkuang0
alexkuang0 / extract.sh
Created Apr 27, 2022
Extract audios from all videos in a directory
View extract.sh
# assume that all videos in the directory are of the same codec
# first choose one of the videos to see the codec of audio
ffprobe xxx.mp4
# batch convert (in this example: mp4 -> aac)
for i in *.mp4; do ffmpeg -i "$i" -vn -acodec copy "${i%.*}.aac"; done
View AlexRSS-deleted-users-20220427.txt
123456
21eternal
3322964
ABCDEF
Allen
AmiKara
Baboo
Card
Dashy
Delbert
View Cacher.rs
// Solution from:
// https://users.rust-lang.org/t/30856/5
use std::collections::{HashMap, hash_map::Entry};
use std::cmp::Eq;
use std::hash::Hash;
use std::thread::sleep;
use std::time::Duration;
struct Cacher<T, U, V>
where T: Fn(&U) -> V, U: Eq + Hash {
View AlexRSS-deleted-users-20210821.txt
123mxs
AlalajiYH
TryRSS
Yun
a2121441645
cbbcww
linglingqi
nobody
quarry
oui
View AlexRSS-deleted-users-20210226.txt
cnmzdk
delete
djx
ethan2000
ewuzxl
extrastu
fack
feiyu
feng
forfunfor
@alexkuang0
alexkuang0 / Brewfile
Created Jan 13, 2021
My Homebrew dump file.
View Brewfile
tap "beeftornado/rmtree"
tap "homebrew/bundle"
tap "homebrew/cask", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git"
tap "homebrew/cask-drivers", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git"
tap "homebrew/cask-fonts", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git"
tap "homebrew/cask-versions", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git"
tap "homebrew/core", "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
tap "homebrew/services"
brew "asciinema"
brew "bat"
@alexkuang0
alexkuang0 / labelMailsByAddress.js
Created Dec 29, 2020
Apps Script for Gmail - Label mails by address
View labelMailsByAddress.js
const PARENT_LABEL = 'example.com'
const LABEL_SEPARATOR = '-'
const LEVEL_SEPARATOR = '.'
const getLabelOrCreate = (labelName) => GmailApp.getUserLabelByName(labelName) || GmailApp.createLabel(labelName)
function labelMailsByAddress() {
const allTargetThreads = GmailApp.search(`label:${PARENT_LABEL} `)
allTargetThreads.forEach(thread => {
@alexkuang0
alexkuang0 / biliNewVid.js
Last active Nov 5, 2021
Scriptable iOS 14 Widget - Bilibili latest video in your subcription feed 哔哩哔哩动态最新视频
View biliNewVid.js
const UID = 00000000 // 改为你的用户 ID
const COOKIE = "" // (可选,推荐设置)改为你的 cookie
let { title, user, image, videoUrl } = await getVideo(UID, COOKIE)
let widget = createWidget(title, user, videoUrl, image)
if (!config.runsInWidget) {
await widget.presentMedium()
}