Skip to content

Instantly share code, notes, and snippets.

View kiyoon's full-sized avatar

Kiyoon Kim kiyoon

View GitHub Profile
@kiyoon
kiyoon / xterm_get_mouse_click_and_chars.c
Created December 27, 2023 08:53 — forked from twaik/xterm_get_mouse_click_and_chars.c
Getting mouse clicks on xterm.
#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
enum {
KEYSTATE_NONE = 1024,
KEYSTATE_ESCAPE,
KEYSTATE_CONTROL,
KEYSTATE_MOUSE_PROPS
@kiyoon
kiyoon / compare_safetensors.py
Created November 15, 2023 04:58 — forked from madebyollin/compare_safetensors.py
script for comparing the contents of safetensors files
#!/usr/bin/env python3
from pathlib import Path
from safetensors.torch import load_file
def summarize_tensor(x):
if x is None:
return "None"
x = x.float()
return f"({x.min().item():.3f}, {x.mean().item():.3f}, {x.max().item():.3f})"
@kiyoon
kiyoon / starship.toml
Last active December 20, 2022 18:08 — forked from ryo-ARAKI/starship.toml
Starship configuration file
# ~/.config/starship.toml
[battery]
full_symbol = "🔋"
charging_symbol = "🔌"
discharging_symbol = "⚡"
[[battery.display]]
threshold = 30
style = "bold red"
@kiyoon
kiyoon / start_ngrok_telegram_bot.sh
Created March 11, 2022 13:38 — forked from obokaman-com/start_ngrok_telegram_bot.sh
A bash script to start Ngrok in background, and send ngrok URL to a Telegram Bot automatically, copying the remote URL to clipboard
#!/usr/bin/env bash
# Start NGROK in background
echo "⚡️ Starting ngrok"
ngrok http 8080 > /dev/null &
# Wait for ngrok to be available
while ! nc -z localhost 4040; do
sleep 1/5 # wait Ngrok to be available
done
@kiyoon
kiyoon / human_time_duration.py
Last active June 11, 2021 14:46 — forked from borgstrom/human_time_duration.py
Python: Convert seconds (duration) to human readable string
TIME_DURATION_UNITS = (
('week', 60*60*24*7),
('day', 60*60*24),
('hour', 60*60),
('min', 60),
('sec', 1)
)
def human_time_duration(seconds):