Skip to content

Instantly share code, notes, and snippets.

View hanwentao's full-sized avatar

Wentao Han hanwentao

View GitHub Profile
@hanwentao
hanwentao / flag-prc.typ
Created August 14, 2025 05:58
Flag of the People's Republic of China
// 中华人民共和国国旗
#let unit = 1cm
#let flag-height = 20 * unit
#let flag-width = 30 * unit
#let aux-line = false // 是否画辅助线
#let flag-red = rgb("#cc0000")
#let flag-yellow = rgb("#ffd700")
#let aux-gray = gray.darken(50%)
@hanwentao
hanwentao / periodic-table.typ
Created April 13, 2025 15:02
Periodic Table in Typst
// Copied from https://github.com/janosh/tikz/blob/da1b4582/assets/periodic-table/periodic-table.typ
#import "@preview/cetz:0.3.4": canvas, draw
#set page(width: auto, height: auto, margin: 15pt)
// Element colors
#let colors = (
alkali-metal: rgb("#8989ff"),
alkaline-earth: rgb("#89a9ff"),
@hanwentao
hanwentao / binary_tree.cpp
Last active April 5, 2025 09:14
Binary tree
#include <algorithm>
#include <memory>
#include <print>
#include <string>
#include <type_traits>
#include <utility>
template <class T>
class BinaryTree {
public:
@hanwentao
hanwentao / overload.cpp
Created September 5, 2023 12:50
Calling overloaded functions with brace initializers
#include <iostream>
#include <vector>
void f(int x) {
std::cout << "int" << std::endl;
}
void f(std::vector<int> x) {
std::cout << "std::vector<int>" << std::endl;
}
@hanwentao
hanwentao / sort.cpp
Created August 10, 2021 14:25
Sort 100M integers.
#include <algorithm>
#include <chrono>
#include <iostream>
#include <random>
#include <vector>
int main() {
const int n = 100000000;
auto t1 = std::chrono::system_clock::now();
std::vector<int> a(n);
@hanwentao
hanwentao / check_status.py
Last active June 22, 2021 11:05
A script that monitors the process of IOI online contest
#!/usr/bin/env python3
import json
import logging
import subprocess
import time
from urllib.request import urlopen
from urllib.error import URLError

Keybase proof

I hereby claim:

  • I am hanwentao on github.
  • I am hanwentao (https://keybase.io/hanwentao) on keybase.
  • I have a public key ASBXTbYA5vNjG7DjqqWxwFk4NQFS6u1hXIZuGESzEfMrOQo

To claim this, I am signing this object:

@hanwentao
hanwentao / .bashrc
Created February 5, 2020 05:19
My server config files
# Path to your oh-my-bash installation.
export OSH=/home/hanwentao/.oh-my-bash
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-bash is loaded.
OSH_THEME="agnoster"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
@hanwentao
hanwentao / lisp.cpp
Created January 23, 2020 06:39
Solutions to lisp of CCSP2017
#include <algorithm>
#include <iostream>
#include <memory>
#include <string>
#include <regex>
#include <stack>
#include <unordered_map>
#include <utility>
#include <variant>
#include <vector>
@hanwentao
hanwentao / clock.html
Last active July 16, 2019 07:00
A HTML5 clock written for programming contests
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>CCF NOI Clock</title>
<style>
body {