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
| echo "myscript.zsh gist" |
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
| // ==UserScript== | |
| // @name Simple Dark Mode Toggle | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2.3 | |
| // @description Toggle dark mode on any site with UI pill toggle and keyboard shortcut | |
| // @match *://*/* | |
| // @grant GM_registerMenuCommand | |
| // @grant GM_unregisterMenuCommand | |
| // @grant GM_getValue | |
| // @grant GM_setValue |
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
| # 0 = history mode, 1 = edit mode | |
| typeset -g __editing=0 | |
| # Up: history until editing begins | |
| function smart-up() { | |
| if (( __editing )); then | |
| zle up-line-or-history | |
| else | |
| zle up-history | |
| fi |
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; |
NewerOlder