This file contains hidden or 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
// turn -abc5 into -a -b -c5 | |
// ex: | |
// takesValue := map[rune]bool{'c': true} | |
// expandedArgs := expandShortOpts(os.Args[1:], takesValue) | |
func expandShortFlags(args []string, withValue map[rune]bool) []string { | |
var out []string | |
doubledash := false | |
for _, arg := range args { | |
if doubledash { | |
out = append(out, arg) |
This file contains hidden or 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 | |
# Normalize --long-flags to -s short ones for use with getopts. | |
normalize_flags() { | |
local shortopt longopt | |
local -a args=() | |
local -A spec=() | |
# Process option definitions until we hit the -- separator | |
while [[ "$#" -gt 0 && "$1" != -- ]]; do |
This file contains hidden or 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/awk -f | |
# colorize-path - add color to paths in specified field | |
# usage: | |
# command | ./bin/colorize-paths | |
# git ls-tree -r HEAD | ./bin/colorize-paths -v field=4 | |
# ls -la | ./bin/colorize-paths -v field=9 | |
# | |
BEGIN { |
This file contains hidden or 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
from xonsh.built_ins import XSH | |
$MAGIC_ENTER_GIT_COMMAND = "git status -sb ." | |
$MAGIC_ENTER_OTHER_COMMAND = "ls -lahF ." | |
$MAGIC_ENTER_RUN_COMMAND = "" | |
@events.on_transform_command | |
def magic_enter(cmd, **_): | |
"""Custom Enter key behavior: runs 'ls' if no command was given.""" | |
if not cmd.strip(): |
This file contains hidden or 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 fish | |
path resolve (status --current-filename)/.. |
This file contains hidden or 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
# 5 lines from the bottom | |
PS1=$'\n\n\n\n\n\e[5A'"$PS1" |
This file contains hidden or 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
ALTER TABLE public.mytable | |
ADD COLUMN add_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
ADD COLUMN add_user VARCHAR(255) NOT NULL DEFAULT current_user, | |
ADD COLUMN change_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
ADD COLUMN change_user VARCHAR(255) NOT NULL DEFAULT current_user; |
This file contains hidden or 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
create table public.dim_date | |
( | |
id integer not null | |
primary key, | |
date_value date not null | |
unique, | |
datetime_value timestamp not null, | |
calendar_year integer not null, | |
calendar_month integer not null, | |
calendar_day integer not null, |
This file contains hidden or 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
{ | |
"version": 1, | |
"notes": "", | |
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", | |
"keyboard": "keychron/v2/ansi", | |
"keymap": "keychron_v2_ansi_layout_ansi_67_2025-02-16", | |
"layout": "LAYOUT_ansi_67", | |
"layers": [ | |
[ | |
"KC_ESC", |
This file contains hidden or 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
# Strip leading dollar signs. Fixes commands pasted from markdown. | |
# Requires ble.sh: https://github.com/akinomyoga/ble.sh | |
# shellcheck disable=SC2016 | |
ble/function#advice around ble/widget/default/accept-line ' | |
if [[ "${_ble_edit_str:0:2}" == "$ " ]]; then | |
ble/widget/beginning-of-logical-line | |
ble/widget/insert-string "${_ble_edit_str:2}" | |
ble/widget/kill-forward-logical-line | |
fi | |
ble/function#advice/do |
NewerOlder