Skip to content

Commit

Permalink
🐛 Fix i alias and git aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelange committed Sep 11, 2023
1 parent debf4c6 commit 977d235
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
7 changes: 4 additions & 3 deletions .bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ import os, logging, numpy as np, pandas as pd
from pathlib import Path
here = Path(\".\").resolve()
from rich import pretty
from rich import pretty, print
pretty.install()
# set to WARNING by default
Expand Down Expand Up @@ -133,12 +133,13 @@ PS1="⨊ 𝕯𝓭𝓵:\[\033[36m\]\w\[\033[m\]$ " # ⚛ ⨊ 𝓓𝔇𝒟ℓℒ
# functions

# https://stackoverflow.com/a/73108928/5511061
dockersize() { docker manifest inspect -v "$1" | jq -c 'if type == "array" then .[] else . end' | jq -r '[ ( .Descriptor.platform | [ .os, .architecture, .variant, ."os.version" ] | del(..|nulls) | join("/") ), ( [ .SchemaV2Manifest.layers[].size ] | add ) ] | join(" ")' | numfmt --to iec --format '%.2f' --field 2 | column -t ; }
dockersize() { docker manifest inspect -v "$1" | jq -c 'if type == "array" then .[] else . end' | jq -r '[ ( .Descriptor.platform | [ .os, .architecture, .variant, ."os.version" ] | del(..|nulls) | join("/") ), ( [ .SchemaV2Manifest.layers[].size ] | add ) ] | join(" ")' | numfmt --to iec --format '%.2f' --field 2 | sort | column -t ; }
export -f dockersize
clusterimages() { kubectl get po -A -o json | jq -cr '.items[].spec.containers[].image' | grep -o '^[^@]\+' | sort -u | xargs -I _ bash -c 'echo - _ && dockersize _' ; }
export -f clusterimages

alias kubetop="watch -n4 python ~/git/kubetop.py"
export HIDESYS=1
alias kubetop="python ~/git/kubetop.py"
# https://gist.github.com/ddelange/24575a702a10c2cb6348c4c7f342e0eb
kubelogs() {
# View logs as they come in (like in Rancher) using mktemp and less -r +F.
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ https://github.com/naokazuterada/MarkdownTOC#usage -->
```
# boot old Mac while holding `T` to go in Target Disk Mode
# password prompt should pop up
rsync -au --progress=info2 <drag src folder> ~/backup
rsync -au --progress <drag src folder> ~/backup
```
- Don't forget to take with your whole `.gnupg` folder, `.gitconfig`, `.envrc` etc!
- Chrome settings/bookmarks are not backed up and are assumed to come from its builtin Sync.
Expand Down Expand Up @@ -210,6 +210,8 @@ brew install --cask authy
brew install --cask jitsi-meet
# Maccy - maccy.app
brew install --cask maccy
# pdflatex - tug.org/mactex/
brew install --cask mactex-no-gui
```


Expand Down Expand Up @@ -285,14 +287,14 @@ Note: first open Chrome for the first time
# get your favourite python versions - github.com/momo-lab/pyenv-install-latest
git clone https://github.com/momo-lab/pyenv-install-latest.git "$(pyenv root)"/plugins/pyenv-install-latest
git clone git://github.com/concordusapps/pyenv-implict.git "$(pyenv root)"/plugins/pyenv-implict
# list all available python versions
pyenv install -l | grep '^\s*[0-9]'
pyenv install -l | grep '^\s*[0-9]' # list all available python versions
pyenv install-latest 2
pyenv install-latest 3
pyenv versions # see currently installed versions
pyenv global $(pyenv install-latest --print 3.8) $(pyenv install-latest --print 2) # set default versions: prefer py3 over py2
# install virtualenv 'vv' based latest pyenv Python version 3.7, inheriting installed packages
pyenv virtualenv $(pyenv install-latest --print 3.8) --system-site-packages vv
pyenv global $(pyenv install-latest --print 3) $(pyenv install-latest --print 2) # set default versions: prefer py3 over py2
# install virtualenv 'vv' based latest pyenv Python version 3.x, inheriting installed packages
pyenv virtualenv $(pyenv install-latest --print 3) --system-site-packages vv
# same for 'vv27' with python 2.7.x
pyenv virtualenv $(pyenv install-latest --print 2) --system-site-packages vv27
```
- Manage envs
Expand Down Expand Up @@ -404,9 +406,9 @@ git checkout $START; \
###### Rewriting history
```bash
# "commit all amend" last commit, adding all modified tracked files to the it without editing the commit message
git config --global alias.amend "commit --amend --no-edit -a"
git config --global alias.amend "commit --amend --reset-author --no-edit -a"
# "commit all amend with message" - add all modified tracked files to the last commit with a new commit message
git config --global alias.camend "commit --amend -am"
git config --global alias.camend "commit --amend --reset-author -am"
# "squash last" X commits - allowing to edit a pre-generated commit message before committing - known caveat: when trying to squash into an initial commit, the reset fails
git config --global alias.squashlast '!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f'
# "undo" whatever you did last, for instance an erroneous squashlast - ref https://megakemp.com/2016/08/25/git-undo/
Expand Down
2 changes: 1 addition & 1 deletion com.googlecode.iterm2.plist
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ Maximize Active Pane</string>
<key>Non-ASCII Anti Aliased</key>
<true/>
<key>Normal Font</key>
<string>InconsolataLGCNerdFontComplete- 9</string>
<string>InconsolataLGCNerdFontComplete-Regular 9</string>
<key>Option Key Sends</key>
<integer>0</integer>
<key>Prompt Before Closing 2</key>
Expand Down
2 changes: 1 addition & 1 deletion htoprc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ find_comm_in_cmdline=1
strip_exe_from_cmdline=1
show_merged_command=0
tree_view=0
tree_view_always_by_pid=0
tree_view_always_by_pid=1
all_branches_collapsed=1
header_margin=1
detailed_cpu_time=0
Expand Down

0 comments on commit 977d235

Please sign in to comment.