Skip to content

Instantly share code, notes, and snippets.

View sgqy's full-sized avatar
📚

sgqy

📚
  • Japan
  • 17:10 (UTC +09:00)
  • X @sgqy_
View GitHub Profile
#!/usr/bin/env python3
# Auto remove fans in bilibili.com
# 全天候移除 B 站粉丝, 彻底变成小透明
# 操作不可逆, 后果自负
# 用法: 把 B 站的 cookies 保存为 Netscape 格式的 cookie.txt 后, 再执行此脚本
# 另外, 稍作修改就可以变成自动关注或自动拉黑新增粉丝的奇怪脚本
# 已知的 act 代码:
#!/bin/bash
find -L -iname '*.mkv' -print0 | sort -z | \
xargs -0 -i sh -c ' /usr/bin/echo -ne "\e[1;33m" && echo "$1" | tee -a /dev/shm/conv-log && /usr/bin/echo -ne "\e[0m" && \
~/lab/ffmpeg-cuda/ffmpeg/ffmpeg -y -hide_banner -loglevel level+warning -stats \
-i "$1" -map 0 -c copy \
-c:a libopus -b:a 128k -c:v hevc_nvenc -cq:v 35 o.mkv \
&& mv o.mkv "$1" ' -- {}
find -L -iname '*.mp4' -print0 | sort -z | sed -z 's/\.mp4$//g' | \
@sgqy
sgqy / sizeof.cpp
Last active December 2, 2019 09:49
#include <cstdint>
#include <cstdio>
#define print_size(x) printf("%20s: %2ld byte, %2ld bit\n", #x, sizeof(x), sizeof(x) * 8)
int main()
{
print_size(char);
print_size(short);
print_size(int);
It seems vulkan-sdk is bundled in Ubuntu 20.04.
pkg-config
libvulkan-dev (already installed)
libglm-dev
libglfw3-dev
others
#!/usr/bin/env python3
import stat
import mmap
import os
import sys
import hashlib
import urllib.parse
@sgqy
sgqy / minterpolate.sh
Last active May 20, 2023 16:58
multicore minterpolate in ffmpeg
#!/bin/bash
### multicore minterpolate in ffmpeg
# just slice & process & concat
# the concat points between sliced may be weird, but it just works
# default args
ff=/usr/bin/ffmpeg
fps=60000/1001
#!/usr/bin/env python3
import stat, os
import sys
import tqdm
import hashlib
import multiprocessing
import colorama
# auto deploy a fake mirror of aozora.gr.jp
http://aozora.local {
root /www/aozora
log /dev/shm/caddy-aozora.log
# install with http.git
git {
# clone official site copy
repo https://github.com/aozorabunko/aozorabunko.git
path /www/aozora
@sgqy
sgqy / pomodoro.py
Last active April 24, 2019 12:04
例のポモドーロテクニックですけど
#!/usr/bin/env python3
import colorama
import time
import tqdm
def timer(minute, color):
print(colorama.Style.BRIGHT + color, end='\r')
for i in tqdm.trange(minute * 60, bar_format='{l_bar}{bar}|{n_fmt:>4s}/{total_fmt:>4s}'):
time.sleep(1)