Skip to content

Instantly share code, notes, and snippets.

View JiaxiangZheng's full-sized avatar

Jiaxiang Zheng JiaxiangZheng

View GitHub Profile
@JiaxiangZheng
JiaxiangZheng / http_get.go
Created February 24, 2014 05:53 — forked from ijt/http_get.go
demonstrate how to fectch web page given the URL
package main
import (
"fmt"
"net/http"
"io/ioutil"
"os"
)
func main() {
@JiaxiangZheng
JiaxiangZheng / json_encoding_demo.go
Created February 24, 2014 08:47
This file demonstrates golang's json library to encode&decode, marshal&unmarshal json data.
package main
import (
"encoding/json"
"fmt"
"os"
"log"
)
// 主要是靠Marshal和Unmarshal函数进行解析与读取
@JiaxiangZheng
JiaxiangZheng / index.html
Created May 23, 2015 08:15
文本居中示例[CSS] CSS实现的垂直居中方法 // source http://jsbin.com/xapowo
<!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 / pandoc-template.tex
Created December 22, 2013 05:04
This is my pandoc template for daily notes [chinese fonts support]. Pandoc usage see http://johnmacfarlane.net/pandoc/demos.html.
\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
}
@JiaxiangZheng
JiaxiangZheng / cache.js
Last active November 22, 2016 16:19
a simple cache middleware wrapper for nodejs web server
// 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 / sample.md
Created March 19, 2017 03:06
template used in pandoc pdf generation process

title:

  • pandoc PDF 生成示例 author:
  • 郑家祥 date:
  • \today{} fontsize:
  • 10pt documentclass:
@JiaxiangZheng
JiaxiangZheng / ring-queue.js
Created April 18, 2017 03:35
a ring queue with max capacity implements with plain array
/**
* RingQueue implements a cycle
*/
class RingQueue {
constructor(capacity) {
this.list = new Array(capacity + 1);
this.lower = 0;
this.upper = 0;
}
add(v) {
@JiaxiangZheng
JiaxiangZheng / computeRigidTransformUsingSVD.cpp
Last active November 22, 2022 07:13
compute the rigid transformation using SVD with library [Eigen](http://eigen.tuxfamily.org/), usally useful in ICP registration or related works.
//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 / CNN.py
Last active October 10, 2023 18:46
convolutional neural network implemented with python
# 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