Skip to content

Instantly share code, notes, and snippets.

View rgtjf's full-sized avatar

Junfeng Tian rgtjf

  • SemComp
View GitHub Profile
@vadimkantorov
vadimkantorov / tensorbackeddictarray.py
Last active April 12, 2025 11:09
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_32_le'] = 'ascii'):
strings = list(strings)
self.encoding = encoding
self.multiplier = dict(ascii = 1, utf_32_le = 4)[encoding]
# TODO: support varlen encodings: utf-8 and utf-16-le
@wklchris
wklchris / Remote-Jupyter-on-SSH-server.md
Last active July 8, 2025 09:40
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:
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active March 31, 2026 02:31 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

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

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

启动新会话:

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

恢复会话: