Skip to content

Instantly share code, notes, and snippets.

@cemiu
cemiu / surfingkeys_config.js
Last active August 14, 2025 10:54
surfingkeys config
// permalink:
// https://gist.githubusercontent.com/cemiu/3a0847a2783b1898fc5815db772bf84f/raw/surfingkeys_config.js
// /*
api.unmapAllExcept([
'i', 'gi', // text box
'f', 'gf', // click link (active tab; non-active tab)
'e', 'd', 'j', 'k', // navigate page
'/', 'n', 'N', 'T',
';e',
@cemiu
cemiu / .bashrc
Last active February 5, 2025 15:29
bash better logging of commands
trap 'export CMD_START_TIME=$(date +%s)' DEBUG
precmd() {
local exit_code=$?
[ -z "$CMD_START_TIME" ] && return
local now=$(date +%s)
local elapsed=$(printf "%dh%d" $(( (now - CMD_START_TIME) / 3600 )) $(( (now - CMD_START_TIME) % 3600 / 60 )))
local start_time=$(date -d "@${CMD_START_TIME%.*}" +'%Y-%m-%d %H:%M:%S')
local cmd=$(HISTTIMEFORMAT= history 1 | sed 's/^ *[0-9]* *//')
skips=(ls "ls *" ll "*.bashrc*" exit history "cd *" vim "vim *")
"""
Merge Llama3.2-Instruct template & eos_token into Llama3.2 (pre-trained)
"""
from transformers import AutoTokenizer, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained('meta-llama/Llama-3.2-1B')
tok = AutoTokenizer.from_pretrained('meta-llama/Llama-3.2-1B')
@cemiu
cemiu / gpustat.py
Last active May 25, 2025 13:15
Grid Engine GPU jobs status
#!/usr/bin/env python3
"""
For Sun Grid Engine, print all GPU nodes' utilizations
"""
import subprocess
import xml.etree.ElementTree as ET
import pandas as pd
import re
@cemiu
cemiu / gifpause.user.js
Created June 14, 2024 11:37
Userscript to pause and resume animations of GIFs and WebP with right-click
// ==UserScript==
// @name GifPause: Pause and Resume annoying GIF Animations on Right Click
// @author cemiu
// @namespace https://cemiu.net/
// @license MIT
// @version 1.4
// @description Pause and resume GIF and WebP animations on right-click
// @match *://*/*
// @grant none
// ==/UserScript==
@cemiu
cemiu / videospeedchanger.user.js
Last active October 25, 2023 11:51
SpeedeKey: Control HTML5 Video Speed with the Keyboard (userscript)
// ==UserScript==
// @name SpeedeKey: Control HTML5 Video Speed with a Tap
// @author cemiu
// @license MIT
// @namespace https://cemiu.net/
// @homepage https://gist.github.com/cemiu/db9f64b9d199b75ab218bb7a23b68734
// @homepage https://cemiu.net/
// @version 0.5
// @description Change HTML5 video playback speed right from your keyboard. ("[" to decrease, "]" to increase, Backspace to reset)
// @match *://*/*
@cemiu
cemiu / imessage_text_exporter_macos.py
Last active December 23, 2022 23:14
Simply export iMessage chats as searchable text files (macOS)
# Written by cemiu, distributed under the MIT License
# Quick and dirty script to export iMessage conversations as searchable text; Without attatchments or images.
# This version supports macOS only, though Windows support should be possible with some light modifications.
# Usage:
# Create a local, unencrypted (!) backup of an iOS / iPadOS device, through Finder
# Open System Settings > Security & Privacy > Privacy > Full Disk Access > Add Terminal.app (Utilities folder)
# Download imessage_text_exporter_macos.py file, run Terminal, execute:
# python imessage_text_exporter_macos.py