Skip to content

Instantly share code, notes, and snippets.

@nialv7
nialv7 / gist:5bbbe4644a1ecda9b1f8
Created June 13, 2014 14:23
S1 MBTI粗统计
%grep -Ehio '(I|E)(N|S)(T|F)(P|J)' *.html | tr 'a-z' 'A-Z' | sort |uniq -c
6 ENFJ
5 ENFP
13 ENTJ
44 ENTP
7 ESFJ
6 ESFP
22 ESTJ
9 ESTP
25 INFJ

Keybase proof

I hereby claim:

  • I am nialv7 on github.
  • I am nialv7 (https://keybase.io/nialv7) on keybase.
  • I have a public key whose fingerprint is 0A36 F6B1 97F5 3B8D 07CA A553 B045 AF76 7FEC DA48

To claim this, I am signing this object:

@nialv7
nialv7 / dyn.rs
Created October 11, 2015 21:36
Partial dynamic dispatch
trait Dump {
fn dump(&self);
}
struct A {
a: i32
}
impl Dump for A {
fn dump(&self) {
println!("{}", self.a);
}
@nialv7
nialv7 / touhou
Last active October 16, 2015 00:43
最受同人欢迎的东方曲
/* 东方曲按同人曲数量排名 */
U.N.Owen Was Her?: 262
亡き王女の為のセプテット: 256
恋色マスタースパーク: 248
幽雅に咲かせ、墨染の桜 ~ Border of Life: 237
ネクロファンタジア: 188
上海紅茶館 ~ Chinese Tea: 169
おてんば恋娘: 166
竹取飛翔 ~ Lunatic Princess: 163
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nialv7
nialv7 / A.cpp
Last active November 22, 2015 00:50
struct A;
struct AAccessor {
int a, b;
};
struct A {
int a[100], b[100];
AAccessor operator[] (const int index) {
return AAccessor{a[index], b[index]};
}
};
@nialv7
nialv7 / transpose.d
Last active November 22, 2015 01:13
import std.meta, std.typetuple, std.traits;
template ArrayTypeOf(int n, T...) {
static if (T.length == 0)
alias ArrayTypeOf = T;
else
alias ArrayTypeOf = AliasSeq!(T[0][n], ArrayTypeOf!(n, T[1..$]));
}
struct Transpose(T, int n) {
alias names = FieldNameTuple!T;
@nialv7
nialv7 / gen.py
Created April 16, 2017 16:14
gen.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
import inspect
import time
import json
import os