Skip to content

Instantly share code, notes, and snippets.

View sailist's full-sized avatar
🏠
Working from home

Haozhe sailist

🏠
Working from home
View GitHub Profile
@sailist
sailist / example.js
Created December 5, 2019 04:50
JavaScript在光标处插入文字
// JS脚本区域
function insertAtCursor(myField, myValue) {
//IE support
if (document.selection) {
document.selection.empty();
caretPos.text = myValue;
caretPos.select();
myField.focus();
}
//MOZILLA/NETSCAPE support
{"version":1,"resource":"file:///Users/yanghaozhe/Documents/timeflow/webview/feedhub-viewv2/node_modules/%40ant-design/icons/lib/icons/StarFilled.d.ts","entries":[{"id":"3Ci5.ts","source":"工作区编辑","timestamp":1652801443655},{"id":"o4b3.ts","source":"工作区编辑","timestamp":1652801554982}]}
@sailist
sailist / gitautopush
Created August 9, 2019 09:47
git 快速提交脚本
set /p commitmsg=input commitmsg:
git add *
git commit -m %a%
git push
@sailist
sailist / regeist.reg
Created August 3, 2019 05:51
右键新建菜单中新增 .md 文件的写法:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.md\ShellNew]
"NullFile"=""
"FileName"="template.md"
@sailist
sailist / build.cmd
Created August 1, 2019 02:56
quick_build_pip_templet
python setup.py sdist bdist_wheel
SET CountI=0
SET BakDir="./dist/"
for /f %%a in ('dir %BakDir% /a:-d /B /o:-D') do (
rem echo %%a
SET FileName=%%a
SET CountI=CountI+1
rem echo %CountI%
if %CountI% == 0 goto bakup2
@sailist
sailist / mel_feature.py
Created June 21, 2019 06:36
用于机器学习的MFCC特征提取方法,提供了对单个音频的特征提取和batch级的音频的特征提取
from keras.layers import Layer
import numpy as np
from keras.layers import Lambda
from librosa.feature import melspectrogram
from keras import backend as K
from keras.preprocessing.sequence import pad_sequences
from sklearn.preprocessing import scale as skscale
from scipy import signal
class MelFeature():
@sailist
sailist / muti_gpu.py
Created June 19, 2019 14:05
使用多张GPU同时训练,存储自https://www.jianshu.com/p/db0ba022936f
class ParallelModel(keras.models.Model):
"""Subclasses the standard Keras Model and adds multi-GPU support.
It works by creating a copy of the model on each GPU. Then it slices
the inputs and sends a slice to each copy of the model, and then
merges the outputs together and applies the loss on the combined
outputs.
"""
def __init__(self, keras_model, gpu_count):
"""Class constructor.
@sailist
sailist / pinyin2alpha.txt
Created June 2, 2019 06:50
将拼音的声调转换为字母+数字的形式
ū#u,1
à#a,4
ǔ#u,3
ǐ#i,3
í#i,2
é#e,2
ó#o,4
ò#o,2
ā#a,1
ú#u,2
@sailist
sailist / run.js
Last active May 27, 2019 03:34
本科生教学评估
ele = $('tbody tr input');
index = 0;
value = [0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,
1,1,2,0];
txt = "老师教的很好";
@sailist
sailist / BUC.py
Last active September 23, 2022 18:55
BUC algorithm
import pandas as pd
import random
A = ["a1","a2","a3","a4"]
B = ["b1","b2","b3","b4"]
C = ["c1","c2","c3","c4"]
D = ["d1","d2"]
ALL = [A,B,C,D]
def sample(size = 6):
li = []