Skip to content

Instantly share code, notes, and snippets.

View theonegis's full-sized avatar

Victor Tan theonegis

View GitHub Profile
@theonegis
theonegis / .gitignore
Created March 28, 2019 14:27
latex and word related gitignore configuration
.*
!/.gitignore
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
@theonegis
theonegis / sliding_window.py
Last active March 14, 2019 18:43
Use numpy to produce a view from a sliding, striding window over an array of arbitrary dimensions
def sliding_window_view(arr, window_shape, steps):
""" Produce a view from a sliding, striding window over `arr`.
The window is only placed in 'valid' positions - no overlapping
over the boundary.
Parameters
----------
arr : numpy.ndarray, shape=(...,[x, (...), z])
The array to slide the window over.
@theonegis
theonegis / sin.rnn.py
Created March 1, 2019 19:53
最简单的RNN实例
import torch
from torch import nn
import numpy as np
import matplotlib.pyplot as plt
torch.manual_seed(2019)
# 超参设置
TIME_STEP = 10 # RNN时间步长
INPUT_SIZE = 1 # RNN输入尺寸
@theonegis
theonegis / vimrc
Last active February 28, 2019 17:07
最简单的vim配置
set encoding=utf-8
set fileencoding=utf-8
set nu
set autoindent
set smartindent
set tabstop=4
set backspace=2
set showmatch
set ruler
syntax on
@theonegis
theonegis / ys.zsh-theme
Last active February 27, 2019 19:14
customized zsh theme
# Clean, simple, compatible and meaningful.
# Tested on Linux, Unix and Windows under ANSI colors.
# It is recommended to use with a dark background.
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
#
# Mar 2013 Yad Smood
# VCS
YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}%{$reset_color%} "
YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}"
@theonegis
theonegis / pdf2im.sh
Created December 27, 2018 23:44
PDF文件转为长图片
#!/bin/bash
## 计算pdf文件名,参考资料:
# http://www.runoob.com/linux/linux-shell-variable.html
# https://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash/965072
# https://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash
# https://stackoverflow.com/questions/3362920/get-just-the-filename-from-a-path-in-a-bash-script
# 需要安装GhostScript和ImageMagick
pdfname=$1