Last active
March 19, 2022 19:33
-
-
Save slimlime/c4907d98dbe8b834cb9f4f7bb7f39dcd to your computer and use it in GitHub Desktop.
Revisions
-
slimlime revised this gist
Jul 21, 2021 . 1 changed file with 43 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,6 +24,49 @@ fi unset env # Depends on our environment defaults. # Colour prompt check based on WSL2 Ubuntu LTS 20.04 # Add helpers for custom contextualised terminal prompt # Add Git Bash-style branch meta context information to terminal prompt prefix # See default coloured when working in VS Code remote terminals # export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$" # Gets the asterisked current branch name from git branch output using sed... Parenthesised output show_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } # Default comments and boilerplate that came with installation below: # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt #force_color_prompt=yes if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi # Include the show_git_branch calls here # WARNING: Differences in behaviour compared to the backslash-escaped dollar signs in StackOverflow sample. # See non-escaped evaluated command and then the escape dollar sign when used as pure text literal. # Works in VS Code if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[\033[31m\]$(show_git_branch)\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w $(show_git_branch)\$ ' fi unset color_prompt force_color_prompt # Source helpers -
slimlime revised this gist
Jun 27, 2021 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -106,6 +106,11 @@ alias gdn='gitLookBack' # See recent branches contextual information recent commit dates alias gbrd='git branch --format='"'"'%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]'"'"' --sort=-committerdate' # See all the things all refs including stash in time context. i.e. WIP and branches alias glstash='git log --date-order --all $(git reflog show --format="%h" stash)' # Prefer the majority use case shorthand first. oneline first. Rather than appending 'o' alias glall='git log --oneline --graph --decorate --all $(git reflog show --format="%h" stash) -n 10' alias glallf='git log --graph --decorate --all $(git reflog show --format="%h" stash) -n 2' ## Tmux alias tmux='tmux -2' -
slimlime revised this gist
Jun 22, 2021 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -81,11 +81,15 @@ alias gd='git diff --staged -w --color-moved --color-moved-ws=ignore-all-space' alias gc='git commit -am' alias gf='git fetch --prune' alias gp='git pull -a' alias gpu='git push --follow-tags' __git_complete gpu _git_push # Bash alias compatibility with git-completion # didn't work? gpu -u origin <autocompletebranch> alias gsw='git switch' __git_complete gsw _git_switch # Bash alias compatibility with git-completion # Bash alias compatibility workaround for git-completion autocompletion __git_complete gsw _git_switch # Compatibility with git-completion. Hacky private alias ga='git add . --all' alias gr='git rev-parse --show-toplevel' # git root alias glt="git log --no-walk --tags --pretty=format:' %C(yellow)%h %Cgreen%d %Cred%ad %Creset%s' --date=local" -
slimlime revised this gist
Jun 22, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ default-cache-ttl 86400 max-cache-ttl 86400 -
slimlime revised this gist
Jun 15, 2021 . 1 changed file with 22 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -143,10 +143,30 @@ export GPG_TTY=$(tty) # Provide passphrase only once instead of getting multiple prompts each command/shell # First: sudo apt install keychain # add your key file name eval `keychain --quiet --eval --agents ssh id_ed25519` # Auto append commands to history workaround? # PROMPT_COMMAND='history -a' # Testing this history persistence HISTSIZE=9000 HISTFILESIZE=$HISTSIZE HISTCONTROL=ignorespace:ignoredups _bash_history_sync() { builtin history -a #1 HISTFILESIZE=$HISTSIZE #2 builtin history -c #3 builtin history -r #4 } history() { #5 _bash_history_sync builtin history "$@" } PROMPT_COMMAND=_bash_history_sync -
slimlime revised this gist
Jun 15, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -141,6 +141,7 @@ esac # Fix gpg unable to sign commit data export GPG_TTY=$(tty) # Provide passphrase only once instead of getting multiple prompts each command/shell # First: sudo apt install keychain eval `keychain --quiet --eval --agents ssh id_rsa` -
slimlime revised this gist
Jun 15, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ ; - TODO: Test out the send up conflicts, refine to see alternatives later ; Recommended for performance and compatibility with future AutoHotkey releases. #NoEnv ; Enable warnings to assist with detecting common errors. -
slimlime revised this gist
Jun 15, 2021 . 2 changed files with 5 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -141,6 +141,8 @@ esac # Fix gpg unable to sign commit data export GPG_TTY=$(tty) # First: sudo apt install keychain eval `keychain --quiet --eval --agents ssh id_rsa` # Auto append commands to history workaround? 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 charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,9 @@ gpg --gen-key gpg --list-secret-keys --keyid-format LONG # Get the key id here. Maybe a script can return most recent line gpg --armor --export YOUR_KEY_ID # Get this public pgp key block for GitHub # Set this up to only provide SSH passphrase the first time in Linux / WSL2 rather than per command or per shell. # .bashrc: eval `keychain --quiet --eval --agents ssh id_rsa` sudo apt install keychain git config --global user.email [email protected] git config --global user.name slinu -
slimlime revised this gist
Jun 9, 2021 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -92,8 +92,13 @@ alias glt="git log --no-walk --tags --pretty=format:' %C(yellow)%h %Cgreen%d %C alias glbr='git log --oneline --decorate --graph --all' alias gl='git log --oneline --decorate --graph -n 7' # See diff back by number. otherwise default back by 1. gitLookBack() { # Expect happy input. Single digit $1 first arg. git diff --staged -w --color-moved --color-moved-ws=ignore-all-space HEAD~$1 } alias gdn='gitLookBack' # See recent branches contextual information recent commit dates alias gbrd='git branch --format='"'"'%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]'"'"' --sort=-committerdate' -
slimlime revised this gist
Jun 9, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -93,7 +93,7 @@ alias glbr='git log --oneline --decorate --graph --all' alias gl='git log --oneline --decorate --graph -n 7' # See diff back by number. otherwise default back by 1. alias gdn='git diff --staged -w --color-moved --color-moved-ws=ignore-all-space HEAD~' # See recent branches contextual information recent commit dates alias gbrd='git branch --format='"'"'%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]'"'"' --sort=-committerdate' -
slimlime revised this gist
Jun 9, 2021 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -92,7 +92,11 @@ alias glt="git log --no-walk --tags --pretty=format:' %C(yellow)%h %Cgreen%d %C alias glbr='git log --oneline --decorate --graph --all' alias gl='git log --oneline --decorate --graph -n 7' # See diff back by number. otherwise default back by 1. alias gd='git diff --staged -w --color-moved --color-moved-ws=ignore-all-space HEAD~' # See recent branches contextual information recent commit dates alias gbrd='git branch --format='"'"'%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]'"'"' --sort=-committerdate' ## Tmux alias tmux='tmux -2' -
slimlime revised this gist
Jun 9, 2021 . 1 changed file with 14 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -65,29 +65,33 @@ alias git-bash='/git-bash.exe & > /dev/null 2&>1' ## Git # Potential updated next versions of git with respective completion # Use the file from here # `curl https://raw.githubusercontent.com/git/git/v2.25.1/contrib/completion/git-completion.bash -o ~/.git-completion_v2.25.1.bash` source ~/.git-completion_v2.25.1.bash # Use global g main for all instead of per command. Simplicity. # Hacky workaround which works for all the g-prefixed aliases g b g c g switch gsw # for branch name autocompletion __git_complete g __git_main alias gs='git status -sb' alias gd='git diff --staged -w --color-moved --color-moved-ws=ignore-all-space' alias gc='git commit -am' alias gf='git fetch --prune' alias gp='git pull -a' alias gpu='git push --follow-tags' alias gsw='git switch' # Bash alias compatibility workaround for git-completion autocompletion __git_complete gsw _git_switch # Compatibility with git-completion. Hacky private alias ga='git add . --all' alias gr='git rev-parse --show-toplevel' # git root alias glt="git log --no-walk --tags --pretty=format:' %C(yellow)%h %Cgreen%d %Cred%ad %Creset%s' --date=local" alias glbr='git log --oneline --decorate --graph --all' alias gl='git log --oneline --decorate --graph -n 7' ## Tmux -
slimlime revised this gist
Jun 9, 2021 . 1 changed file with 13 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -62,6 +62,8 @@ alias gurl='curl --compressed' ### Open duplicate git bash window in same pwd alias git-bash='/git-bash.exe & > /dev/null 2&>1' ## Git alias gs='git status -sb' alias gd='git diff --staged -w --color-moved --color-moved-ws=ignore-all-space' @@ -70,13 +72,23 @@ alias gf='git fetch --prune' alias gp='git pull -a' alias gpu='git push --follow-tags' alias gsw='git switch' # Use global g main for all instead of per command. Simplicity. # __git_complete gsw _git_switch # Compatibility with git-completion. Hacky private alias ga='git add . --all' alias gr='git rev-parse --show-toplevel' # git root alias glt="git log --no-walk --tags --pretty=format:' %C(yellow)%h %Cgreen%d %Cred%ad %Creset%s' --date=local" alias glbr='git log --oneline --decorate --graph --all' alias gl='git log --oneline --decorate --graph -n 7' # Potential updated next versions of git with respective completion # Use the file from here # `curl https://raw.githubusercontent.com/git/git/v2.25.1/contrib/completion/git-completion.bash -o ~/.git-completion_v2.25.1.bash` # source ~/.git-completion_v2.25.1.bash # New hacky workaround which works for all the g-prefixed aliases g b g c g switch gsw # for branch name autocompletion __git_complete g __git_main ## Tmux alias tmux='tmux -2' -
slimlime revised this gist
Jun 9, 2021 . 1 changed file with 39 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ New setup # For the moment. Until refine with docker and devcontainers as well echo 'Take as a guide rather than a script.' Install nvm or fnm or volta ... Linux or WSL2 Using the anonymous noreply email linked to GitHub in these examples `[email protected]` # SSH and GPG with GitHub ssh-keygen -t ed25519 -C "[email protected]" # Copy out ~/.ssh/id_ed25519.pub for GitHub # gpg vs gpg2? or already silently ported alias.. gpg --gen-key gpg --list-secret-keys --keyid-format LONG # Get the key id here. Maybe a script can return most recent line gpg --armor --export YOUR_KEY_ID # Get this public pgp key block for GitHub git config --global user.email [email protected] git config --global user.name slinu git config --global push.followTags true git config --global commit.gpgsign true git config --global user.signingkey git config --global alias.co checkout git config --global alias.c commit git config --global alias.s status git config --global alias.b branch -
slimlime revised this gist
Jun 9, 2021 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -70,7 +70,7 @@ alias gf='git fetch --prune' alias gp='git pull -a' alias gpu='git push --follow-tags' alias gsw='git switch' __git_complete gsw _git_switch # Compatibility with git-completion. Hacky private alias ga='git add . --all' alias gr='git rev-parse --show-toplevel' # git root alias glt="git log --no-walk --tags --pretty=format:' %C(yellow)%h %Cgreen%d %Cred%ad %Creset%s' --date=local" @@ -113,6 +113,12 @@ xterm*) esac # _Git Bash Git\etc\profile.d\aliases.sh bug still loads these even with .bashrc present ---- # Fix gpg unable to sign commit data export GPG_TTY=$(tty) # Auto append commands to history workaround? PROMPT_COMMAND='history -a' -
slimlime revised this gist
Jun 9, 2021 . 1 changed file with 74 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,74 @@ ; Recommended for performance and compatibility with future AutoHotkey releases. #NoEnv ; Enable warnings to assist with detecting common errors. ; #Warn ; Some rough parts like Windows overrides. ; Lots of to dos to test after validating the value of the current ruleset. ; Nice work with the semicolon-as-modifier key though some workarounds ; Somep arts are dependent on your standard keyboard layout ; SendMode Input Recommended for new scripts due to its superior speed and reliability. SendMode Input ; Ensure a consistent starting directory. SetWorkingDir %A_ScriptDir% ; Use Caps Lock as a modifier only SetCapsLockState AlwaysOff #CapsLock::CapsLock ; Walk delete backwards forwards. Backslash (Delete backwards) slightly closer for piano fingers. ; Though kills common shortcuts remapped, conceptually, human big brain mental model ; For 10x dev vs 0.5x standard keyboard layout ; \::Backspace ; Backspace::Delete CapsLock & \::\ ; ??? Not working?? .... without, ctrl unpresses held down ';' `; & ~Ctrl up::Send, {Ctrl Up} ; disable ctrl + ';' shortcut in google docs ; ~Ctrl & `;::Send, {Ctrl} ; Personal preference for one-handed colon character press usage ; ~^ & `;::; LCtrl & `;::; ; CapsLock & `;::; ; This may be a trap? ; This appears to be the real one that allows CAPS + ; to send ; `; & ~CapsLock up::Send, {CapsLock Up} `; & j::Left `; & i::Up `; & k::Down `; & l::Right `; & h::Home `; & o::End `; & u::PgUp `; & n::PgDn ; CapsLock & k::Media_Play_Pause ; CapsLock & j::Send {Ctrl down}{Alt down}{Shift down}{F6}{Ctrl up}{Alt up}{Shift up} ; CapsLock & l::Send {Ctrl down}{Alt down}{Shift down}{F7}{Ctrl up}{Alt up}{Shift up} ; CapsLock & h::Media_Prev ; CapsLock & o::Media_Next ; CapsLock & p::Media_Stop ; CapsLock & u::Send {Ctrl down}{Alt down}{Shift down}{F4}{Ctrl up}{Alt up}{Shift up} ; CapsLock & n::Send {Ctrl down}{Alt down}{Shift down}{F5}{Ctrl up}{Alt up}{Shift up} Ctrl & q::Send !{F4} ; Interesting next line CapsLock & Enter:: Send, {End} Sleep, 2 Send, {Enter} return +WheelDown::WheelRight +WheelUp::WheelLeft -
slimlime renamed this gist
Jun 9, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
slimlime created this gist
Jun 9, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,118 @@ # Share ssh session between terminals see sock tok env=~/.ssh/agent.env agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; } agent_start () { (umask 077; ssh-agent >| "$env") . "$env" >| /dev/null ; } agent_load_env # agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?) if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then agent_start ssh-add elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then ssh-add fi unset env # Source helpers ~/bash-my-source/git-completion.bash # Aliases alias untar='tar -zxvf -v' alias wget='wget -c -v ' alias getpass="openssl rand -base64 20" alias sha='shasum -a 256 ' # alias ping='ping -c 5' alias www='python -m SimpleHTTPServer 8000' alias speed='speedtest-cli --server 2406 --simple' alias ipe='curl --verbose ipinfo.io/ip' # Git Bash Git\etc\profile.d\aliases.sh bug still loads these even with .bashrc present ----- # Some good standards, which are not used if the user # creates his/her own .bashrc/.bash_profile # --show-control-chars: help showing Korean or accented characters # Aliases alias l='ls -aF --color=auto --show-control-chars' alias ls='ls -F --color=auto --show-control-chars' alias ll='ls -lah' alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' ## Other helpers ### Gzip-enabled `curl` alias gurl='curl --compressed' ### Open duplicate git bash window in same pwd alias git-bash='/git-bash.exe & > /dev/null 2&>1' ## Git alias gs='git status -sb' alias gd='git diff --staged -w --color-moved --color-moved-ws=ignore-all-space' alias gc='git commit -am' alias gf='git fetch --prune' alias gp='git pull -a' alias gpu='git push --follow-tags' alias gsw='git switch' __git_complete gsw _git_switch # Compatibility with git-completion alias ga='git add . --all' alias gr='git rev-parse --show-toplevel' # git root alias glt="git log --no-walk --tags --pretty=format:' %C(yellow)%h %Cgreen%d %Cred%ad %Creset%s' --date=local" alias glbr='git log --oneline --decorate --graph --all' alias gl='git log --oneline --decorate --graph -n 7' ## Tmux alias tmux='tmux -2' alias tmuxls="ls $TMPDIR/tmux*/" tping() { for p in $(tmux list-windows -F "#{pane_id}"); do tmux send-keys -t $p Enter done } tpingping() { [ $# -ne 1 ] && return while true; do echo -n '.' tmux send-keys -t $1 ' ' sleep 10 done } # npm winpty for Windows cmd case "$TERM" in xterm*) # The following programs are known to require a Win32 Console # for interactive usage, therefore let's launch them through winpty # when run inside `mintty`. for name in node ipython php php5 psql python2.7 do case "$(type -p "$name".exe 2>/dev/null)" in ''|/usr/bin/*) continue;; esac alias $name="winpty $name.exe" done ;; esac # _Git Bash Git\etc\profile.d\aliases.sh bug still loads these even with .bashrc present ---- # Auto append commands to history workaround? PROMPT_COMMAND='history -a'