Skip to content

Instantly share code, notes, and snippets.

@zzhuolun
zzhuolun / git_batch_functions.fish
Last active September 24, 2025 10:02
Fish shell functions for batched git operations
#!/usr/bin/env fish
#########################################################################
# Based on the bash script in https://github.com/jackokaiser/dot_profiles
#########################################################################
function find_git_repos
set ignore_pattern "(3|(t|T)hi)rd_?(p|P)arty"
if test (count $argv) -gt 0
if test $argv[1] = "-a"
set ignore_pattern "*"
@zzhuolun
zzhuolun / augmented_ransac.py
Created May 8, 2025 10:20
Ransac plane fitting with colors and normals
import math
import numpy as np
import open3d as o3d
from skimage.color import rgb2lab
from dataclasses import dataclass
@dataclass
class O3DRANSACPlaneFitter:
@zzhuolun
zzhuolun / config.fish
Created March 13, 2025 16:27
fish config
set fish_prompt_pwd_dir_length 7
set fish_prompt_pwd_full_dirs 1
set SYNC_DIR /mnt/sync
function s3_to_local_path
echo $SYNC_DIR/(string replace -r 's3://' '' $argv[1])
return 0
end
@zzhuolun
zzhuolun / io.py
Last active April 3, 2024 15:06
Basic IO operations (cp, cp -r, ls, mkdir) that are AWS s3/local path agnostic using smart_open.
import os
import json
from typing import List, Tuple
import boto3
from smart_open import open
from botocore.exceptions import ClientError
def load_json(path_to_json: str) -> dict:
with open(path_to_json) as file:
@zzhuolun
zzhuolun / .vimrc
Last active May 30, 2023 18:35
My vim conf
" Comments in Vimscript start with a `"`.
"
" If you open this file in Vim, it'll be syntax highlighted for you.
" Vim is based on Vi. Setting `nocompatible` switches from the default
" Vi-compatibility mode and enables useful Vim functionality. This
" configuration option turns out not to be necessary for the file named
" '~/.vimrc', because Vim automatically enters nocompatible mode if that file
" is present. But we're including it here just in case this config file is
@zzhuolun
zzhuolun / .tmux.conf
Last active October 1, 2025 20:15
My tmux config file.
set -g mouse on
set-option -g prefix C-z
bind-key \\ split-window -h # Split panes horizontal
bind-key - split-window -v # Split panes vertically
set -sg escape-time 10
set-option -g default-terminal "screen-256color"
set-option -sa terminal-overrides ',screen-256color:RGB'
set -g default-command /usr/bin/fish
set -g default-shell /usr/bin/fish
@zzhuolun
zzhuolun / simple_GAN.py
Created February 16, 2022 18:34
For learning the basic concepts of GAN
### Learning GAN
### From this tutorial: https://towardsdatascience.com/build-a-super-simple-gan-in-pytorch-54ba349920e4 (code at https://github.com/nbertagnolli/pytorch-simple-gan)
import torch
import torch.nn as nn
import numpy as np
import math
class Generator(nn.Module):
def __init__(self, input_length, middle_length, output_length):
@zzhuolun
zzhuolun / bash_collections.md
Last active December 16, 2024 11:33
Bash Script Collections

set brightness of a selected display

#!/bin/bash
# --- set your monitor below
if [ $1 -eq 0 ]
then 
  monitor=DP-3
elif [ $1 -eq 1 ]
then
 monitor=HDMI-0
import pyautogui, time, math
from matplotlib import pyplot as plt
import numpy as np
from numpy.polynomial import polynomial as P
from pynput import mouse, keyboard
def on_press1(key):
if key == keyboard.Key.esc:
return False # stop listener
try:
@zzhuolun
zzhuolun / shortcuts.md
Last active August 30, 2023 10:26
shortcuts

tmux

default prefix : Ctrl B

operation keyboard shortcut
create a window prefix c
delete a window prefix &
delete a pane Ctrl d
rename a window prefix ,