Skip to content

Instantly share code, notes, and snippets.

😃
Excelsior

游刃 Elfsong

😃
Excelsior
View GitHub Profile
@Elfsong
Elfsong / git_stat.sh
Created Jun 11, 2020
Git info statistic
View git_stat.sh
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --since ==2020–05-02 --until=2018-06-11 --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done
@Elfsong
Elfsong / esim.py
Created May 18, 2019 — forked from namakemono/esim.py
Implementation of ESIM(Enhanced LSTM for Natural Language Inference)
View esim.py
"""
Implementation of ESIM(Enhanced LSTM for Natural Language Inference)
https://arxiv.org/abs/1609.06038
"""
import numpy as np
from keras.layers import *
from keras.activations import softmax
from keras.models import Model
def StaticEmbedding(embedding_matrix):
@Elfsong
Elfsong / server.java
Created Apr 19, 2019
Sent file in blocksize
View server.java
// TODO: FILE_BYTES_REQUEST
for (int initial_position = 0; initial_position < qq.fileDescriptor.fileSize; ) {
long offset = 0;
long remained = qq.fileDescriptor.fileSize - initial_position;
if (remained > blockSize) {
offset = blockSize;
} else {
offset = remained;
View combinations pair
(_,_,_) -> (0,_,_) = remove all three pitchs
(_,_,_) -> (a,b,c) = a + b == 3 or a + c == 3 retrive all three notes or octaves
View split_story_dialogue.py
import json
import os
import re
import jieba
ROOT_PATH = "/Users/elfsong/PycharmProjects/BERT_demo"
RESOURCE_PATH = os.path.join(ROOT_PATH, "Test text")
View V_Byte_V1.py
def vbyte_encode(num):
# out_bytes stores a list of output bytes encoding the number
out_bytes = []
###
# Your answer BEGINS HERE
###
while num >= 128:
out_bytes = [num % 128] + out_bytes
@Elfsong
Elfsong / average_split.py
Last active Mar 11, 2019
优雅地均匀分割字符串
View average_split.py
def avsplit1(s, n):
fn = len(s)//n
rn = len(s)%n
ar = [fn+1]*rn+ [fn]*(n-rn)
si = [i*(fn+1) if i<rn else (rn*(fn+1)+(i-rn)*fn) for i in range(n)]
sr = [s[si[i]:si[i]+ar[i]] for i in range(n)]
return sr
def avsplit2(s, n):
fn = len(s)//n
View pinyin
# coding: utf-8
import ast
import clr
import json
import os
import re
from StoryTelling.tts import append_pronunciation
from StoryTelling.tts.tools import OnlineTts
from Speech.Cognitive.Services import TimeLine
View movie_studio.py
import os
import time
from multiprocessing import Process
import cocos
import cv2
import numpy as np
import pyglet
from PIL import ImageGrab
from cocos.actions import CallFunc
@Elfsong
Elfsong / excel_reader
Created Jan 26, 2019
Excel Reader #spreadsheet #python
View excel_reader
import os
import xlrd
ROOT_PATH = r"C:\Users\t-midu\PycharmProjects\Scenario"
RESOURCE_PATH = os.path.join(ROOT_PATH, "resource")
file_path = os.path.join(RESOURCE_PATH, "sentence_class.xls")
data = xlrd.open_workbook(file_path)
You can’t perform that action at this time.