Skip to content

Instantly share code, notes, and snippets.

View RaymondSHANG's full-sized avatar

Raymond Yuan SHANG RaymondSHANG

View GitHub Profile
@post2web
post2web / 2D3D_MaxMean_pooling.py
Created June 22, 2018 16:56
max mean pooling with numpy for 2d and 3d data
# from https://stackoverflow.com/questions/42463172/how-to-perform-max-mean-pooling-on-a-2d-array-using-numpy
import numpy as np
def asStride(arr,sub_shape,stride):
'''Get a strided sub-matrices view of an ndarray.
See also skimage.util.shape.view_as_windows()
'''
s0,s1=arr.strides[:2]
m1,n1=arr.shape[:2]
m2,n2=sub_shape
view_shape=(1+(m1-m2)//stride[0],1+(n1-n2)//stride[1],m2,n2)+arr.shape[2:]
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 2, 2024 08:41
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.