Skip to content

Instantly share code, notes, and snippets.

View chace20's full-sized avatar
🌚
Focusing

chace chace20

🌚
Focusing
View GitHub Profile
@chace20
chace20 / key.py
Created January 24, 2021 03:00
毕式音律的算法
"""
毕式音律的算法
初始条件:从C开始,C的长度为1
计算方式:
1. 两个五度音程之间的比例是2/3,五度音程对应了7个半音的跨度,所以下面都是用7进行计算
2. 如果超出了一个8度,那么需要缩放回来;缩放的方式是利用两个8度之间的比例是1/2来实现
终止条件:一个8度内的所有的半音都被计算完毕,也就是计算11次
"""
key = ('C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B')
print('==== 毕式音律 ===')
@chace20
chace20 / GetDownloadUrl.js
Created January 26, 2016 11:06
For getting dygod download url
// ==UserScript==
// @name GetDownloadUrl
// @namespace http://zhouchao.me/
// @version 1.0
// @description for getting dygod download url
// @author chao
// @match http://www.dygod.net/html/tv/hytv/20150901/106785.html
// @require http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js
// @require https://cdn.rawgit.com/zenorocha/clipboard.js/v1.5.5/dist/clipboard.min.js
// @grant none
@chace20
chace20 / FetchMDColorToXml.js
Created October 31, 2015 05:09
一段提取MD颜色的JS代码,一段提取 Material Design 的颜色表为 Android 的 Color 资源列表的 JS。 http://www.v2ex.com/t/231395
var colorGroups = document.querySelectorAll('section.color-group');
/*
* https://www.google.com/design/spec/style/color.html#color-color-palette
*/
var forEach = Array.prototype.forEach;
var md_color_items = [];
forEach.call(colorGroups, function(group) {
var colors = group.querySelectorAll("li.color");
if(colors.length < 5){
return;// black white color ignore
@chace20
chace20 / di2px.java
Created September 11, 2015 15:01
Android java code dip2px
public static int dip2px(Context context, float dpValue) {
float scale = context.getResources().getDisplayMetrics().density;
return (int)(dpValue * scale + 0.5F);
}
@chace20
chace20 / UESTCTeacherMarker.js
Last active May 15, 2019 08:06
自动评教油猴脚本,需要访问http://eams.uestc.edu.cn/eams/evaluateStd!search.action?semester.id=63 其中semester.id是学期,现在是63
// ==UserScript==
// @name UESTC自动评教脚本
// @namespace http://zhouchao.me/
// @version 1.0
// @description 适用于UESTC自动评教
// @author chace
// @match http://eams.uestc.edu.cn/eams/evaluateStd!search.action?semester.id=*
// @require http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js
// @grant none
// ==/UserScript==
@chace20
chace20 / UESTCExtension.user.js
Last active January 26, 2024 14:46
UESTC自动填充密码油猴脚本
// ==UserScript==
// @name UESTC自动填充密码插件
// @namespace http://zhouchao.me/
// @version 1.1
// @description 还在为每次都要输入信息门户账号密码而烦恼?本插件能解放你,让你有更多的时间享受生活的乐趣。
// @author Chace
// @match https://uis.uestc.edu.cn/amserver/UI/Login?goto=*
// @grant none
// ==/UserScript==
@chace20
chace20 / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console