Skip to content

Commit

Permalink
Feature/general updates (#29)
Browse files Browse the repository at this point in the history
* fix: Avoid to continue using the Dropbox folder

* chore: zimfw module cleanup

* feat: From molokai to tempus

* fix: Duplicated entry for direnv

* feat: Adds ibm::cloud::target

* chore: Deactivates the default support for github.com

* chore: Review of the list of alias for Terraform commands

* fix: Changes the OpenQ SSH jumphost

---------

Co-authored-by: JJ <[email protected]>
  • Loading branch information
jjuarez and JJ authored Nov 15, 2024
1 parent 27974d4 commit 8e3c1e4
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 47 deletions.
2 changes: 1 addition & 1 deletion roles/dotfiles/files/shell/scripts/backup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

declare -r WORKSPACE="${HOME}/Workspace"
declare -r DESTINATION_DIRECTORY="${HOME}/Dropbox/Backups/IBM"
declare -r DESTINATION_DIRECTORY="${HOME}/Desktop/Backup/Backups/IBM"
declare BACKUP_DRYRUN

TAR="$(brew --prefix)/bin/gtar"
Expand Down
14 changes: 12 additions & 2 deletions roles/dotfiles/files/shell/zsh.d/ibm.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ibm::cloud::switch_account() {
[[ -x "${IBMCLOUD_CLI}" ]] || utils::panic "There's no ${IBMCLOUD_CLI} installed" 4

case "${account_name}" in
qcm|qcmaster|master|qss|qsstaging|staging|qsp|qsproduction|production|qce|qcexperimental|experimental)
qcmaster|qsstaging|qsproduction|qcexperimental)
if [[ -n "${IBMCLOUD_ACCOUNT_IDS[${account_name}]}" ]]; then
"${IBMCLOUD_CLI}" target -c "${IBMCLOUD_ACCOUNT_IDS[${account_name}]}" --unset-resource-group --unset-region --quiet >/dev/null 2>&1 # By default go to the QCMaster account
[[ -n "${IBMCLOUD_SMES[${account_name}]}" ]] && export SECRETS_MANAGER_URL="${IBMCLOUD_SMES[${account_name}]}"
Expand All @@ -57,6 +57,15 @@ ibm::cloud::switch_account() {
esac
}

ibm::cloud::target() {
local cai

cai=$(jq -r '.Account.GUID' "${HOME}/.bluemix/config.json")
if [[ -n "${cai}" ]]; then
echo "${(k)IBMCLOUD_ACCOUNT_IDS[(r)${cai}]}"
fi
}

