Skip to content

Instantly share code, notes, and snippets.

View kiwiyou's full-sized avatar
🥝

kiwiyou kiwiyou

🥝
View GitHub Profile
@kiwiyou
kiwiyou / Cargo.toml
Created December 27, 2019 18:13
네이버 한자사전 고사성어 크롤러
[package]
name = "hanja-idiom"
version = "0.1.0"
authors = ["kiwiyou <[email protected]>"]
edition = "2018"
[dependencies]
reqwest = "0.9"
unhtml = "0.7"
unhtml_derive = "0.7"
@kiwiyou
kiwiyou / main.rs
Created January 11, 2020 06:54
Read lines from stdin until one can be parsed
use std::io::{stdin, BufRead};
fn main() {
let input: u32 = stdin()
.lock()
.lines()
.find_map(|line| line.expect("Failed to read.").trim().parse().ok())
.unwrap();
println!("{}", input);
}
@kiwiyou
kiwiyou / Cargo.toml
Created February 26, 2020 10:56
UUID Generator without collision
[package]
name = "ugen"
version = "0.1.0"
authors = ["kiwiyou <[email protected]>"]
edition = "2018"
[dependencies]
rand = "0.7"
clap = { git = "https://github.com/clap-rs/clap/" }
@kiwiyou
kiwiyou / baeggro.js
Last active January 14, 2022 13:36
Baekjoon Online Judge Status Offender
// ==UserScript==
// @name Baeggro - BOJ Result Offender
// @match https://www.acmicpc.net/status*
// @grant none
// @version 4.0
// @author kiwiyou <[email protected]>, RanolP <[email protected]>
// @downloadURL https://gist.githubusercontent.com/kiwiyou/ffb8beab11cbc64cb696639fd0c984c7/raw/baeggro.js
// @updateURL https://gist.githubusercontent.com/kiwiyou/ffb8beab11cbc64cb696639fd0c984c7/raw/baeggro.js
// ==/UserScript==
@kiwiyou
kiwiyou / main.rs
Created May 31, 2020 06:52
Fast IO for Competitive Programming in Rust
extern "C" { fn mmap(a: *mut u8, l: usize, p: i32, f: i32, d: i32, o: i64) -> *mut u8; }
fn input(size: usize) -> *const u8 { unsafe { mmap(0 as *mut u8, size, 1, 2, 0, 0) } }
fn next(p: &mut *const u8) -> I { unsafe { let mut n = 0; while **p & 16 != 0 { n = n * 10 + (**p as I & 15); *p = p.offset(1) } *p = p.offset(1); n } }
type I = i32;
@kiwiyou
kiwiyou / square-interactive.c
Last active July 3, 2020 16:44
draw square interactively
#include <stdio.h>
#include <curses.h>
int sq(int w, int h) {
int x, y = 1;
while (y <= h) {
x = 1;
while (x <= w) {
if ((x == 1 || x == w) && (y == 1 || y == h)) {
addch('o');
@kiwiyou
kiwiyou / schoolpage.py
Created September 22, 2020 15:03
교육청 학급홈페이지 로그인 시스템
import requests
import re
class SchoolPage:
def __init__(self, site_id: str, return_url: str, fail_url: str, session=requests.Session()):
# 로그인 페이지 참조
self.site_id = site_id
self.return_url = return_url
self.fail_url = fail_url
self.reset()
@kiwiyou
kiwiyou / main.rs
Created September 1, 2021 09:11
Rust Fast I/O
fn main() {
let buf = stdin();
let mut token = buf.split_ascii_whitespace();
use std::fmt::Write;
// buf.clear();
let mut buf = String::new();
writeln!(buf, "{}", token.next().unwrap()).unwrap();
print!("{}", buf);
}
@kiwiyou
kiwiyou / script.js
Created September 20, 2021 00:43
Use unicode for rendering Yethangul in Naver Korean dictionary
// ==UserScript==
// @name Naver YetHangul to Unicode
// @namespace Violentmonkey Scripts
// @match https://ko.dict.naver.com/
// @grant none
// @version 1.0
// @author kiwiyou <[email protected]>
// ==/UserScript==
new MutationObserver(e => {
@kiwiyou
kiwiyou / solution.rs
Created August 11, 2022 22:11
Hyper Tomato (BOJ 17114)
use core::mem::MaybeUninit;
use alloc::collections::VecDeque;
use basm::io;
const D: usize = 11;
pub fn main() {
let mut reader = io::Reader::<{ 1 << 15 }>::new();
let mut writer = io::Writer::<32>::new();
let mut tomato: [u8; (1_000_000 + 7) / 8] = unsafe { MaybeUninit::uninit().assume_init() };