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 / Anki.md
Last active April 11, 2019 04:17
Review Anki cards on Kindle
  1. Use Basic Print Support Anki addon.
  2. Print to HTML
  3. Apply CSS
  4. Print to PDF

This CSS adds card number and forces page break after each card.

image

@skyzh
skyzh / bsdata.csv
Last active January 29, 2019 14:22
BlueSense Hourly Data Summary (2017)
We can't make this file beautiful and searchable because it's too large.
time,hum,pm01,pm10,pm25,tc,pressure
1496055566.9861677,44.4780655859387,11.685786224350602,15.028218400689576,13.864547438152512,29.63095288049607,
1496059170.883296,48.802584171295166,11.749699074074075,14.9380787037037,13.80851851851852,29.29816748936971,
1496062774.7723284,49.04658399899801,12.923555068226118,16.577614522417157,15.315606725146198,28.989999961853027,
1496067441.328689,51.788095235377014,9.65302374293221,12.148919778310509,11.25103238924606,28.872821715218688,
1496071045.2175376,53.20250063896178,7.9643287037037025,10.032731481481477,9.283449074074074,28.628667157491048,
1496075042.9485977,54.61931124918388,8.610370370370369,10.613842592592594,9.854004629629632,28.40766700267791,
1496078646.8541663,56.04033413887023,8.788773148148149,10.723796296296292,10.073194444444443,28.132917173703497,
1496082250.7668355,56.885917924245184,7.483635477582846,9.139502923976606,8.550604288499024,27.993999977111816,
1496085854.6636848,57.2112507279714,7.639215399610135,9.46486842105263,8.80893762183236,27.8
@skyzh
skyzh / money.py
Created June 16, 2018 02:39
Everyone gives one coin to others at a time, iteration 10000 times
import numpy as np
from matplotlib import pyplot as plt
NUM_PEOPLE = 10000
SHUFFLE_SEQ = np.arange(NUM_PEOPLE)
coins = np.ones(NUM_PEOPLE) * 100
for i in range(100000):
@skyzh
skyzh / 2017_Gaokao_Data.md
Last active August 9, 2018 03:25
2017 上海市综合评价招生参考数据

数据来源: 阳光高考

上海交通大学 2017 年综合评价物理专业组 已录取考生高考成绩与面试分数的关系

screen shot 2018-06-23 at 3 32 33 pm

上海交通大学 2017 年综合评价物理专业组 已录取考生面试成绩分布

screen shot 2018-06-23 at 3 33 21 pm

上海交通大学 2017 年综合评价所有专业组 已录取考生高考成绩与面试分数的关系

@skyzh
skyzh / convert.py
Created July 13, 2018 07:38
Embed secret video into another video with FFT and IFFT
import numpy as np
import cv2
from numpy.fft import fft2, ifft2
import numpy as np
cap = cv2.VideoCapture('data.mp4')
cap2 = cv2.VideoCapture('in.mp4')
DENSITY = 10
# 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]
@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')
@skyzh
skyzh / 1_GaokaoData_README.md
Last active May 29, 2019 11:01
2018 Shanghai Comprehensive Enrollment Analysis

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

@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 / 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) {