Skip to content

Commit 3c04305

Browse files
committed
✨ Add mergetool, various fixes
1 parent eb8dca0 commit 3c04305

13 files changed

+83
-47
lines changed

.bash_profile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,18 @@ alias sm='smerge'
5656

5757
# bash_history
5858

59-
shopt -s histverify # https://unix.stackexchange.com/a/4082
6059
# global bash history https://unix.stackexchange.com/a/1292
6160
# Avoid duplicates
62-
export HISTCONTROL=ignoredups:erasedups
63-
# When the shell exits, append to the history file instead of overwriting it
64-
shopt -s histappend
61+
export HISTCONTROL=ignoredups #:erasedups
6562
# After each command, append to the history file and reread it
6663
# export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
67-
64+
export HISTSIZE=
65+
export HISTFILESIZE=
66+
export HISTTIMEFORMAT="[%F %T] "
67+
export HISTFILE=~/.bash_eternal_history
68+
# When the shell exits, append to the history file instead of overwriting it
69+
shopt -s histverify # https://unix.stackexchange.com/a/4082
70+
shopt -s histappend
6871

6972
# prompt
7073

@@ -79,9 +82,6 @@ PS1="⨊ 𝕯𝓭𝓵:\[\033[36m\]\w\[\033[m\]$ " # ⚛ ⨊ 𝓓𝔇𝒟ℓℒ
7982

8083
# functions
8184

82-
# https://github.com/ddelange/yt
83-
source "${HOME}/git/yt/yt.sh"
84-
8585
# https://gist.github.com/ddelange/24575a702a10c2cb6348c4c7f342e0eb
8686
kubelogs() {
8787
# View logs as they come in (like in Rancher) using mktemp and less -r +F.
@@ -103,13 +103,13 @@ kubelogs() {
103103
return
104104
fi
105105
local tmpfile=`mktemp`
106-
local log_tail_lines=${KUBELOGS_MAX:-1000}
107-
local sleep_amount=$((5 + log_tail_lines / 400))
106+
local log_tail_lines=${KUBELOGS_MAX:-10000}
107+
local sleep_amount=$((7 + log_tail_lines / 20000))
108108
echo "kubectl logs --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} --since 24h --tail ${log_tail_lines} -f ${podname} > ${tmpfile}"
109109
kubectl logs --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} --since 24h --tail ${log_tail_lines} -f ${podname} > ${tmpfile} &
110110
local k8s_log_pid=$!
111111
echo "Waiting ${sleep_amount}s for logs to download"
112-
sleep ${sleep_amount} && less -r +F ${tmpfile} && kill ${k8s_log_pid} && echo "kubectl logs pid ${k8s_log_pid} killed"
112+
sleep ${sleep_amount} && less -rf +F ${tmpfile} && kill ${k8s_log_pid} && echo "kubectl logs pid ${k8s_log_pid} killed"
113113
}
114114

115115
kubebash() {
@@ -148,9 +148,9 @@ kubebranch() {
148148
echo "Pod \"${pod}\" not found in namespace \"${namespace}\""
149149
return
150150
fi
151-
kubectl get deployments --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} -o wide | sed -n '1!p' | awk '{print $8}' | uniq | tr "/:" "\t" | column -t | grep ${pod}
151+
kubectl get deployments --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} -o wide | sed -n '1!p' | awk '{print $1 "\t" $8}' | uniq | tr ":" "\t" | column -t | grep ${pod}
152152
else
153-
kubectl get deployments --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} -o wide | sed -n '1!p' | awk '{print $8}' | uniq | tr "/:" "\t" | column -t
153+
kubectl get deployments --kubeconfig ${KUBECONFIG:-"$HOME/.kube/config"} --namespace ${namespace} -o wide | sed -n '1!p' | awk '{print $1 "\t" $8}' | uniq | tr ":" "\t" | column -t
154154
fi
155155
}
156156

.secrets.baseline

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": null,
44
"lines": null
55
},
6-
"generated_at": "2020-05-10T20:38:58Z",
6+
"generated_at": "2020-07-07T11:44:36Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -62,7 +62,7 @@
6262
{
6363
"hashed_secret": "60b9c35a33c0f5acde612f2984b6917cb35d6d54",
6464
"is_verified": false,
65-
"line_number": 201,
65+
"line_number": 214,
6666
"type": "Secret Keyword"
6767
}
6868
]

