Skip to content

Instantly share code, notes, and snippets.

View rgtjf's full-sized avatar

Junfeng Tian rgtjf

  • SemComp
View GitHub Profile
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active July 5, 2024 08:16 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@wklchris
wklchris / Remote-Jupyter-on-SSH-server.md
Last active July 1, 2024 06:49
Remote Jupyter Notebook via SSH

Main steps

Total 4 steps for connect & exit Jupyter Notebook with a SSH server:

  1. SSH to the Server. Run:
    jupyter notebook --no-browser --port=8888
  2. Open another terminal window on your local machine, input:
@vadimkantorov
vadimkantorov / tensorbackeddictarray.py
Last active December 7, 2023 23:43
Tensor-backed immutable string array and list-of-dicts to be used in PyTorch Dataset classes to work around copied shared memory-pages when using Python lists of strings https://github.com/pytorch/pytorch/issues/13246
import math
import typing
import torch
class StringArray:
def __init__(self, strings : typing.List[str], encoding : typing.Literal['ascii', 'utf_16_le', 'utf_32_le'] = 'utf_16_le'):
strings = list(strings)
self.encoding = encoding
self.multiplier = dict(ascii = 1, utf_16_le = 2, utf_32_le = 4)[encoding]
self.data = torch.ByteTensor(torch.ByteStorage.from_buffer(''.join(strings).encode(encoding)))