Skip to content

Instantly share code, notes, and snippets.

@near129
near129 / async-prompt.zsh
Created May 7, 2025 09:47
async-prompt.zsh
source ~/dev/tmp/zsh-async/async.zsh
# autoload -Uz async && async
BASE_PROMPT=$PROMPT
prompt_precmd() {
if [[ -n "$PRE_PROMPT" ]]; then
PROMPT="$PRE_PROMPT"
fi
async_stop_worker prompt_async_worker
@near129
near129 / quake_wezterm.ahk
Created June 9, 2023 14:30
Quake-style WezTerm toggle for AutoHotkey
; Quake-style WezTerm toggle for AutoHotkey
; I referred to https://github.com/ehpc/quake-windows-bash. Thank you.
#SingleInstance force
global ProgramName := "wezterm-gui.exe"
global WinTitle := "ahk_exe " . ProgramName
!w::
{
if WinExist(WinTitle)
WinGetMinMax(WinTitle) = -1 ? WinRestore(WinTitle) : WinMinimize(WinTitle)
{
"figure": {
"prefix": "figure",
"body": [
"\\begin{figure}[htb]",
" \\centering",
" \\includegraphics[width=\\textwidth]{figures/${1}}",
" \\caption{${2}}",
" \\label{fig:${3}}",
"\\end{figure}",
@near129
near129 / timer.py
Last active January 15, 2023 13:52
import time
from contextlib import contextmanager
@contextmanager
def timer(msg=''):
start = time.time()
yield
print(f'{msg} {time.time() - start:.4f}')
@near129
near129 / Dockerfile
Last active April 16, 2023 16:16
Docker + Python + Poetry + GPU
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
RUN set -eux; \
apt-get update && \
apt-get install -y --no-install-recommends \
curl git gcc g++ wget bzip2 \
libgl1-mesa-dev libopencv-dev cmake ffmpeg \
python3-dev python3-pip && \
@near129
near129 / pyproject.toml
Created November 19, 2022 13:31
settings for black and isort in pyproject.toml
[tool.black]
line-length = 119
skip-string-normalization = true
[tool.isort]
profile = "black"
line_length = 119