<prefix>-space
change layout
<prefix>-}
<prefix>-{
move pane
-;
move between panes
function randomBoolean() { | |
return Math.random() < 0.5; | |
} | |
function chunkArray<T>(array: T[], chunkSize: number): T[][] { | |
return Array.from( | |
{ length: Math.ceil(array.length / chunkSize) }, | |
(_, index) => array.slice(index * chunkSize, (index + 1) * chunkSize), | |
); | |
} |
async function withMeasure<T>(label: string = 'Measurement', fn: () => Promise<T>) { | |
function bytes2MB(bytes: number): number { | |
return bytes / (1024 * 1024) | |
} | |
const pstart = performance.now() | |
const mstart = process.memoryUsage().heapUsed | |
const result = await fn() |
<prefix>-space
change layout
<prefix>-}
<prefix>-{
move pane
-;
move between panes
function Comp({ content }) { | |
return content.split('\r\n').map((line, i) => | |
<p key={i}>{line.length ? line : <br />}</p>) | |
} |
function useOutsideAlerter(ref, eventType, callback, childSelector) { | |
useEffect(() => { | |
function handler(event) { | |
if (!ref.current) return; | |
const clickedOutside = childSelector | |
? !Array.from(ref.current.querySelectorAll(childSelector)).some( | |
(node) => node.contains(event.target), | |
) | |
: !ref.current.contains(event.target); |
set -g default-terminal "screen-256color" | |
set-option -sa terminal-overrides ",xterm-256color:RGB" |
# https://www.reddit.com/r/NixOS/comments/mwbr8t/comment/gvhm2mh/?utm_source=share&utm_medium=web2x&context=3 | |
systemd.services.touchegg = { | |
enable = true; | |
description = "Touchégg. The daemon."; | |
wantedBy = [ "multi-user.target" ]; | |
serviceConfig = { | |
Type = "simple"; | |
Group = "input"; | |
Restart = "on-failure"; | |
RestartSec = 5; |
# nvim $profile - to edit the file | |
Import-Module PSFZF # enable fzf keybinding | |
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete # enable autocomplete |
; Change Caps Lock to Control when held down; otherwise, Escape | |
; | |
; Originally based on the answer provided in | |
; [this](https://superuser.com/questions/581692/remap-caps-lock-in-windows-escape-and-control) | |
; StackExchange SuperUser question. | |
; | |
; A shortcut should be created for this script and placed in the Windows 10 | |
; user's startup folder to automatically enable the feature on boot/startup. | |
; The user's startup folder can be found using the following steps: | |
; |