Skip to content

Instantly share code, notes, and snippets.

View yzchen's full-sized avatar
🏠
Working from home

yzchenmonkey yzchen

🏠
Working from home
  • HeFei, Anhui, China
View GitHub Profile
[alias]
# one-line log
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
a = add
ap = add -p
c = commit --verbose
ca = commit -a --verbose
cm = commit -m
cam = commit -a -m
class Solution {
int dist(string &s, string &t){
int cnt=0;
for(int i=0;i<s.size();i++)
if(s[i]!=t[i])
cnt++;
return cnt;
}
public:
@yzchen
yzchen / hilbert-axioms.md
Created August 2, 2019 19:25
希尔伯特公理

Hilbert Axioms

Notes :

  • > : implication, ->

  • ~ : not, ¬

  • & : and,

@yzchen
yzchen / priotity_queue_of_pair.cc
Created May 9, 2019 15:43
compare mechanism of priority_queue of pairs
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
typedef pair<int, int> pi;
// Driver program to test methods of graph class
int main()
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]){
ios::sync_with_stdio(0);
cin.tie(0);
return 0;
}
@yzchen
yzchen / compare.cc
Created April 28, 2019 13:46
Truncate elements during conversion
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define IndexType int
typedef struct Int1 { IndexType x[1]; } Int1;
typedef struct Int2 { IndexType x[2]; } Int2;
var1="12:08:18.092077"
var2="12:08:18.405611"
# result : x.xxxx secs
difference=$(( $( date -d "$var2" "+%N" ) - $( date -d "$var1" "+%N" ) )); echo "scale=4; $difference/10^9" | bc
find -name "resnet_50_1024_nodes_32k_batch_solver_iter_*" -type f -exec du -ch {} + | grep total$
@yzchen
yzchen / count_total_skylake_nodes.sh
Last active April 18, 2019 10:12
How many skylake nodes are used on Ibex
sinfo --partition=batch --format="%n %f" | grep "intel_gold_6148" | wc -l
@yzchen
yzchen / allreduce-bench.cc
Created April 3, 2019 14:10
Benchmark allreduce in MPI
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <mpi.h>
#include <ctime>
#include <cmath>
using namespace std;