Skip to content

Instantly share code, notes, and snippets.

View bczhc's full-sized avatar
🌴

Zhai Can bczhc

🌴
  • Jiangsu, China
  • 19:56 (UTC +08:00)
  • X @bczhc0
View GitHub Profile
@bczhc
bczhc / a.js
Last active October 31, 2021 03:48
安全教育平台自动完成题目脚本
let task = () => {
$("#buzhou2ss")[0].click();
for (e of $("#test_three")[0].children) {
let name = e.getAttribute("name");
let c = $(`#test${name}`)[0];
for (dd of c.children) {
let checkedBox = dd.getElementsByTagName("input")[0];
if (checkedBox.value === "1") checkedBox.checked = true;
}
}
@bczhc
bczhc / a.js
Last active March 24, 2022 14:54
处理网易云音乐歌单中歌曲的评论
// 手动在页面控制台中获取歌单中的条目,并且保存成JSON以进行后面的处理
let table = document.getElementsByClassName("m-table")[0];
let r=Array.prototype.slice.call(table.getElementsByTagName("tbody")[0].children).map(x=>{
let a = x.getElementsByClassName("txt")[0].getElementsByTagName("a")[0];
let href = a.href;
let id = href.match(/^.*id=(.*)$/)[1];
let title = a.children[0].title;
return [title, id];
});
console.log(JSON.stringify(r));
@bczhc
bczhc / a.md
Last active March 26, 2022 02:22
爬取随手记的账单记录
POST https://www.sui.com/report.rmi
content-type: application/x-www-form-urlencoded; charset=UTF-8
cookie: XXX

m=compare&beginDate=2000.1.1&endDate=2022.03.25&cardId=164459304268&page=1

Or

curl -d 'm=compare&beginDate=2000.1.1&endDate=2022.03.25&cardId=164459304268&page=1' \
@bczhc
bczhc / a
Last active April 8, 2022 13:44
Linux线性拼接多设备文件
#!/bin/bash
if [ $# -lt 2 ]; then
echo "Usage: command <joined-name> <device-to-join>..."
exit
fi
joined_name=$1
shift
@bczhc
bczhc / a.md
Last active April 15, 2022 08:34
设置屏幕亮度脚本

Usage: sb <brightness> sb <night-mode> sb <brightness> <night-mode>

night-mode的值可以为yesno,当为yes时,屏幕进行Gamma校正,设置为暖色调。

brightness在0.0到1.0之间。

@bczhc
bczhc / convert
Last active September 7, 2022 06:37
Linux上录屏
#!/bin/bash
# 用于把录屏方案1输出的视频转换成录屏方案2
# Codec: h264_nvenc, High H264 profile and yuv420p pixel format
ffmpeg -i "$1" -c:a copy -c:v h264_nvenc -b:v 0 -profile:v high -pix_fmt yuv420p -rc-lookahead 20 "$2"
@bczhc
bczhc / a.md
Created April 21, 2022 13:26
视频调速

Usage: speed-up-video \ \ \ \

@bczhc
bczhc / a
Last active July 1, 2022 08:50
利用h264_nvenc编码器再编码视频,有时可起到压缩的作用
#!/bin/bash
# 此脚本暂没一般适用化,只做个记录
set -e
base_dir="$(dirname "$0")"
cd "$base_dir" || exit
list_file="$base_dir/list"
@bczhc
bczhc / a.rs
Created April 25, 2022 11:33
桥式LSE打乱生成
use once_cell::sync::Lazy;
use ring::rand::{SecureRandom, SystemRandom};
use std::mem;
use std::sync::RwLock;
const SCRAMBLE_LENGTH: i32 = 15;
static RNG: Lazy<RwLock<Option<SystemRandom>>> = Lazy::new(|| RwLock::new(None));
fn main() {
let rng = ring::rand::SystemRandom::new();
@bczhc
bczhc / lines-cmp
Created May 9, 2022 13:00
比较文本行
#!/bin/env ruby
argv = ARGV
self_name = File.basename($0)
DIFFERENCE = :d
INTERSECTION = :i
UNION = :u
if argv.length != 3