README.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Commandline-tools (including [SDK headers](https://github.com/pyenv/pyenv/wiki#s
6666
```bash
6767
# install homebrew and command-line tools, SDK headers
6868
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
69+
xcode-select --install
6970
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
7071
# check wether all is good
7172
brew doctor
@@ -78,7 +79,8 @@ brew tap buo/cask-upgrade # `brew cu -a docker` - https://github.com/buo/homebr
7879
brew install \
7980
git git-lfs bash-completion rsync curl openssl readline automake xz zlib \
8081
sshfs htop ncdu direnv pwgen \
81-
gcc@8 rust ruby node yarn sqlite3
82+
gcc@8 rust ruby node@12 sqlite3
83+
npm install -g yarn
8284
```
8385

8486

@@ -88,7 +90,9 @@ brew install \
8890
brew cask install iterm2
8991
brew tap homebrew/cask-fonts
9092
brew cask install font-inconsolatalgc-nerd-font
91-
cargo install exa ripgrep # ls, rg
93+
cargo install ripgrep # rg (search for regex occurrences in directory)
94+
cargo install zoxide # z (cd with auto-complete)
95+
cargo install --git https://github.com/ogham/exa.git
9296
# use exa with icons and git status instead of builtin ls
9397
alias ls="exa --all --group-directories-first --icons --level=2" # default level for --tree
9498
alias ll="ls --long --sort=age --git --time=modified --time-style=iso"
@@ -101,6 +105,8 @@ alias ll="ls --long --sort=age --git --time=modified --time-style=iso"
101105
# Docker CE - docker.com/community-edition
102106
brew cask install docker
103107
brew install docker-compose
108+
# PostgresApp - postgresapp.com
109+
brew cask install postgres
104110
# Sublime Text - sublimetext.com
105111
brew cask install sublime-text
106112
# Sublime Merge - sublimemerge.com
@@ -172,15 +178,19 @@ mas install 595191960
172178
git clone https://github.com/momo-lab/pyenv-install-latest.git "$(pyenv root)"/plugins/pyenv-install-latest
173179
git clone git://github.com/concordusapps/pyenv-implict.git "$(pyenv root)"/plugins/pyenv-implict
174180
# list all available python versions
175-
pyenv install -l
181+
pyenv install -l | grep '^\s*[0-9]'
176182
pyenv install-latest 2.7
177183
pyenv install-latest 3.7
184+
sudo SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/ pyenv install-latest 3.8 # might need to unsource .bash_profile first
178185
pyenv global $(pyenv install-latest --print 3.7) $(pyenv install-latest --print 2.7) # set default versions: prefer py3 over py2
179186
source ~/.bash_profile # global history etc
180-
pip install --upgrade pip setuptools wheel Cython
187+
pip3.7 install --upgrade pip setuptools wheel Cython
188+
pip2.7 install --upgrade pip setuptools wheel Cython
189+
pip3.8 install --upgrade pip setuptools wheel Cython
181190
# install virtualenv 'vv' based latest pyenv Python version 3.7, inheriting installed packages
182191
pyenv virtualenv $(pyenv install-latest --print 3.7) --system-site-packages vv
183192
pyenv virtualenv $(pyenv install-latest --print 2.7) --system-site-packages vv27
193+
pyenv virtualenv $(pyenv install-latest --print 3.8) --system-site-packages vv38
184194
```
185195
- Manage envs
186196
```bash
@@ -220,7 +230,7 @@ Note: first open Chrome for the first time
220230
- iStat Menus preferences: `File/Import Settings...`, select `iStat Menus Settings.ismp`
221231
- Quickly download audio & video with [`yt`](https://github.com/ddelange/yt)
222232
```bash
223-
git clone https://github.com/ddelange/yt.git ~/git/yt && brew install youtube-dl
233+
brew install ddelange/brewformulae/yt
224234
```
225235

226236

@@ -277,6 +287,16 @@ git config --global icdiff.options "--highlight --line-numbers --numlines=3"
277287
git config --global difftool.icdiff.cmd 'icdiff --highlight --line-numbers --numlines=3 $LOCAL $REMOTE'
278288
```
279289

290+
##### Mergetool
291+
292+
On failed automatic merge, use Sublime Merge GUI for conflict resolution using `git mergetool` or `git mt` (see below).
293+
```bash
294+
git config --global mergetool.smerge.cmd 'smerge mergetool "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"'
295+
git config --global mergetool.smerge.trustExitCode true
296+
git config --global mergetool.keepBackup false
297+
git config --global merge.tool smerge
298+
```
299+
280300

281301
##### Aliases
282302

@@ -289,13 +309,16 @@ git config --global alias.camend "commit --amend -am"
289309
git config --global alias.amend "commit --amend --no-edit -a"
290310
git config --global alias.br "branch"
291311
git config --global alias.co "checkout"
312+
git config --global alias.mt "mergetool"
292313
git config --global alias.lg "log --graph --decorate --pretty=oneline --abbrev-commit"
293314
git config --global alias.fp "fetch -p --all" # purge and fetch all remotes
315+
git config --global alias.defaultbranch '! f() { echo $(git remote show origin | grep "HEAD branch" | cut -d ":" -f 2 | xargs); }; f' # https://stackoverflow.com/questions/28666357#comment101797372_50056710
294316
git config --global alias.df '! f() { git icdiff --color=always "$@" | less -eR; }; f' # no FX (keep output in terminal)
295317
git config --global alias.pr '! git push --set-upstream origin "$(git rev-parse --abbrev-ref HEAD)"'
296318
git config --global alias.dm '! git fetch -p && for branch in `git branch -vv | grep '"': gone] ' | awk '"'{print $1}'"'"'`; do git branch -D $branch; done' # 'delete merged' - local branches that have been deleted on remote
297-
git config --global alias.gg '! f() { git checkout "${1:-master}" && git dm && git pull; }; f'
319+
git config --global alias.gg '! f() { git checkout "${1:-$(git defaultbranch)}" && git dm && git pull; }; f' # git gg develop -- no arg: defaultbranch. Return to default branch (or specified branch), delete merged, pull branch
298320
git config --global alias.pall '! f() { START=$(git branch | grep "\*" | sed "s/^.//"); for i in $(git branch | sed "s/^.//"); do git checkout $i; git pull || break; done; git checkout $START; }; f' # 'pull all' - pull local branches that have been updated on remote
321+
git config --global alias.undo '! f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f' # https://megakemp.com/2016/08/25/git-undo/
299322
```
300323

301324

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[
22
{ "keys": ["shift+ctrl+a"], "command": "alignment" }
3-
]
3+
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[
2-
]
2+
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[
2-
]
2+
]

sublime_text_user_settings/LaTeXTools.sublime-settings

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// Cite/ref autocompletion by default is triggered after e.g. \ref{. If you don't like this,
1313
// set to false. You can also use toggles: C-l,t,a,c and C-l,t,a,r.
1414
"cite_auto_trigger": true,
15-
"ref_auto_trigger": true,
15+
"ref_auto_trigger": true,
1616

1717
// Fill-helper autocompletion triggered for a wide range of references to external
1818
// files. You can also use toggle: C-l,t,a,f
@@ -21,7 +21,7 @@
2121

2222
// Keep focus on Sublime Text after building (true) or switch to PDF viewer (false)
2323
"keep_focus": true,
24-
// Sync PDF to current editor position after building (true) or not
24+
// Sync PDF to current editor position after building (true) or not
2525
"forward_sync": true,
2626

2727

@@ -55,7 +55,7 @@
5555
// and "python" by default is liked to Python 3. If blank, "python" is used
5656
// Note: ST3 uses Python 3 internally, but the evince scripts need Python 2
5757
"python2": "",
58-
// The name of the ST2 or ST3 executable. On Ubuntu, both subl and sublime-text are
58+
// The name of the ST2 or ST3 executable. On Ubuntu, both subl and sublime-text are
5959
// available for ST2; adjust as needed for other platforms, and for ST3
6060
"sublime": "sublime-text",
6161
// How long to wait after evince has launched before sending a sync message
@@ -69,7 +69,7 @@
6969
// ------------------------------------------------------------------
7070
// Build engine settings
7171
// ------------------------------------------------------------------
72-
72+
7373
// OPTION: "builder"
7474
// Specifies a build engine
7575
// Possible values:
@@ -100,9 +100,9 @@
100100
// If non-empty, specifies a path to a custom builder, relative to the
101101
// Sublime Text Packages directory.
102102
// For instance, "User/builders" (on Windows: "User\builders") is a good
103-
// choice if you roll your own.
103+
// choice if you roll your own.
104104
// (Note: if you choose "User", you may get a Python import error in the
105-
// console, but things will still work).
105+
// console, but things will still work).
106106
// Leave empty ("") for a built-in builder.
107107

108108
"builder_path": "",
@@ -114,12 +114,12 @@
114114
// Builder setting can be general or OS-dependent
115115

116116
"builder_settings" : {
117-
117+
118118
// General settings:
119119
// See README or third-party documentation
120120

121121
// (built-ins): true shows the log of each command in the output panel
122-
"display_log" : false,
122+
"display_log" : false,
123123

124124
// Platform-specific settings:
125125
"osx" : {
@@ -141,9 +141,9 @@
141141
// ------------------------------------------------------------------
142142

143143
/* This preference sets the format of the quick panel to select citations using wildcards.
144-
The setting is a list with one or two string using wildcards for author, title, keyword etc.
145-
146-
Default setting: the traditional display, `["{title} ({keyword})","{author}"]`
144+
The setting is a list with one or two string using wildcards for author, title, keyword etc.
145+
146+
Default setting: the traditional display, `["{title} ({keyword})","{author}"]`
147147
Format:
148148
Can quantum-mechanical description of physical reality be considered complete? This is an non-existing subtitle to illustrate (einstein1935quantum)
149149
Albert Einstein and B Podolsky and N Rosen
@@ -173,4 +173,4 @@
173173
// Similarly, the formatting for the autocomplete panel:
174174
"cite_autocomplete_format": "{keyword}: {title}"
175175

176-
}
176+
}

sublime_text_user_settings/LaTeXing.sublime-settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
}
1212
],
1313
"output_directory": false
14-
}
14+
}

sublime_text_user_settings/Package Control.sublime-settings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
"installed_packages":
77
[
88
"All Autocomplete",
9+
"ayu",
910
"Babel",
1011
"BracketHighlighter",
1112
"Diffy",
1213
"Dockerfile Syntax Highlighting",
1314
"FindKeyConflicts",
15+
"Github Color Theme",
1416
"GitLink",
1517
"Jedi - Python autocompletion",
1618
"JsPrettier",

sublime_text_user_settings/Preferences.sublime-settings

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
"index_exclude_patterns": ["*.log", "htmlcov/", "node_modules/", ".mypy_cache/"],
3-
"folder_exclude_patterns": ["htmlcov", "node_modules", ".mypy_cache"],
42
"added_words":
53
[
64
"accretes",
@@ -52,11 +50,17 @@
5250
],
5351
"auto_indent": true,
5452
"caret_style": "phase",
55-
"color_scheme": "Packages/Neon Color Scheme/Neon.tmTheme",
53+
"color_scheme": "Packages/Github Color Theme/GitHub.tmTheme",
5654
"dictionary": "Packages/Language - English/en_GB.dic",
5755
"draw_indent_guides": true,
5856
"ensure_newline_at_eof_on_save": true,
5957
"fade_fold_buttons": false,
58+
"folder_exclude_patterns":
59+
[
60+
"htmlcov",
61+
"node_modules",
62+
".mypy_cache"
63+
],
6064
"font_options": "subpixel_antialias",
6165
"font_size": 10.0,
6266
"gitlink_revision_type": "commithash",
@@ -72,6 +76,13 @@
7276
],
7377
"indent_to_bracket": false,
7478
"indent_using_spaces": true,
79+
"index_exclude_patterns":
80+
[
81+
"*.log",
82+
"htmlcov/",
83+
"node_modules/",
84+
".mypy_cache/"
85+
],
7586
"keymaps":
7687
{
7788
"show_pretty_keys": true

0 commit comments

Comments
 (0)