ibm::cloud::login() {
[[ -x "${IBMCLOUD_CLI}" ]] || utils::panic "There's no ${IBMCLOUD_CLI} installed" 4

Expand Down Expand Up @@ -132,6 +141,7 @@ ibm::k8s::list() {

# autoloads
autoload ibm:cloud::login
autoload ibm:cloud::target
autoload ibm:cloud::switch_account
autoload ibm::k8s::update
autoload ibm::k8s::list
Expand All @@ -141,5 +151,5 @@ autoload ibm::k8s::list
alias ic='ibmcloud'
alias ic.li='ibm::cloud::login'
alias ic.lo='ibmcloud logout'
alias ic.t='ibmcloud target'
alias ic.t='ibm::cloud::target'
alias ic.sa='ibm::cloud::switch_account'
7 changes: 4 additions & 3 deletions roles/dotfiles/files/shell/zsh.d/terraform.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ autoload terraform::apply

# aliases
alias tf='terraform'
alias tfi='terraform::state::init'
alias tfa='terraform::apply'
alias tfc='terraform::state::cleanup'
alias tff='terraform fmt'
alias tfi='terraform::state::init'
alias tfp='terraform::plan'
alias tfu='terraform::state::upgrade'
alias tfv='terraform validate'
alias tfp='terraform::plan'
alias tfa='terraform::apply'
2 changes: 1 addition & 1 deletion roles/dotfiles/files/shell/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ declare -A FEATURES_CONFIGURATION=(
[direnv]=true
[fzf]=true
[ghe]=true
[github]=true
[github]=false
[go]=true
[ibmcloud]=true
[krew]=true
Expand Down
54 changes: 29 additions & 25 deletions roles/dotfiles/files/ssh/config
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
##
## Development
##
#
# Development
#
Host github.com gitlab.com
User jjuarez

##
## Colima
##
#
# Colima
#
Include /Users/jjuarez/.colima/ssh_config

##
## IBM private network jump hosts
##
Host elmira.watson.ibm.com
User javier.juarez.martin

Host champlaincanal-nat.watson.ibm.com
User javier.juarez.martin

Host neversink-nat.watson.ibm.com
User javier.juarez.martin

Host corinthcanal.cloud9.ibm.com
User javier.juarez.martin
#
# IBM private network jump hosts
#

# JumpHosts (2024/10/31)
# QNet:
# - stockholm-nat.watson.ibm.com SSH pwd + OTP
# - elmira.watson.ibm.com SSH key + OTP
# - saimaa.cloud9.ibm.com SSH pwd + OTP
# - corinthcanal.cloud9.ibm.com SSH key + OTP
#
# OpenQ:
# - fishkill-nat.watson.ibm.com SSH Pwd + OTP
# - kisco-nat.watson.ibm.com SSH Pwd + OTP
# - champlaincanal-nat.watson.ibm.com SSH key + OTP
# - neversink-nat.watson.ibm.com SSH key + OTP
#

# QNet
Host qnet.jumphost
Expand All @@ -34,7 +37,8 @@ Host qnet.jumphost

# OpenQ
Host openq.jumphost
HostName champlaincanal-nat.watson.ibm.com
# HostName champlaincanal-nat.watson.ibm.com
HostName fishkill-nat.watson.ibm.com
User javier.juarez.martin # The AD username
ControlMaster auto
ControlPath /tmp/ssh_mux_openq.sock
Expand Down Expand Up @@ -79,8 +83,8 @@ Host *.openq.local
ProxyJump openq.jumphost

Host *.sk.local *.uot.local
ProxyJump sk.jumphost
User javier-juarez-martinez
ProxyJump sk.jumphost

Host *.ccf.local
User javier-juarez-martinez
Expand Down Expand Up @@ -110,9 +114,9 @@ Host ykt39-0?.watson.ibm.com
Host gw.infra.quantum.ibm.com:
User root

##
## Global options
##
#
# Global options
#
Host *
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
Expand Down
11 changes: 8 additions & 3 deletions roles/dotfiles/files/tools/.gitignore_global
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@
.DS_Store
**.swp
.envrc

# IDEs
.vscode
.idea

# Python
*.py[cod]
.venv
venv
.python-version

# ruby
.ruby-version
.ruby-gemset
.rubocop.yaml
.ropeproject/**
.gems
# nodeJS

# Node.js
.node-version
.pre-commit-config.yaml
# Direnv
.envrc

# Terraform
#*.tfplan
20 changes: 11 additions & 9 deletions roles/dotfiles/files/vim/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ filetype plugin on
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
Plug 'tomtom/tcomment_vim'
Plug 'ervandew/supertab'
Plug 'tomasr/molokai'
Plug 'protesilaos/tempus-themes-vim'
Plug 'ryanoasis/vim-devicons'
Plug 'itchyny/lightline.vim'
Plug 'szw/vim-maximizer'
Plug 'w0rp/ale'
" Plug 'klen/python-mode'
Plug 'klen/python-mode'
Plug 'hashivim/vim-terraform'
Plug 'fatih/vim-go'
Plug 'chase/vim-ansible-yaml'
Expand Down Expand Up @@ -38,13 +38,10 @@ let g:is_posix = 1

"" The Color Scheme
try
colorscheme molokai
let g:rehash256=1
let g:colorscheme_bg='dark'
let &t_ZH="\e[3m"
let &t_ZR="\e[23m"
colorscheme tempus_dusk
let g:tempus_enforce_background_color=1
catch
colorscheme default
colorscheme default
endtry

execute "set colorcolumn=" . join(range(133,335), ',')
Expand Down Expand Up @@ -139,10 +136,14 @@ map <Leader>/ :nohlsearch<CR>
if !has('nvim')
set viminfo+=n~/.vim/.viminfo
else
set viminfo+=n~/.local/shared/nvim/.shada
set viminfo+=n~/.local/share/nvim/.shada
endif
let g:session_autosave='no'

"" Python support
let g:pymode = 'enable'
let g:python3_host_prog = expand('./.venv/bin/python3')

"" lightline configuration
set laststatus=2
set noshowmode
Expand All @@ -156,6 +157,7 @@ let g:ale_linters = { "python": ["ruff"] }
let g:ale_fixers = { "python": ["ruff"] }

"" Maximize current split or return to previous
let g:maximizer_set_default_mapping = 0
noremap <C-w>m :MaximizerToggle<CR>
"" Allow overriding these settings
Expand Down
3 changes: 0 additions & 3 deletions roles/dotfiles/files/zimfw/.zimrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ zmodule input
zmodule environment
zmodule ssh
zmodule exa
# zmodule agkozak/zsh-z
zmodule completion
# zmodule fzf
# zmodule zsh-users/zsh-completions
zmodule zsh-users/zsh-autosuggestions
zmodule zsh-users/zsh-syntax-highlighting
# Themes
Expand Down

0 comments on commit 8e3c1e4

Please sign in to comment.