This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::os::windows::process::CommandExt; | |
use std::process::{self, Command, Stdio}; | |
use std::time::{Duration, Instant}; | |
use std::{env, thread}; | |
fn main() { | |
let mut args: Vec<_> = env::args().collect(); | |
if let Some(idx) = args.iter().position(|x| x == "--detach") { | |
args.remove(idx); | |
if let Err(e) = Command::new(&args[0]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to use this script, you should allow popups on live.bilibili.com. | |
function collect(url, times, w, cb) { | |
var img = w.document.querySelector(".small-tv-draw").querySelector(".draw-img"); | |
if (img.length == 0) { | |
console.error("page " + url + " not loaded, there should be a bug."); | |
w.close(); | |
cb(); | |
} else { | |
img.click(); | |
console.info(url + " is collected"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::{self, BufReader, Read, Stdin, Bytes}; | |
use std::fmt::Debug; | |
use std::str::FromStr; | |
/// A stdin helper to deal with normal oj input. | |
pub struct OjReader<R> { | |
bs: Bytes<BufReader<R>>, | |
} | |
pub fn from_stdin() -> OjReader<Stdin> { |