Skip to content

Instantly share code, notes, and snippets.

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

Haozhe sailist

🏠
Working from home
  • Sophgo
View GitHub Profile
@sailist
sailist / FP-Grotth.js
Created May 5, 2019 08:18
Quick set value in the table
// 可视化网站 链接http://athena.ecs.csus.edu/~associationcw/FpGrowth.html
// 对于一些数据可能会出错误
var align = [["A",1,],
["B",2,],
["C",3,],
["D",4,],
["E",5,],
["F",6,],
["G",7,],
@sailist
sailist / DBScan.py
Last active May 7, 2019 04:52
DBScan algorithm implement and detail commented
from sklearn.datasets import make_blobs
from matplotlib import pyplot as plt
import numpy as np
def distance(ix, iy):
return np.linalg.norm(x_map[ix] - x_map[iy])
def is_cluster(ix):
return yy[ix] > 0
@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 / 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 / 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 / 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 / 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 / gitautopush
Created August 9, 2019 09:47
git 快速提交脚本
set /p commitmsg=input commitmsg:
git add *
git commit -m %a%
git push
@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
@sailist
sailist / logwrapper.py
Created January 30, 2020 03:29
LogWrapper
import os
import time
from collections import Iterable, OrderedDict
from datetime import datetime
from typing import Any
class LogParam:
"""
meter = LogParam()