Skip to content

Instantly share code, notes, and snippets.

@yishanhe
yishanhe / .zshrc.sample
Created May 8, 2020 18:24
zprof you zsh
zmodload zsh/zprof # top of your .zshrc file
# Your .zshrc stuff
zprof # bottom of .zshrc
@yishanhe
yishanhe / wuhanunited-wechat-footer.html
Created February 15, 2020 07:35
wuhanunited-wechat-footer
{"sig":"3632f9606ff188667f49ea32aa9ad1b402ed386e5f2ee17e61c8a952cea74d8fe614f0de47026b2b1ab256d68c36061e4074a026397adc44db401d317206ec300","msghash":"8e8f6131dd2db7046a1f2c8469804a775f73d96017ffb9493c2736086bebfe6b"}
import numpy as np
# credit to https://github.com/stephencwelch/Neural-Networks-Demystified
class Neural_Network(object):
def __init__(self):
#Define Hyperparameters
self.inputLayerSize = 4
self.outputLayerSize = 1
self.hiddenLayerSize = 2
@yishanhe
yishanhe / latex.txt
Created January 21, 2016 17:48
Prepare pdf with fonts
pdftops yourfile.pdf
ps2pdf14 -dPDFSETTINGS=/prepress yourfile.ps
@yishanhe
yishanhe / ssh_tunnel.txt
Created January 21, 2016 02:36
SSH tunnel
ssh -D7777 -p22 -CNf -c3des user@remotehost
# explain options
# -D local port
# -p remote port
# -C compress data
# -c cipher 3des, des, and blowfish
# -N no excution a remote command
# -f go background
@yishanhe
yishanhe / scale_table_to_fit.tex
Created January 11, 2016 02:24
scale a table or other enviroment
\usepackage[font=small,skip=8pt]{caption} % manully set package, font set small, space skip set 8pt.
\usepackage{adjustbox} % needed for resizebox
\begin{small} % using small if u want a small font in table
\begin{table}[hbt]
\centering
\resizebox{0.85\columnwidth}{!}{ % change the factor to scale the content
\begin{tabular}{@{}lll@{}}
% tablular content
% http://www.tablesgenerator.com/
@yishanhe
yishanhe / cwm_grs_template.tex
Last active May 23, 2016 05:27
College of William and Mary - Graduate Research Symposium Tex Template
% template for College of William and Mary - Graduate Research Symposium
% author: syi(cs)
\documentclass[12pt]{article}
% required format
\pdfpagewidth=8.5in
\pdfpageheight=11in
\usepackage[margin=1in]{geometry}
\usepackage[utf8]{inputenc}
@yishanhe
yishanhe / minipage_single_row_multiple_figures.tex
Last active January 11, 2016 02:25
Use minipage to arrange figures and tables in same row
\begin{figure*}[htb] % in ieee template, figure* will make this figure spanning two columns
\centering
\noindent\begin{minipage}[t]{0.24\linewidth}
\includegraphics[width=0.95\linewidth]{images/knn.pdf}
\caption{Accuracy changes with sampling lengths ($n_{ED}$) and numbers of nearest neighbours. }
\label{knn}
\end{minipage}
\hfill % hfill helps to space those minipages
\begin{minipage}[t]{0.24\linewidth}
\includegraphics[width=0.95\linewidth]{images/dtw-downsampling.pdf}