Skip to content

Instantly share code, notes, and snippets.

@geraldlai
geraldlai / dayo
Last active December 16, 2017 19:34
dayo: date alternative
#!/usr/bin/perl
# Daylight come and he wan' go home ...
# $ dayo 12am
# Thu Oct 19 00:00:00 2017 PDT -0700 | America/Los_Angeles | 1508396400
#
# $ dayo 'yesterday - 2 hours'
# Wed Oct 18 20:39:18 2017 PDT -0700 | America/Los_Angeles | 1508384358
#
@geraldlai
geraldlai / keybase.md
Created October 21, 2017 07:06
Keybase Proof

Keybase proof

I hereby claim:

  • I am geraldlai on github.
  • I am geraldlai (https://keybase.io/geraldlai) on keybase.
  • I have a public key ASBTqM_G4735KEFfwf2caEvW7ZFQM9nGr-dCVo6SCdJFuQo

To claim this, I am signing this object:

@geraldlai
geraldlai / git-macho
Last active May 13, 2022 23:01
git-macho: git checkout drop-in replacement
#!/usr/bin/perl
# git (ma)gic (ch)eck(o)ut - Oooh keep it together, git!
#
# Each branch maintains its stashed changes separately & contained.
# Usage: 'git macho' drop-in replacement for 'git checkout'
# Author: Gerald Lai
# License: 0BSD
@geraldlai
geraldlai / git-mergic
Last active October 17, 2021 04:58
git-mergic: easy merge
#!/usr/bin/env perl
# git (mer)ge ma(gic) - DWIM rebasing
# $ git mergic master
# # Merging from: [origin] master
# ( merges or rebases current branch onto origin/master )
# Author: Gerald Lai
# License: 0BSD
@geraldlai
geraldlai / tmx
Created November 10, 2017 06:47
tmx: send keystrokes to tmux panes and new/split windows
#!/usr/bin/perl
# tmx: tmux execute (requires tmux v2.4+)
# Author: Gerald Lai
# License: 0BSD
use warnings;
use strict;
@geraldlai
geraldlai / stun
Created November 10, 2017 07:01
stun: yet another ssh tunneling tool
#!/usr/bin/perl
# stun: ssh tunneling wrapper for convenient static port forwarding
# Author: Gerald Lai
# License: 0BSD
use warnings;
use strict;
@geraldlai
geraldlai / wgrep
Created September 5, 2018 03:54
wgrep: write grep output back as changes
#!/usr/bin/perl
# wgrep: write grep output back as changes
# ( requires 'ed' line editor )
# $ grep -Rn foo . | sed 's/foo/bar/' | wgrep
# ( 'wgrep -a' avoids trimming trailing spaces by default )
# Author: Gerald Lai
# License: 0BSD
@geraldlai
geraldlai / snuff
Created February 5, 2019 23:21
snuff: kill processes gracefully
#!/usr/bin/perl
# snuff: kill processes gracefully
# Author: Gerald Lai
# License: 0BSD
use warnings;
use strict;
@geraldlai
geraldlai / git-commit-fix
Last active May 2, 2024 21:55
git commit-fix: fixup an old commit quickly
#!/usr/bin/perl
# git commit-fix: fixup an old commit quickly
# $ git commit-fix 1efa604
# ( fixup commit 1efa604 to have currently staged changes )
# ( unstaged changes will be safely stashed away )
# $ git commit-fix -s 1efa604
# ( same as above, but allow new commit message to be squashed in )
# remap prefix
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix
# 0 is too far
set -g base-index 1
setw -g pane-base-index 1
# vi bindings for copy mode