Skip to content

Instantly share code, notes, and snippets.

@tukkek
tukkek / justified.css
Last active March 14, 2026 17:17
Justified Obsidian
/*
* Install:
* 1. Save to `.obsidian/snippets/justified.css`
* 2. Activate in: Options; Appearance; CSS Snippets
*
* Credits:
* * https://forum.obsidian.md/t/align-text-justified-in-obsidian/39301/2
*/
.markdown-source-view.mod-cm6 .cm-line{text-align:justify;}
@tukkek
tukkek / toggle-windows.py
Last active February 22, 2026 16:56
Toggle windows
#!/usr/bin/python3
import ewmh
HIDDEN='_NET_WM_STATE_HIDDEN'
manager=ewmh.EWMH()
windows=manager.getClientList()
minimized=any(HIDDEN in manager.getWmState(window,str=True) for window in windows)
for window in windows:
manager.setWmState(window,not minimized,HIDDEN)
@tukkek
tukkek / text-resize.js
Last active October 13, 2025 14:24
Module to automatically-resize text-area elements.
// no-longer needed after Fire-fox implements textarea{field-sizing:content;}
function update(element){
let rows=element.value.split('\n').length
if(rows<1) rows=1
element.setAttribute('rows',rows)
}
export function resize(element){
update(element)
element.addEventListener('input',()=>update(element))
@tukkek
tukkek / minimal-prompt.md
Last active October 8, 2025 13:01
Minimalist BASH command-prompt.

Minimalist command-prompt for .bashrc-compatible terminals. Good for a clean-look or enabling more; smaller terminal-windows!

PS1_COLOR="\[$(tput bold)\]"
PS1_RESET="\[$(tput sgr0)\]"
PS1_STYLE=" ${PS1_COLOR}\W${PS1_RESET} "
# all terminals
PS1="$PS1_STYLE"
# some terminals
if [[ "$TERM_PROGRAM" == "vscode" ]]; then PS1="$PS1_STYLE"; fi
@tukkek
tukkek / selection-enhancer.js
Last active October 4, 2025 23:46
Selection-enhancer user-script
// ==UserScript==
// @name Selection enhancer.
// @namespace http://tampermonkey.net/
// @version 1.2
// @description Control-click selects and extends-selection.
// @author tukkek
// @match *://*/*
// @grant none
// ==/UserScript==
function expand(c){return c&&!/\s/.test(c)}
@tukkek
tukkek / history.sh
Last active October 4, 2025 23:46
Linux terminal history utility
#!/usr/bin/bash
# 1. Install Fuzzy Finder: apt-get install fzf
# 2. Place this script on your $PATH
# 3. Add to your ~/.bashrc file:
# alias "?=source history.sh"
# 4. Use the ? alias to search and select commands
cmd=`history|cut -c 8-|tac|fzf --reverse --scheme=history`
eval "$cmd"
history -s "$cmd"