Skip to content

Instantly share code, notes, and snippets.

@Yangff
Yangff / strong.rb
Last active January 25, 2016 10:15
strong type system for ruby
class Symbol
def [](*args)
a = [self, args, '[]']
a.instance_eval('@_type_flag = \'[]\'')
a
end
def <<(*ary)
a = [self, ary.flatten, '<']
a.instance_eval('@_type_flag = \'<\'')
a
// g++ aa.cpp -o aa.exe -std=c++14
#include <cstdio>
#include <functional>
#include <tuple>
using namespace std;
template<int n, class Iso, class TRet, class... TArgs>
struct _bindArgs;
@Yangff
Yangff / clicker.cpp
Created January 19, 2016 12:07
click..
#include <cstdio>
#include <windows.h>
int main(){
for (;;){
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(40);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Sleep(30);
}
@Yangff
Yangff / bop2016.md
Created April 25, 2016 17:34
无责任题目翻译哒呀

Microsoft Academic Graph (MAG) is a large heterogeneous graph containing entities such as authors, papers, journals, conferences and relations between them. Microsoft provides Academic Knowledge API for this contest. The Entity attributes are defined here.

m$搞了一套学术数据库的API的理论呀.

Participants are supposed to provide a REST service endpoint that can find all the 1-hop, 2-hop, and 3-hop graph paths connecting a given pair of entity identifiers in MAG. The given pair of entity identifiers could be [Id, Id], [Id, AA.AuId], [AA.AuId, Id], [AA.AuId, AA.AuId]. Each node of a path should be one of the following identifiers: Id, F.Fid, J.JId, C.CId, AA.AuId, AA.AfId. Possible edges (a pair of adjacent nodes) of a path are:

你们要给他搞一个REST服务呀,对给定的点对呀,寻找所有的1-hop, 2-hop, 3-hop路径呀。给定的点对关系可能是这样的呀[Id, Id], [Id, AA.AuId], [AA.AuId, Id], [AA.AuId, AA.AuId], 而你的路径上可以涵盖这些点Id, F.Fid, J.JId, C.CId, AA.AuId, AA.AfId

而两个点之间连边的要求是呀

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<style>
html, body {
height: 100%;
-webkit-tap-highlight-color: transparent;

Keybase proof

I hereby claim:

  • I am yangff on github.
  • I am yangff (https://keybase.io/yangff) on keybase.
  • I have a public key whose fingerprint is DC9F C32F 1859 DEBF B1F7 275C B424 7F16 00FE 969D

To claim this, I am signing this object:

void del_substr(char *str, const char *substr) {
char *c1, *c2;
while (*str++!=0) {
for (c1 = str, c2 = (char*)substr; *c1 == *c2 && *c1 && *c2; c1++, c2++);
if (*c2 == 0)
for (c2 = str; *c2++ = *c1++; );
}
}
void del_substr(char *str, const char *substr) {
for (char *c1, *c2; *str; str+=!!(*c2)) {
for (c1 = str, c2 = (char*)substr; *c1 == *c2 && *c1 && *c2; c1++, c2++);
if (*c2 == 0) {
for (c2 = str; *c2 = *c1; c2++, c1++);
}
}
}
void del_substr(char *str, const char *substr) {
for (int i = 0, j = 0; *str; str += !!*(substr+j)) {
for (j = 0; *(str+i+j) == *(substr+j) && *(substr+j); j++);
*str = *(str+i);
i += !*(substr+j) * j;
}
}
void del_substr(char *str, const char *substr) {
for (int i = 0, j = 0; *str = *(str+i); str += !!*(substr+j), i += !*(substr+j) * j)
for (j = 0; *(str+i+j) == *(substr+j) && *(substr+j); j++);
}