Skip to content
This repository has been archived by the owner on Jun 1, 2020. It is now read-only.

Latest commit

 

History

History
271 lines (192 loc) · 5.85 KB

profile.org

File metadata and controls

271 lines (192 loc) · 5.85 KB

Dot profile

Estructura de archivos

Intentando la estructura de archivos XDG

Ver la especificación aquí

VariableLocation
-------------------------------------
XDG_BIN_HOME~/.local/bin
XDG_CACHE_HOME~/.cache
XDG_CONFIG_HOME~/.config
XDG_DATA_HOME~/.local/share
XDG_LIB_HOME~/.local/lib
mkdir -p ~/.local/bin ~/local/lib
export XDG_BIN_HOME=~/.local/bin
export XDG_CACHE_HOME=~/.cache
export XDG_CONFIG_HOME=~/.config
export XDG_DATA_HOME=~/.local/share
export XDG_LIB_HOME=~/.local/lib

NOTA: XDG_BIN_HOME y XDG_LIB_HOME no son estándar.

Paths

Queremos estos directorios, pero sólo si existen

OLDPATH=$PATH
PATH=$HOME/bin

for DIR in $HOME/bin /opt/local/bin /opt/local/sbin /usr/local/bin /usr/local/sbin /usr/bin /usr/sbin
do
    if [ -d $DIR ]
    then
        PATH=$PATH:$DIR
    fi
done

PATH=$OLDPATH:$PATH

Environment

HISTSIZE=10000
SAVEHIST=$HISTSIZE

Scrolling horizontal

export PAGER=less
export LESS="-iMRSx4 -FX"

GNU/Emacs

export ALTERNATE_EDITOR=emacs
export EDITOR="emacsclient -c"
export VISUAL="emacsclient -c"

A veces, si abres Emacs en la terminal, se ve horrible :(, esto lo arregla:

export TERM=xterm-256color

i3wm

i3wm-sensible-terminal abre el emulador de terminal definido en esta variable

apt install sakura
export TERMINAL="sakura"

Pyenv

Instalar pyenv

curl https://pyenv.run | bash

Inicializar pyenv:

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Python requiere algunos paquetes para poder ser instalado desde el código fuente (tomado de aquí):

apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git

Y luego instalamos algunas versiones de python

pyenv install 3.6.8 && \
pyenv global 3.6.8

Para crear un ambiente virtual:

pyenv virtualenv $NAME

Para activarlo/desactivarlo manualmente

pyenv activate $NAME
pyenv deactivate $NAME

o para activarlo de manera automática en un directorio:

echo $NAME > .python-version

Poetry

poetry debe de instalarse de manera global de la siguiente manera

pyenv shell system
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
python shell --unset
source ~/.poetry/env

Fzf

Consulta https://github.com/junegunn/fzf#fuzzy-completion-for-bash-and-zsh

export FZF_DEFAULT_COMMAND="fd --type file --follow --hidden --exclude .git --color=always"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
# add support for ctrl+o to open selected file in VS Code
export FZF_DEFAULT_OPTS="--bind='ctrl-o:execute(code {})+abort' --ansi --layout=reverse --inline-info"
# Options to fzf command
export FZF_COMPLETION_OPTS='+c -x'

# Use fd (https://github.com/sharkdp/fd) instead of the default find
# command for listing path candidates.
# - The first argument to the function ($1) is the base path to start traversal
# - See the source code (completion.{bash,zsh}) for the details.
_fzf_compgen_path() {
  fd --hidden --follow --exclude ".git" . "$1"
}

# Use fd to generate the list for directory completion
_fzf_compgen_dir() {
  fd --type d --hidden --follow --exclude ".git" . "$1"
}
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

Aliases

alias p="cd ~/projects"
alias s="cd ~/software"
alias d="cd ~/dotfiles"

docker

alias dps="docker ps"

Emacs

alias e="emacsclient -c"
alias ec="emacsclient -c"
alias et="emacsclient -nw"

SBCL

alias sbcl="rlwrap sbcl"

SSH Tunneling

CMU bastión

alias cmu-up='ssh -fNTM cmu-tunnel'
alias cmu-status='ssh -TO check cmu-tunnel'
alias cmu-down='ssh -TO exit cmu-tunnel'

ITAM bastión

alias itam-up='ssh -fNTM itam-tunnel'
alias itam-status='ssh -TO check itam-tunnel'
alias itam-down='ssh -TO exit itam-tunnel'

CCD bastión

alias ccd-up='ssh -fNTM ccd-tunnel'
alias ccd-status='ssh -TO check ccd-tunnel'
alias ccd-down='ssh -TO exit ccd-tunnel'

CLI

alias cat="batcat"
alias top="sudo htop"
alias preview="fzf --preview 'bat --color \"always\" {}'"
alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules"