Skip to content

Instantly share code, notes, and snippets.

In file included from /Users/mac/lab/guo/hh-suite/src/hhblits.h:37,
from /Users/mac/lab/guo/hh-suite/src/hhblits.cpp:8:
/usr/local/include/cs.h:637:12: error: 'namespace cs_di { }' redeclared as different kind of entity
637 | #define cs cs_di
| ^~~~~
/Users/mac/lab/guo/hh-suite/src/cs/profile.h:24:11: note: in expansion of macro 'cs'
24 | namespace cs {
| ^~
/usr/local/include/cs.h:72:3: note: previous declaration 'typedef struct cs_di_sparse cs_di'
72 | } cs_di ;
@2efPer
2efPer / bypass.sh
Last active June 1, 2019 12:34
firwal bypass
#Unix
wget https://install.direct/go.sh
#Mac
brew tap v2ray/v2ray
brew install v2ray-core
#/usr/bin/v2ray/v2ray:V2Ray 程序;
#/usr/bin/v2ray/v2ctl:V2Ray 工具;
#/etc/v2ray/config.json:配置文件;
//create a dataframe
val df = sc.parallelize(Seq(
(1441637160, 10.0,"hello"),
(1441637170, 20.0,"world"),
(1441637180, 30.0,"test"),
(1441637210, 40.0,"word"),
(1441637220, 10.0,"test2"),
(1441637230, 0.0,"test3"))).toDF("timestamp", "value","words")
// make multiple rows to one row
@2efPer
2efPer / EulerProject.scala
Last active April 6, 2019 14:08
EulerProject.scala
//1
(1 to 1000).filter(x => x%3==0 || x%5==0).sum
//2
def fib: Stream[Long] = {
def tail(h: Long, n: Long): Stream[Long] = h #:: tail(n, h + n)
tail(0, 1)
}
//3 Largest prime factor
@2efPer
2efPer / NLPtest.py
Created November 21, 2017 09:40
NLP测试
if __name__=="__main__":
from gensim import corpora, models, similarities
import codecs
from collections import defaultdict
# 原始语料
documents = []
f1 = codecs.open("../input", "r")
for (num, value) in enumerate(f1):
content=value.strip().split("__SOB__")
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.wltea.analyzer.lucene.IKAnalyzer;
import java.io.*;
public class IkAnalyserUsageTest {
public static void main (String[] args) {
BufferedReader br =null;
BufferedWriter bw = null;
@2efPer
2efPer / TestPlugin.py
Created November 20, 2017 14:01
Python Reflection
# TestPlugin:
import os
def getPlugin():
path = os.path.split(os.path.realpath(__file__))[0]
plugins = os.listdir(path + '/plugin/')
fil = lambda str: (True, False)[str[-3:] == 'pyc' or str.find('__init__.py') != -1]
return filter(fil, plugins)
if __name__ == "__main__":
@2efPer
2efPer / gist:8135d046a1c99dd3cd7d779745b30e89
Created November 20, 2017 03:28
convert sogou scel file to normal text file
# -*- coding: utf-8 -*-
import struct
import sys
import binascii
import pdb
#搜狗的scel词库就是保存的文本的unicode编码,每两个字节一个字符(中文汉字或者英文字母)
#找出其每部分的偏移位置即可
#主要两部分
@2efPer
2efPer / CombinationTest.java
Last active May 24, 2017 17:45
Combination
class CombinationTest{
public static void main(String[] args) {
listCombination(new char[]{'a','b','c'});
}
public static void listCombination(char chs[]){
if(chs.length == 0) return ;
Stack<Character> stack = new Stack<Character>();
for(int i = 1; i <= chs.length; i++){
combine(chs, 0, i, stack);