This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TIME_DURATION_UNITS = ( | |
('week', 60*60*24*7), | |
('day', 60*60*24), | |
('hour', 60*60), | |
('min', 60), | |
('sec', 1) | |
) | |
def human_time_duration(seconds): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/ioctl.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <termios.h> | |
enum { | |
KEYSTATE_NONE = 1024, | |
KEYSTATE_ESCAPE, | |
KEYSTATE_CONTROL, | |
KEYSTATE_MOUSE_PROPS |