This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 在末尾加上,显示当前在第几个窗口。 | |
caption always "%{= kw}%-w%{= kG}%{+b}[%n %t]%{-b}%{= kw}%+w %=%d %M %0c %{g}%H%{-}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////// self defined ENUM_STR, have a string val | |
#define ENUM_STR_BEGIN(type_name) \ | |
class type_name { \ | |
std::string v; \ | |
public: \ | |
static std::set<std::string>* vals() { static std::set<std::string> s; return &s; }\ | |
type_name(const std::string& a): v(a){} \ | |
std::string toString() { return v; } \ | |
bool isValid() { return vals()->find(v) != vals()->end(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __PYTHON_LIKE__ | |
#define __PYTHON_LIKE__ | |
#include <stdio.h> | |
#include <string> | |
#include <fstream> | |
#include <streambuf> | |
#include <vector> | |
#include <iostream> | |
#include <stdarg.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import librosa | |
import wave | |
from pathlib import Path | |
import numpy as np | |
import os | |
all_in_one_wav = "@all_in_one.wav" | |
all_in_one_wav_info = "@all_in_one.txt" | |
all_in_one_label = "@all_in_one_vad.txt" | |
label_file = "@label.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding=utf-8 | |
import cProfile | |
import pstats | |
def fun(): | |
return sum([i for i in range(10000000)]) | |
if __name__ == "__main__": | |
cProfile.run('fun()', "result") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import lru_cache | |
@lru_cache(maxsize=2**20) | |
def LCS(a, b): | |
""" Longest common subsequence """ | |
if len(a) == 0 or len(b) == 0: | |
return 0 | |
res = max( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
import os | |
from multiprocessing.dummy import Pool | |
def can_ping(ip): | |
ret = os.system('ping -n 1 -w 1 %s > nul' % ip) | |
can_ping = True if ret == 0 else False | |
return can_ping, ip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main multiverse restricted universe | |
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main multiverse restricted universe | |
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main multiverse restricted universe | |
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main multiverse restricted universe | |
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main multiverse restricted universe | |
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main multiverse restricted universe | |
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main multiverse restricted universe | |
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main multiverse restricted universe | |
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main multiverse restricted universe | |
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main multiverse restricted universe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Warning: This script is untested. (copy from command history) | |
# Install | |
curl -fsSL get.docker.com -o get-docker.sh | exit -1 | |
sudo sh get-docker.sh | exit -1 | |
# Add user to docker group (sudoless) | |
sudo gpasswd -a ${USER} docker | exit -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference: | |
// https://www.cnblogs.com/HarryGuo2012/p/4722784.html | |
// http://blog.csdn.net/fcxxzux/article/details/40053937 | |
#include <cstring> | |
#include <cstdio> | |
#include <cstdlib> | |
int dfs(int i) { | |
int a[100]; |
OlderNewer