Skip to content

Instantly share code, notes, and snippets.

Jiaxiang Zheng JiaxiangZheng

View GitHub Profile
@JiaxiangZheng
JiaxiangZheng / ring-queue.js
Created Apr 18, 2017
a ring queue with max capacity implements with plain array
View ring-queue.js
/**
* RingQueue implements a cycle
*/
class RingQueue {
constructor(capacity) {
this.list = new Array(capacity + 1);
this.lower = 0;
this.upper = 0;
}
add(v) {
@JiaxiangZheng
JiaxiangZheng / CNN.py
Last active Jan 22, 2020
convolutional neural network implemented with python
View CNN.py
# port from https://github.com/hsmyy/zhihuzhuanlan
import numpy as np
import sys
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def conv2(X, k):
# as a demo code, here we ignore the shape check
x_row, x_col = X.shape
k_row, k_col = k.shape
@JiaxiangZheng
JiaxiangZheng / sample.md
Created Mar 19, 2017
template used in pandoc pdf generation process
View sample.md

title:

  • pandoc PDF 生成示例 author:
  • 郑家祥 date:
  • \today{} fontsize:
  • 10pt documentclass:
@JiaxiangZheng
JiaxiangZheng / cache.js
Last active Nov 22, 2016
a simple cache middleware wrapper for nodejs web server
View cache.js
// cache.js
const debug = console.log;
const nextTick = process.nextTick;
const CACHE = {
check(key, req, res) {
if (this._cache[key]) {
debug('cache %s hit', key);
nextTick(() => {
res.end(this._cache[key]);
@JiaxiangZheng
JiaxiangZheng / index.html
Created May 23, 2015
文本居中示例[CSS] CSS实现的垂直居中方法 // source http://jsbin.com/xapowo
View index.html
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="CSS实现的垂直居中方法">
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<meta charset="utf-8">
<title>文本居中示例[CSS]</title>
<style id="jsbin-css">
@JiaxiangZheng
JiaxiangZheng / json_encoding_demo.go
Created Feb 24, 2014
This file demonstrates golang's json library to encode&decode, marshal&unmarshal json data.
View json_encoding_demo.go
package main
import (
"encoding/json"
"fmt"
"os"
"log"
)
// 主要是靠Marshal和Unmarshal函数进行解析与读取
@JiaxiangZheng
JiaxiangZheng / http_get.go
Created Feb 24, 2014 — forked from ijt/http_get.go
demonstrate how to fectch web page given the URL
View http_get.go
package main
import (
"fmt"
"net/http"
"io/ioutil"
"os"
)
func main() {
@JiaxiangZheng
JiaxiangZheng / computeRigidTransformUsingSVD.cpp
Last active Mar 2, 2020
compute the rigid transformation using SVD with library [Eigen](http://eigen.tuxfamily.org/), usally useful in ICP registration or related works.
View computeRigidTransformUsingSVD.cpp
//using Eigen's SVD to fastly compute the rigid transformation between two point clouds.
#include <iostream>
#include <ctime>
#include <Eigen/SVD>
#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <Eigen/Geometry>
using namespace Eigen;
@JiaxiangZheng
JiaxiangZheng / pandoc-template.tex
Created Dec 22, 2013
This is my pandoc template for daily notes [chinese fonts support]. Pandoc usage see http://johnmacfarlane.net/pandoc/demos.html.
View pandoc-template.tex
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{$documentclass$}
\usepackage{geometry} % 設定邊界
\geometry{
top=1in,
inner=1in,
outer=1in,
bottom=1in,
headheight=3ex,
headsep=2ex
}
You can’t perform that action at this time.