Skip to content

Instantly share code, notes, and snippets.

View Lyken17's full-sized avatar
🎯
Focusing

Ligeng Zhu Lyken17

🎯
Focusing
View GitHub Profile
Reading translation models from nbest file...
Epoch 0...
Mistake in epoch 0: normal mis : 9116 momentum mis : 9390
Epoch 1...
Mistake in epoch 1: normal mis : 4600 momentum mis : 4513
Epoch 2...
Mistake in epoch 2: normal mis : 3168 momentum mis : 3021
Epoch 3...
Mistake in epoch 3: normal mis : 2330 momentum mis : 2318
Epoch 4...
class graph():
def __init__(self, n=4):
self.n = n
self.E = [[] for _ in range(n)]
self.count = 0
self.color = ['white' for _ in range(self.n)]
def addEdge(self, m, n):
self.E[m].append(n)
self.E[n].append(m)
@Lyken17
Lyken17 / surge.conf
Created December 21, 2016 01:29 — forked from jason5ng32/surge.conf
Surge Configs ( for 2.x )
[General]
loglevel = notify
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
# dns-server = 119.29.29.29,223.5.5.5,114.114.115.115
# external-controller-access = PASSWORD@0.0.0.0:6155
# ipv6 = true
// REMEMBER TO CHANGE THE external-controller-access' PASSWORD
#include <iostream>
#include <vector>
#include <chrono>
#include <thread>
using namespace std;
struct A {
int x, y;
A() : x(0), y(0){}
# coding: utf-8
# In[127]:
import numpy as np
from scipy.signal import convolve2d as conv2d
p_label = np.array([[[1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0]],
[[1, 0, 0], [1, 0, 0], [0, 1, 0], [0, 1, 0], [1, 0, 0], [1, 0, 0]],
[[1, 0, 0], [1, 0, 0], [0, 1, 0], [0, 1, 0], [1, 0, 0], [1, 0, 0]],
@Lyken17
Lyken17 / virtual.cpp
Last active March 13, 2017 10:35
Differnece of c++ virtual function
#include <iostream>
#include <vector>
#include <ctime>
using namespace std;
class Dog {
public:
void move() {cout << "dog move" << endl;}
};
@Lyken17
Lyken17 / note.md
Created March 25, 2017 03:17
Prepare rec file of cifar 100 for MXNET

MXNET is a great deep learning framework, and currently has the best support for distribued trainning. However, its documentation lacks maintaince and I get confused in many API details. Though MXNET community has provided a bunch of examples, I do not find useful examples for cifar 100. Since MXNET is using its own data format rec, I have to convert data to rec before training. data.mxnet.io/data only provides rec files of cifar 10. It takes some time for me to figure out how to generate my own cifar 100 rec file.

First, download python version of cifar 100

Then, dump it into images, thanks to apache/mxnet#235

import os
import sys
import pickle
import csv
@Lyken17
Lyken17 / 361-notes.md
Created April 20, 2017 04:36
Power by Armour

Input devices

  • Physical

    • mouse, joystick, keyboard
  • Logical

    • string, locator, choice
  • Event-driven

void del_substr(char *str, const char *substr)
{
int index = 0, position = 0;
while (str[index] != 0) {
if (str[index] == substr[position]) position += 1;
else position = 0;
if (position == sizeof(substr) - 1) {
str[index] = 0;
return;
import numpy as np
from PIL import Image
import os.path as osp
import glob
import fnmatch, re, os, sys
import yaml
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import cv2 as cv