Skip to content

Instantly share code, notes, and snippets.

View scaomath's full-sized avatar
is slow.

Shuhao Cao scaomath

is slow.
View GitHub Profile
scaomath /
Created July 6, 2021 21:23
Einstein sum reference

Einstein sum refs

Copied from torch's linear algebra test file.

Vector operations

torch.einsum('i->', x)                     # sum
torch.einsum('i,i->', x, x)                # dot
torch.einsum('i,i->i', x, x)               # vector element-wisem mul
torch.einsum('i,j->ij', x, y)              # outer
scaomath /
Last active June 17, 2021 19:49
Jekyll simple workflow to use custom a plugin on Github pages

Jekyll simple workflow to use custom a plugin on Github pages


Mainly following Alexandre Rademaker's guide.

  • Checkout to source branch, where we write things with a custom plugin.
git checkout source
  • Writing things, commit and push the changes
scaomath /
Created April 14, 2021 03:58
Hard reset submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
scaomath /
Last active June 1, 2021 14:21
Survive as a grad student in scientific computing

Survive as a grad student in scientific computing

GitHub 101


What is version control? Most jargons in Git have "literal" meanings.

  • pull, commit, push
  • worktree
  • branch, pull request, merge, comments
scaomath / nninterface.h
Created November 21, 2020 20:47
To do: modify this interface for ROCm
#include "../core/global.h"
#include "../core/commontypes.h"
#include "../core/hash.h"
#include "../core/logger.h"
#include "../neuralnet/desc.h"
#include "../neuralnet/nninputs.h"
scaomath / keybindings.json
Last active November 12, 2020 23:24
VS Code key bindings for shortcuts on Ubuntu Linux to mimic MacOS behavior
// On Ubuntu Linux mimic MacOS keybindings on Logitech MX Keys
// where the layout is slightly different to incorporate both MacOS and Linux into one keyboard
// after customized key mapping: ctrl is mapped to alt; alt is mapped to win; (meta is mapped to ctrl)
// in /etc/default/keyboard: XKBOPTIONS="altwin:ctrl_alt_win"
"key": "ctrl+left",
"command": "cursorHome",
"when": "textInputFocus"
scaomath / settings.json
Last active May 9, 2023 14:56
My VS Code setting file
"[bibtex]": {
"editor.autoIndent": "none",
"editor.fontFamily": "Fira Code Medium",
"editor.fontLigatures": false,
"editor.formatOnPaste": false,
"editor.suggestSelection": "recentlyUsedByPrefix"
"[latex]": {
"editor.autoIndent": "none",