Skip to content

Instantly share code, notes, and snippets.

View skyzh's full-sized avatar
🐱
working

Alex Chi Z. skyzh

🐱
working
View GitHub Profile
@skyzh
skyzh / course_export.js
Last active January 29, 2019 14:21
Read course data
const data = require('./data.json');
const reg = {
time: /星期(.*?)[ ]+第(.*?)节--第(.*?)节/,
header: /行课安排为第(.*?)-(.*?)周?,其中:/,
loc: /(.*?)\((.*?)-(.*?)周\)[ ]+(.*?)\((.*?)-(.*?)周\)/,
loc_unknown: /[ ]*(.*?)[ ]+(.*?)\((.*?)-(.*?)周\)/,
bi_week: /(单|双)周/
};
const fetch_data = {
header: ["week_start", "week_end"],
@skyzh
skyzh / maze.cpp
Created August 25, 2018 13:55
Find path of maze
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
struct queue_item {
int x, y;
int step;
@skyzh
skyzh / 8queen.cpp
Created August 25, 2018 13:40
Eight Queen Problem
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 12;
int queen_status[N];
/*
* AAAA
@skyzh
skyzh / bot.js
Created August 22, 2018 03:37
Simple QQ repeat Bot
const {Builder, By, Key, until} = require('selenium-webdriver');
let processed_text = {};
(async function do_fetch() {
let driver = await new Builder().forBrowser('chrome').build();
try {
await driver.get('http://web2.qq.com');
while(true) {
await driver.wait(until.elementLocated(By.id("panelTitle-5")));
@skyzh
skyzh / iptables-playground.sh
Last active August 15, 2018 03:16
Play with iptables in docker
#!/usr/bin/env bash
docker run -it --privileged --network pub_net skyzh/iptables-playground bash
@skyzh
skyzh / merge_distance.cpp
Created August 13, 2018 15:49
Min distance in N vertices
#include <iostream>
#include <algorithm>
#include <vector>
#include <functional>
#include <cmath>
using namespace std;
struct Vertex {
long long x, y;
Vertex(long long x, long long y) {
@skyzh
skyzh / empty_server.js
Created August 10, 2018 14:50
create a server which returns {} on every page
const Koa = require('koa')
const app = new Koa()
app.use(ctx => {
ctx.response.body = {}
})
app.listen(8000)
@skyzh
skyzh / 1_GaokaoData_README.md
Last active May 29, 2019 11:01
2018 Shanghai Comprehensive Enrollment Analysis

2018 年上海高考综合评价数据分析。数据来自阳光高考公示。

@skyzh
skyzh / screencapture.py
Last active August 6, 2018 09:00
Screen stream server
import cv2
import numpy as np
from http.server import BaseHTTPRequestHandler, HTTPServer
import pyautogui
class CamHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path.endswith('.mjpg'):
self.send_response(200)
self.send_header('Content-type','multipart/x-mixed-replace; boundary=--jpgboundary')
# 2019-01-29 21:44:41
[General]
dns-server = 1.2.4.8, 114.114.114.114, 223.5.5.5, 8.8.8.8, system
ipv6 = true
skip-proxy = 127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,100.64.0.0/10,17.0.0.0/8,localhost,*.local,169.254.0.0/16,224.0.0.0/4,240.0.0.0/4
bypass-system = true
[Rule]