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
#include<cstdio> | |
#include<vector> | |
#include<queue> | |
#include<algorithm> | |
using namespace std; | |
typedef pair<int, int> PII; | |
const int kN = 5000+10; | |
const int INF = 1e9; | |
int N, M, first_dis[kN], last_dis[kN]; | |
vector<PII> G[kN]; |
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
#include<cstdio> | |
#include<vector> | |
#include<algorithm> | |
using namespace std; | |
const int kN = 1e5+10; | |
const int kK = 20+2; | |
int N, S, K; | |
vector<int> G[kN]; | |
long long need[kN][kK], have[kN][kK]; | |
int deep[kN], fa[kN]; |
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
#include<cstdio> | |
#include<vector> | |
#include<algorithm> | |
using namespace std; | |
const int kN = 300000+10; | |
int N, M; | |
vector<int> G[kN]; | |
bool have_bomb[kN]; | |
int T, need; | |
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
#include<cstdio> | |
#include<algorithm> | |
using namespace std; | |
typedef long long LL; | |
typedef long double LD; | |
const int kN = 1e5+10; | |
int N; | |
LL D; | |
LL A[kN], X[kN], SUM[kN]; | |
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
#include <cstdio> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
struct Edge { | |
int u, v; | |
double weight; | |
bool operator < (const Edge & e) const { |
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
#include <cstdio> | |
using namespace std; | |
bool gt[7][4][4]; | |
bool unanimity[37][7]; | |
char* profile_str[7]; | |
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
#! /usr/bin/env python3 | |
import requests | |
import subprocess | |
import time | |
USER = "USERNAME" | |
MD5 = "YOUR_PASSOWRD_MD5" # echo -n "password" | md5 | |
AUTH4 = "https://auth4.tsinghua.edu.cn/do_login.php?action=login&username=%s&password={MD5_HEX}%s&ac_id=1" % (USER, MD5) |
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
#!/usr/bin/env python3 | |
import subprocess | |
delay = 4 | |
def ifstat(): | |
result = subprocess.check_output(["ifstat", str(delay), "1"]).decode() | |
lines = result.splitlines() | |
devs = lines[0].split() |
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
#cloud-config | |
users: | |
- name: louchenyao | |
groups: sudo | |
shell: /bin/bash | |
sudo: ['ALL=(ALL) NOPASSWD:ALL'] | |
ssh-authorized-keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCudAF5jQCs+HTk9ST93yyhXNUFtxldah+D9gU7xSKXW4c6xC1ZuVHZuBvrorArDUbXwByrB/bnjC8fQy4VH0JaS3qfjofroXnLWwHqQS4RC6N1H20EYm5+fsMu0GzzbgoCJOO99QT85UghN661iPzLd7gCdc96O/AiYmDliBlsYCMVblcHkD2D9VTzeKYKmCDjl4d1kjMBdK4H8xbzpbvrhRO5Xtexm+D5foH/elB7aB3CtoCSaHl+GHFOQWidI9MIwVNlYj0i+97fYbhk0V0dir3DuIaHHy5h2PCm0ruoeESKp2e0UirEH8NwkHS/dbiC4UlrAvSHFetSJdfEabMl louchenyao | |
runcmd: |
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
#! /usr/bin/env python3 | |
import sys | |
# if the dns server of the wireguard are showed in the resolve.conf, then we skim off other servers to make sure the wireguard has the highest priority. | |
with open("/etc/resolv.conf") as f: | |
old_resolv = f.read() | |
if "10.56.100.1" in old_resolv: | |
with open("/etc/resolv.conf", "w") as f: | |
f.write("# generated by /etc/NetworkManager/dispatcher.d/refresh_dns.py\nnameserver 10.56.100.1\n") |
OlderNewer