feat: use aconfmgr, brew and stow
This commit is contained in:
parent
4725d3fec2
commit
1098c4f174
36 changed files with 3145 additions and 69 deletions
22
.gitignore
vendored
22
.gitignore
vendored
|
@ -1,20 +1,2 @@
|
|||
.pyc
|
||||
*cache*
|
||||
roles/*/molecule/default/.molecule
|
||||
roles/docker
|
||||
roles/emacs
|
||||
roles/emacs-dotfiles
|
||||
roles/fonts
|
||||
roles/i3blocks-gaps
|
||||
roles/i3-gaps
|
||||
roles/qutebrowser
|
||||
roles/slim
|
||||
roles/syncthing
|
||||
roles/syncthing-inotify
|
||||
roles/termite
|
||||
roles/virtualbox
|
||||
roles/virtualenvwrapper
|
||||
roles/vte-ng
|
||||
install-all.retry
|
||||
molecule/default/.molecule/
|
||||
roles/qutebrowser-dotfiles/files/hosts
|
||||
dotfiles/git/.compartido/Proyectos/*/.gitconfig
|
||||
dotfiles/git/.compartido/Trabajo/.gitconfig
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
extends: relaxed
|
||||
truthy: disable
|
||||
rules: {line-length: {max: 130}}
|
||||
|
59
README.md
59
README.md
|
@ -1,51 +1,20 @@
|
|||
# Proveedor de entorno
|
||||
# Dotfiles
|
||||
|
||||
Este playbook instala lo siguiente:
|
||||
## TL;DR
|
||||
|
||||
- Docker
|
||||
Script automatizado:
|
||||
|
||||
- Emacs
|
||||
``` sh
|
||||
# Hacer dump de los paquetes actuales
|
||||
bash manage.sh packages-bundle
|
||||
# Actualizar el SO
|
||||
bash manage.sh packages-update
|
||||
# Sincronizar los dotfiles
|
||||
bash manage.sh dotfiles
|
||||
```
|
||||
|
||||
- Fuentes
|
||||
## Resumen
|
||||
|
||||
- Paquetes de Debian que uso
|
||||
Mediante aconfmgr, se hace un dump de los paquetes instalados de arch (tanto pacman como yay) para poder gestionar los paquetes de forma declarativa
|
||||
|
||||
- i3blocks-gaps
|
||||
|
||||
- i3-gaps
|
||||
|
||||
- Paquetes de Pip que uso
|
||||
|
||||
- Qutebrowser
|
||||
|
||||
- SLim
|
||||
|
||||
- Syncthing
|
||||
|
||||
- Termite
|
||||
|
||||
- Virtualbox
|
||||
|
||||
- Virtualenvwrapper
|
||||
|
||||
Además, también instala mis ficheros de configuración de emacs, i3-wm, qutebrowser y zsh. Básicamente instala todo lo que necesito en un ordenador.
|
||||
|
||||
Para poder usarlo, antes hay que instalar algunas dependencias:
|
||||
|
||||
sudo apt install sudo python-pip git
|
||||
sudo pip install ansible
|
||||
|
||||
Luego copiamos el repositorio:
|
||||
|
||||
git clone https://git.daemons.it/drymer/dotfiles
|
||||
|
||||
Instalamos los roles que tiene como dependencias:
|
||||
|
||||
cd dotfiles
|
||||
ansible-galaxy install -r requirements.yml -p roles
|
||||
|
||||
Y solo queda ejecutar el playbook:
|
||||
|
||||
ansible-playbook install-all.yml -K
|
||||
|
||||
Se pueden usar los tags `configuration` o `packages` para instalar solo configuración o paquetes, respectivamente.
|
||||
Además, se gestionan los dotfiles con stow.
|
||||
|
|
37
dotfiles/alacritty/.alacritty.yml
Normal file
37
dotfiles/alacritty/.alacritty.yml
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
font:
|
||||
normal:
|
||||
family: DejaVu Sans Mono for Powerline
|
||||
style: Regular
|
||||
size: 12
|
||||
|
||||
key_bindings:
|
||||
- { key: Return, mods: Control|Shift, action: SpawnNewInstance }
|
||||
|
||||
# Colors (Molokai Dark)
|
||||
colors:
|
||||
# Default colors
|
||||
primary:
|
||||
background: '#1B1D1E'
|
||||
foreground: '#F8F8F2'
|
||||
bright:
|
||||
black: '#666666'
|
||||
red: '#F92672'
|
||||
green: '#A6E22E'
|
||||
yellow: '#E2E22E'
|
||||
blue: '#819AFF'
|
||||
magenta: '#AE81FF'
|
||||
cyan: '#66D9EF'
|
||||
white: '#F8F8F2'
|
||||
|
||||
scrolling:
|
||||
history: 10000
|
||||
|
||||
cursor:
|
||||
style:
|
||||
blinking: Always
|
||||
blink_interval: 100
|
||||
shape: Underline
|
||||
unfocused_hollow: false
|
||||
|
||||
background_opacity: 0.9
|
36
dotfiles/git/.gitconfig
Normal file
36
dotfiles/git/.gitconfig
Normal file
|
@ -0,0 +1,36 @@
|
|||
[core]
|
||||
pager = diff-so-fancy | less --tabs=4 -RFX
|
||||
[color]
|
||||
ui = auto
|
||||
[color "diff-highlight"]
|
||||
oldNormal = red bold
|
||||
oldHighlight = red bold 52
|
||||
newNormal = green bold
|
||||
newHighlight = green bold 22
|
||||
[color "diff"]
|
||||
meta = yellow
|
||||
frag = magenta bold
|
||||
commit = yellow bold
|
||||
old = red bold
|
||||
new = green bold
|
||||
whitespace = red reverse
|
||||
[diff-so-fancy]
|
||||
markEmptyLines = false
|
||||
changeHunkIndicators = false
|
||||
stripLeadingSymbols = false
|
||||
useUnicodeRuler = true
|
||||
[rerere]
|
||||
enabled = true
|
||||
[pull]
|
||||
rebase = false
|
||||
|
||||
# Esto permite tener un usuario y correo diferente para el trabajo,
|
||||
# proyectos con mi nombre real y proyectos bajo mi alias
|
||||
[includeIf "gitdir:~/Trabajo/"]
|
||||
path = ~/Trabajo/.gitconfig
|
||||
[includeIf "gitdir:~/.compartido/Trabajo/"]
|
||||
path = ~/Trabajo/.gitconfig
|
||||
[includeIf "gitdir:~/.Proyectos/real/"]
|
||||
path = ~/Proyectos/real/.gitconfig
|
||||
[includeIf "gitdir:~/.Proyectos/alias/"]
|
||||
path = ~/Personal/alias/.gitconfig
|
3
dotfiles/i3/.compton.conf
Normal file
3
dotfiles/i3/.compton.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
opacity-rule = [
|
||||
"0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
|
||||
];
|
49
dotfiles/i3/.config/dunst/dunstrc
Normal file
49
dotfiles/i3/.config/dunst/dunstrc
Normal file
|
@ -0,0 +1,49 @@
|
|||
[global]
|
||||
font = Hack 10
|
||||
markup = yes
|
||||
format = "<b>%s</b>\n%b"
|
||||
sort = yes
|
||||
indicate_hidden = yes
|
||||
alignment = left
|
||||
bounce_freq = 0
|
||||
show_age_threshold = 60
|
||||
word_wrap = yes
|
||||
ignore_newline = no
|
||||
geometry = "300x5-30+20"
|
||||
shrink = no
|
||||
transparency = 0
|
||||
idle_threshold = 120
|
||||
monitor = 0
|
||||
follow = mouse
|
||||
sticky_history = yes
|
||||
history_length = 20
|
||||
show_indicators = yes
|
||||
line_height = 0
|
||||
separator_height = 2
|
||||
padding = 8
|
||||
horizontal_padding = 8
|
||||
separator_color = frame
|
||||
startup_notification = false
|
||||
dmenu = /usr/bin/dmenu -p dunst:
|
||||
browser = /usr/bin/firefox -new-tab
|
||||
icon_position = off
|
||||
icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/
|
||||
frame_width = 4
|
||||
frame_color = "#98C379"
|
||||
[shortcuts]
|
||||
close = ctrl+space
|
||||
close_all = ctrl+shift+space
|
||||
history = ctrl+period
|
||||
context = ctrl+shift+period
|
||||
[urgency_low]
|
||||
background = "#282c34"
|
||||
foreground = "#bbc2cf"
|
||||
timeout = 10
|
||||
[urgency_normal]
|
||||
background = "#282c34"
|
||||
foreground = "#bbc2cf"
|
||||
timeout = 20
|
||||
[urgency_critical]
|
||||
background = "#2B0000"
|
||||
foreground = "#bbc2cf"
|
||||
timeout = 0
|
13
dotfiles/i3/.config/i3status.conf
Normal file
13
dotfiles/i3/.config/i3status.conf
Normal file
|
@ -0,0 +1,13 @@
|
|||
general {
|
||||
interval = 5
|
||||
output_format = none
|
||||
}
|
||||
|
||||
order += "battery all"
|
||||
|
||||
battery all {
|
||||
format = "%status %percentage %remaining"
|
||||
integer_battery_capacity = true
|
||||
last_full_capacity = true
|
||||
}
|
||||
|
2
dotfiles/i3/.config/rofi/config
Normal file
2
dotfiles/i3/.config/rofi/config
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
rofi.theme: /usr/share/rofi/themes/Monokai.rasi
|
247
dotfiles/i3/.i3/config
Normal file
247
dotfiles/i3/.i3/config
Normal file
|
@ -0,0 +1,247 @@
|
|||
# -*- mode: i3wm-config -*-
|
||||
|
||||
set $color_bad = #CC0000
|
||||
set $color_degraded = #EDD400
|
||||
set $color_good = #73D216
|
||||
set $mod Mod4
|
||||
|
||||
# Fuente para títulos de ventanas
|
||||
font pango:DejaVu Sans Mono 10
|
||||
|
||||
# Usar Ratón+$mod para mover las ventanas flotantes
|
||||
floating_modifier $mod
|
||||
|
||||
# Display
|
||||
set $display1 eDP-1
|
||||
set $display2 DP-1
|
||||
|
||||
# volver a la misma ventana que estaba apretando el mismo worskpace
|
||||
workspace_auto_back_and_forth yes
|
||||
|
||||
# abrir una terminal
|
||||
bindsym $mod+Return exec alacritty
|
||||
|
||||
# cerrar ventana
|
||||
bindsym $mod+Shift+Q kill
|
||||
|
||||
# Reinicia i3
|
||||
bindsym $mod+Shift+r restart
|
||||
|
||||
# Cambiar foco
|
||||
bindsym $mod+h focus left
|
||||
bindsym $mod+j focus down
|
||||
bindsym $mod+k focus up
|
||||
bindsym $mod+l focus right
|
||||
|
||||
# Cambiar foco con las flechas
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# Mover de workspace
|
||||
bindsym $mod+Shift+h move left
|
||||
bindsym $mod+Shift+j move down
|
||||
bindsym $mod+Shift+k move up
|
||||
bindsym $mod+Shift+l move right
|
||||
|
||||
# Mover de workspace usando las flechas
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
|
||||
# Cambiar la orientación en horizontal
|
||||
bindsym $mod+b split h
|
||||
|
||||
# Cambiar la orientación en vertical
|
||||
bindsym $mod+v split v
|
||||
|
||||
# Fullscreen
|
||||
bindsym $mod+f fullscreen
|
||||
|
||||
# Cambiar layout
|
||||
bindsym $mod+y layout stacking
|
||||
bindsym $mod+a layout default
|
||||
bindsym $mod+s layout tabbed
|
||||
|
||||
# Cambiar entre tiling / floating
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# Cambiar foco entre tiling / floating windows
|
||||
bindsym $mod+space focus mode_toggle
|
||||
|
||||
# Definir workspaces
|
||||
set $ws1 1<big></big>
|
||||
set $ws2 2<big></big>
|
||||
set $ws3 3<big></big>
|
||||
set $ws4 4<big></big>
|
||||
set $ws5 5<big></big>
|
||||
set $ws6 6<big></big>
|
||||
set $ws7 7<big></big>
|
||||
set $ws8 8<big></big>
|
||||
set $ws9 9<big></big>
|
||||
set $ws10 10<big></big>
|
||||
|
||||
# Cambiar a workspace
|
||||
bindsym $mod+1 workspace $ws1
|
||||
bindsym $mod+2 workspace $ws2
|
||||
bindsym $mod+3 workspace $ws3
|
||||
bindsym $mod+4 workspace $ws4
|
||||
bindsym $mod+5 workspace $ws5
|
||||
bindsym $mod+6 workspace $ws6
|
||||
bindsym $mod+7 workspace $ws7
|
||||
bindsym $mod+8 workspace $ws8
|
||||
bindsym $mod+9 workspace $ws9
|
||||
bindsym $mod+0 workspace $ws10
|
||||
|
||||
# Mover a workspace
|
||||
bindsym $mod+Shift+1 move container to workspace $ws1
|
||||
bindsym $mod+Shift+2 move container to workspace $ws2
|
||||
bindsym $mod+Shift+3 move container to workspace $ws3
|
||||
bindsym $mod+Shift+4 move container to workspace $ws4
|
||||
bindsym $mod+Shift+5 move container to workspace $ws5
|
||||
bindsym $mod+Shift+6 move container to workspace $ws6
|
||||
bindsym $mod+Shift+7 move container to workspace $ws7
|
||||
bindsym $mod+Shift+8 move container to workspace $ws8
|
||||
bindsym $mod+Shift+9 move container to workspace $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace $ws10
|
||||
|
||||
# Workspace a monitores
|
||||
workspace $ws1 output $display2
|
||||
workspace $ws2 output $display2
|
||||
workspace $ws3 output $display1
|
||||
workspace $ws4 output $display2
|
||||
workspace $ws5 output $display2
|
||||
workspace $ws6 output $display2
|
||||
workspace $ws7 output $display1
|
||||
workspace $ws8 output $display1
|
||||
workspace $ws9 output $display1
|
||||
workspace $ws10 output $display1
|
||||
|
||||
# Cambiar tamaño de ventana
|
||||
mode "Resize" {
|
||||
# These bindings trigger as soon as you enter the resize mode
|
||||
bindsym h resize shrink width 2 px or 2 ppt
|
||||
bindsym j resize grow height 2 px or 2 ppt
|
||||
bindsym k resize shrink height 2 px or 2 ppt
|
||||
bindsym l resize grow width 2 px or 2 ppt
|
||||
|
||||
# same bindings, but for the arrow keys
|
||||
bindsym Left resize shrink width 10 px or 10 ppt
|
||||
bindsym Down resize grow height 10 px or 10 ppt
|
||||
bindsym Up resize shrink height 10 px or 10 ppt
|
||||
bindsym Right resize grow width 10 px or 10 ppt
|
||||
|
||||
|
||||
# back to normal: Enter or Escape
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
bindsym $mod+r mode "Resize"
|
||||
|
||||
# Barra principal
|
||||
bar {
|
||||
font pango:Dyuthi3, Awesome, Icons 10, DejaVu Sans Mono for Powerline 10
|
||||
status_command /usr/bin/i3blocks
|
||||
position top
|
||||
strip_workspace_numbers yes
|
||||
i3bar_command i3bar -t
|
||||
|
||||
colors {
|
||||
background #000000
|
||||
separator #000000
|
||||
|
||||
###XXX: Details border backgr. text
|
||||
focused_workspace #990099 #222222 #729FCF
|
||||
inactive_workspace #222222 #222222 #729FCF
|
||||
active_workspace #222222 #222222 #729FCF
|
||||
urgent_workspace #FF0000 #222222 #FF0000
|
||||
}
|
||||
}
|
||||
|
||||
# Bloquear pantalla
|
||||
bindsym $mod+Control+l exec --no-startup-id ~/.i3/scripts/lock, mode "default"
|
||||
|
||||
# Seleccionar padre
|
||||
bindsym $mod+i focus parent
|
||||
|
||||
# Seleccionar hijo
|
||||
bindsym $mod+o focus child
|
||||
|
||||
# evitar titulos feos
|
||||
new_window pixel
|
||||
|
||||
# Colors de las ventanas
|
||||
# class border backgr text indicator
|
||||
client.focused #990099 #222222 #ffffff #729FCF
|
||||
client.focused_inactive #222222 #222222 #ffffff #729FCF
|
||||
client.unfocused #222222 #222222 #ffffff #729FCF
|
||||
client.urgent #FF0000 #8C5665 #ffffff #FF0000
|
||||
|
||||
# Wallpaper
|
||||
exec --no-startup-id feh --bg-scale ~/.compartido/Imagenes/arch.jpg
|
||||
|
||||
# Autostart
|
||||
exec --no-startup-id bash ~/.xinitrc
|
||||
exec --no-startup-id bash ~/.i3/scripts/autolock.sh
|
||||
exec --no-startup-id parcellite
|
||||
exec --no-startup-id compton
|
||||
exec --no-startup-id dunst
|
||||
exec --no-startup-id xcape
|
||||
exec --no-startup-id redshift -l 40.25:03.45 -t 5700:3600 -g 0.8 -m randr
|
||||
exec --no-startup-id pactl set-sink-volume 0 50%
|
||||
exec --no-startup-id setxkbmap us -variant altgr-intl
|
||||
exec --no-startup-id firefox
|
||||
exec --no-startup-id emacs
|
||||
|
||||
# Mover programas automáticamente a workspace
|
||||
assign [class="(?i)firefox"] $ws2
|
||||
assign [class="(?i)tor"] $ws2
|
||||
assign [class="(?i)chromium"] $ws2
|
||||
assign [class="(?i)qutebrowser"] $ws2
|
||||
assign [title="Steam"] $ws7
|
||||
assign [title="spotify"] $ws7
|
||||
assign [class="(?i)mumble"] $ws8
|
||||
assign [class="(?i)transmission"] $ws8
|
||||
assign [class="(?i)thunderbird"] $ws9
|
||||
assign [title="mutt"] $ws9
|
||||
|
||||
# Hacer ventanas flotantes automáticamente
|
||||
for_window [window_role="Preferences"] floating enable
|
||||
for_window [window_role="help-browser"] floating enable
|
||||
for_window [class="(?i)xcalc"] floating enable
|
||||
for_window [window_role="pop-up"] floating enable
|
||||
for_window [window_role="About"] floating enable
|
||||
for_window [class="(?i)wicd"] floating enable
|
||||
for_window [class="(?i)feh"] floating enable
|
||||
for_window [class="Progreso de operación de archivo"] floating enable
|
||||
for_window [title="textarea"] floating enable
|
||||
for_window [title="qutebrowser-editor"] floating enable
|
||||
for_window [title="Dispositivos Bluetooth"] floating enable
|
||||
for_window [title="SM-J710F"] floating enable
|
||||
|
||||
# i3-gaps
|
||||
smart_borders on
|
||||
|
||||
# Popups en pantalla completa
|
||||
popup_during_fullscreen smart
|
||||
|
||||
# El foco no lo decide el ratón
|
||||
focus_follows_mouse no
|
||||
|
||||
# Scratchpad
|
||||
bindsym $mod+Shift+p move scratchpad
|
||||
bindsym $mod+p scratchpad show
|
||||
|
||||
# keybinds varios
|
||||
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5%
|
||||
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5%
|
||||
bindsym XF86AudioMute exec --no-startup-id ~/.i3/scripts/audio-mute
|
||||
bindsym XF86AudioMicMute exec --no-startup-id ~/.i3/scripts/microphone-mute
|
||||
|
||||
# arrancar launcher
|
||||
bindsym $mod+d exec --no-startup-id zsh -c "PATH=$PATH:$HOME/bin rofi -show run"
|
||||
# emacs anywhere
|
||||
bindsym $mod+e exec --no-startup-id zsh -c "$HOME/.emacs_anywhere/bin/run"
|
3
dotfiles/i3/.i3/scripts/autolock.sh
Executable file
3
dotfiles/i3/.i3/scripts/autolock.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
xautolock -time 10 -locker "~/.i3/scripts/lock" &
|
102
dotfiles/i3/.i3/scripts/battery
Executable file
102
dotfiles/i3/.i3/scripts/battery
Executable file
|
@ -0,0 +1,102 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2016 James Murphy
|
||||
# Licensed under the GPL version 2 only
|
||||
#
|
||||
# A battery indicator blocklet script for i3blocks
|
||||
|
||||
import re
|
||||
from subprocess import check_output
|
||||
|
||||
status = check_output(['acpi'], universal_newlines=True)
|
||||
|
||||
if not status:
|
||||
# stands for no battery found
|
||||
fulltext = "<span color='red'><span font='FontAwesome'>\uf00d \uf240</span></span>"
|
||||
percentleft = 100
|
||||
else:
|
||||
# if there is more than one battery in one laptop, the percentage left is
|
||||
# available for each battery separately, although state and remaining
|
||||
# time for overall block is shown in the status of the first battery
|
||||
batteries = status.split("\n")
|
||||
state_batteries=[]
|
||||
commasplitstatus_batteries=[]
|
||||
percentleft_batteries=[]
|
||||
time = ""
|
||||
for battery in batteries:
|
||||
if battery!='':
|
||||
state_batteries.append(battery.split(": ")[1].split(", ")[0])
|
||||
commasplitstatus = battery.split(", ")
|
||||
if not time:
|
||||
time = commasplitstatus[-1].strip()
|
||||
# check if it matches a time
|
||||
time = re.match(r"(\d+):(\d+)", time)
|
||||
if time:
|
||||
time = ":".join(time.groups())
|
||||
timeleft = " ({})".format(time)
|
||||
else:
|
||||
timeleft = ""
|
||||
|
||||
p = int(commasplitstatus[1].rstrip("%\n"))
|
||||
if p>0:
|
||||
percentleft_batteries.append(p)
|
||||
commasplitstatus_batteries.append(commasplitstatus)
|
||||
state = state_batteries[0]
|
||||
commasplitstatus = commasplitstatus_batteries[0]
|
||||
if percentleft_batteries:
|
||||
percentleft = int(sum(percentleft_batteries)/len(percentleft_batteries))
|
||||
else:
|
||||
percentleft = 0
|
||||
|
||||
# stands for charging
|
||||
FA_LIGHTNING = "<span color='yellow'><span font='FontAwesome'>\uf0e7</span></span>"
|
||||
|
||||
# stands for plugged in
|
||||
FA_PLUG = "<span font='FontAwesome'>\uf1e6</span>"
|
||||
|
||||
# stands for using battery
|
||||
FA_BATTERY = "<span font='FontAwesome'>\uf240</span>"
|
||||
|
||||
# stands for unknown status of battery
|
||||
FA_QUESTION = "<span font='FontAwesome'>\uf128</span>"
|
||||
|
||||
|
||||
if state == "Discharging":
|
||||
fulltext = FA_BATTERY + " "
|
||||
elif state == "Full":
|
||||
fulltext = FA_PLUG + " "
|
||||
timeleft = ""
|
||||
elif state == "Unknown":
|
||||
fulltext = FA_BATTERY + " "
|
||||
timeleft = ""
|
||||
else:
|
||||
fulltext = FA_LIGHTNING + " " + FA_PLUG + " "
|
||||
|
||||
def color(percent):
|
||||
if percent < 10:
|
||||
# exit code 33 will turn background red
|
||||
return "#FFFFFF"
|
||||
if percent < 20:
|
||||
return "#FF3300"
|
||||
if percent < 30:
|
||||
return "#FF6600"
|
||||
if percent < 40:
|
||||
return "#FF9900"
|
||||
if percent < 50:
|
||||
return "#FFCC00"
|
||||
if percent < 60:
|
||||
return "#FFFF00"
|
||||
if percent < 70:
|
||||
return "#FFFF33"
|
||||
if percent < 80:
|
||||
return "#FFFF66"
|
||||
return "#FFFFFF"
|
||||
|
||||
form = '<span color="{}">{}%</span>'
|
||||
fulltext += form.format(color(percentleft), percentleft)
|
||||
fulltext += timeleft
|
||||
|
||||
print(fulltext)
|
||||
print(fulltext)
|
||||
if percentleft < 10:
|
||||
exit(33)
|
13
dotfiles/i3/.i3/scripts/date
Executable file
13
dotfiles/i3/.i3/scripts/date
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
time='<span background="#ffd700"><span foreground="black"> '"$(date '+%H:%M:%S') </span></span>"
|
||||
date='<span foreground="#ffd700"></span> '"$(date '+%d/%m/%Y')"
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send -u low "$date" ;;
|
||||
3) notify-send -u low "$date" ;;
|
||||
esac
|
||||
|
||||
echo -n "$time"
|
||||
|
||||
exit 0
|
34
dotfiles/i3/.i3/scripts/lock
Executable file
34
dotfiles/i3/.i3/scripts/lock
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
sleep 0.01
|
||||
# i3lock blurred screen inspired by /u/patopop007 and the blog post
|
||||
# http://plankenau.com/blog/post-10/gaussianlock
|
||||
|
||||
# Timings are on an Intel i7-2630QM @ 2.00GHz
|
||||
|
||||
# Dependencies:
|
||||
# imagemagick
|
||||
# i3lock
|
||||
# scrot (optional but default)
|
||||
|
||||
IMAGE=/tmp/i3lock.png
|
||||
SCREENSHOT="scrot $IMAGE" # 0.46s
|
||||
|
||||
# Alternate screenshot method with imagemagick. NOTE: it is much slower
|
||||
# SCREENSHOT="import -window root $IMAGE" # 1.35s
|
||||
|
||||
# Here are some imagemagick blur types
|
||||
# Uncomment one to use, if you have multiple, the last one will be used
|
||||
|
||||
# All options are here: http://www.imagemagick.org/Usage/blur/#blur_args
|
||||
BLURTYPE="0x5" # 7.52s
|
||||
#BLURTYPE="0x2" # 4.39s
|
||||
#BLURTYPE="5x2" # 3.80s
|
||||
#BLURTYPE="2x8" # 2.90s
|
||||
#BLURTYPE="2x3" # 2.92s
|
||||
|
||||
# Get the screenshot, add the blur and lock the screen with it
|
||||
$SCREENSHOT
|
||||
convert $IMAGE -blur $BLURTYPE $IMAGE
|
||||
i3lock -i $IMAGE
|
||||
rm $IMAGE
|
69
dotfiles/i3/.i3/scripts/sensors
Executable file
69
dotfiles/i3/.i3/scripts/sensors
Executable file
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/env perl
|
||||
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
|
||||
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
|
||||
# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
|
||||
# Copyright 2014 Benjamin Chretien <chretien at lirmm dot fr>
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
use Getopt::Long;
|
||||
|
||||
binmode(STDOUT, ":utf8");
|
||||
|
||||
# default values
|
||||
my $t_warn = $ENV{T_WARN} || 70;
|
||||
my $t_crit = $ENV{T_CRIT} || 90;
|
||||
my $chip = $ENV{SENSOR_CHIP} || "";
|
||||
my $temperature = -9999;
|
||||
|
||||
sub help {
|
||||
print "Usage: temperature [-w <warning>] [-c <critical>] [--chip <chip>]\n";
|
||||
print "-w <percent>: warning threshold to become yellow\n";
|
||||
print "-c <percent>: critical threshold to become red\n";
|
||||
print "--chip <chip>: sensor chip\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
GetOptions("help|h" => \&help,
|
||||
"w=i" => \$t_warn,
|
||||
"c=i" => \$t_crit,
|
||||
"chip=s" => \$chip);
|
||||
|
||||
# Get chip temperature
|
||||
open (SENSORS, "sensors -u $chip |") or die;
|
||||
while (<SENSORS>) {
|
||||
if (/^\s+temp1_input:\s+[\+]*([\-]*\d+\.\d)/) {
|
||||
$temperature = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(SENSORS);
|
||||
|
||||
$temperature eq -9999 and die 'Cannot find temperature';
|
||||
|
||||
# Print short_text, full_text
|
||||
print "$temperature°C\n";
|
||||
|
||||
# Print color, if needed
|
||||
if ($temperature >= $t_crit) {
|
||||
print "#FF0000\n";
|
||||
exit 33;
|
||||
} elsif ($temperature >= $t_warn) {
|
||||
print "#FFFC00\n";
|
||||
}
|
||||
|
||||
exit 0;
|
175
dotfiles/i3/.i3/scripts/volume-pulseaudio
Executable file
175
dotfiles/i3/.i3/scripts/volume-pulseaudio
Executable file
|
@ -0,0 +1,175 @@
|
|||
#!/bin/bash
|
||||
# Displays the default device, volume, and mute status for i3blocks
|
||||
|
||||
set -a
|
||||
|
||||
AUDIO_HIGH_SYMBOL=${AUDIO_HIGH_SYMBOL:-' '}
|
||||
|
||||
AUDIO_MED_THRESH=${AUDIO_MED_THRESH:-50}
|
||||
AUDIO_MED_SYMBOL=${AUDIO_MED_SYMBOL:-' '}
|
||||
|
||||
AUDIO_LOW_THRESH=${AUDIO_LOW_THRESH:-0}
|
||||
AUDIO_LOW_SYMBOL=${AUDIO_LOW_SYMBOL:-' '}
|
||||
|
||||
AUDIO_MUTED_SYMBOL=${AUDIO_MUTED_SYMBOL:-' '}
|
||||
|
||||
AUDIO_DELTA=${AUDIO_DELTA:-5}
|
||||
|
||||
DEFAULT_COLOR=${DEFAULT_COLOR:-"#ffffff"}
|
||||
MUTED_COLOR=${MUTED_COLOR:-"#a0a0a0"}
|
||||
|
||||
LONG_FORMAT=${LONG_FORMAT:-'${SYMB} ${VOL}% [${INDEX}:${NAME}]'}
|
||||
SHORT_FORMAT=${SHORT_FORMAT:-'${SYMB} ${VOL}% [${INDEX}]'}
|
||||
USE_ALSA_NAME=${USE_ALSA_NAME:-0}
|
||||
USE_DESCRIPTION=${USE_DESCRIPTION:-0}
|
||||
|
||||
SUBSCRIBE=${SUBSCRIBE:-0}
|
||||
|
||||
MIXER=${MIXER:-""}
|
||||
SCONTROL=${SCONTROL:-""}
|
||||
|
||||
while getopts F:Sf:adH:M:L:X:T:t:C:c:i:m:s:h opt; do
|
||||
case "$opt" in
|
||||
S) SUBSCRIBE=1 ;;
|
||||
F) LONG_FORMAT="$OPTARG" ;;
|
||||
f) SHORT_FORMAT="$OPTARG" ;;
|
||||
a) USE_ALSA_NAME=1 ;;
|
||||
d) USE_DESCRIPTION=1 ;;
|
||||
H) AUDIO_HIGH_SYMBOL="$OPTARG" ;;
|
||||
M) AUDIO_MED_SYMBOL="$OPTARG" ;;
|
||||
L) AUDIO_LOW_SYMBOL="$OPTARG" ;;
|
||||
X) AUDIO_MUTED_SYMBOL="$OPTARG" ;;
|
||||
T) AUDIO_MED_THRESH="$OPTARG" ;;
|
||||
t) AUDIO_LOW_THRESH="$OPTARG" ;;
|
||||
C) DEFAULT_COLOR="$OPTARG" ;;
|
||||
c) MUTED_COLOR="$OPTARG" ;;
|
||||
i) AUDIO_INTERVAL="$OPTARG" ;;
|
||||
m) MIXER="$OPTARG" ;;
|
||||
s) SCONTROL="$OPTARG" ;;
|
||||
h) printf \
|
||||
"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
|
||||
[-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
|
||||
[-m mixer] [-s scontrol] [-h]
|
||||
Options:
|
||||
-F, -f\tOutput format (-F long format, -f short format) to use, with exposed variables:
|
||||
\${SYMB}, \${VOL}, \${INDEX}, \${NAME}
|
||||
-S\tSubscribe to volume events (requires persistent block, always uses long format)
|
||||
-a\tUse ALSA name if possible
|
||||
-d\tUse device description instead of name if possible
|
||||
-H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL'
|
||||
-M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL'
|
||||
-L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL'
|
||||
-X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL'
|
||||
-T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH
|
||||
-t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH
|
||||
-C\tColor for non-muted audio. Default: $DEFAULT_COLOR
|
||||
-c\tColor for muted audio. Default: $MUTED_COLOR
|
||||
-i\tInterval size of volume increase/decrease. Default: $AUDIO_DELTA
|
||||
-m\tUse the given mixer.
|
||||
-s\tUse the given scontrol.
|
||||
-h\tShow this help text
|
||||
" && exit 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$MIXER" ]] ; then
|
||||
MIXER="default"
|
||||
if amixer -D pulse info >/dev/null 2>&1 ; then
|
||||
MIXER="pulse"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$SCONTROL" ]] ; then
|
||||
SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1)
|
||||
fi
|
||||
|
||||
CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p")
|
||||
|
||||
|
||||
function move_sinks_to_new_default {
|
||||
DEFAULT_SINK=$1
|
||||
pacmd list-sink-inputs | grep index: | grep -o '[0-9]\+' | while read SINK
|
||||
do
|
||||
pacmd move-sink-input $SINK $DEFAULT_SINK
|
||||
done
|
||||
}
|
||||
|
||||
function set_default_playback_device_next {
|
||||
inc=${1:-1}
|
||||
num_devices=$(pacmd list-sinks | grep -c index:)
|
||||
sink_arr=($(pacmd list-sinks | grep index: | grep -o '[0-9]\+'))
|
||||
default_sink_index=$(( $(pacmd list-sinks | grep index: | grep -no '*' | grep -o '^[0-9]\+') - 1 ))
|
||||
default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices ))
|
||||
default_sink=${sink_arr[$default_sink_index]}
|
||||
pacmd set-default-sink $default_sink
|
||||
move_sinks_to_new_default $default_sink
|
||||
}
|
||||
|
||||
case "$BLOCK_BUTTON" in
|
||||
1) set_default_playback_device_next ;;
|
||||
2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;;
|
||||
3) set_default_playback_device_next -1 ;;
|
||||
4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%+ ;;
|
||||
5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%- ;;
|
||||
esac
|
||||
|
||||
function print_format {
|
||||
echo "$1" | envsubst '${SYMB}${VOL}${INDEX}${NAME}'
|
||||
}
|
||||
|
||||
function print_block {
|
||||
ACTIVE=$(pacmd list-sinks | grep "state\: RUNNING" -B4 -A7 | grep "index:\|name:\|volume: front\|muted:")
|
||||
[ -z "$ACTIVE" ] && ACTIVE=$(pacmd list-sinks | grep "index:\|name:\|volume: front\|muted:" | grep -A3 '*')
|
||||
for name in INDEX NAME VOL MUTED; do
|
||||
read $name
|
||||
done < <(echo "$ACTIVE")
|
||||
INDEX=$(echo "$INDEX" | grep -o '[0-9]\+')
|
||||
VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 )
|
||||
VOL="${VOL%?}"
|
||||
|
||||
NAME=$(echo "$NAME" | sed \
|
||||
's/.*<.*\.\(.*\)>.*/\1/; t;'\
|
||||
's/.*<\(.*\)>.*/\1/; t;'\
|
||||
's/.*/unknown/')
|
||||
|
||||
if [[ $USE_ALSA_NAME == 1 ]] ; then
|
||||
ALSA_NAME=$(pacmd list-sinks |\
|
||||
awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
|
||||
grep "alsa.name\|alsa.mixer_name" |\
|
||||
head -n1 |\
|
||||
sed 's/.*= "\(.*\)".*/\1/')
|
||||
NAME=${ALSA_NAME:-$NAME}
|
||||
elif [[ $USE_DESCRIPTION == 1 ]] ; then
|
||||
DESCRIPTION=$(pacmd list-sinks |\
|
||||
awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
|
||||
grep "device.description" |\
|
||||
head -n1 |\
|
||||
sed 's/.*= "\(.*\)".*/\1/')
|
||||
NAME=${DESCRIPTION:-$NAME}
|
||||
fi
|
||||
|
||||
if [[ $MUTED =~ "no" ]] ; then
|
||||
SYMB=$AUDIO_HIGH_SYMBOL
|
||||
[[ $VOL -le $AUDIO_MED_THRESH ]] && SYMB=$AUDIO_MED_SYMBOL
|
||||
[[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMB=$AUDIO_LOW_SYMBOL
|
||||
COLOR=$DEFAULT_COLOR
|
||||
else
|
||||
SYMB=$AUDIO_MUTED_SYMBOL
|
||||
COLOR=$MUTED_COLOR
|
||||
fi
|
||||
|
||||
if [[ $SUBSCRIBE == 1 ]] ; then
|
||||
print_format "$LONG_FORMAT"
|
||||
else
|
||||
print_format "$LONG_FORMAT"
|
||||
print_format "$SHORT_FORMAT"
|
||||
echo "$COLOR"
|
||||
fi
|
||||
}
|
||||
|
||||
print_block
|
||||
if [[ $SUBSCRIBE == 1 ]] ; then
|
||||
while read -r EVENT; do
|
||||
print_block
|
||||
done < <(pactl subscribe | stdbuf -oL grep change)
|
||||
fi
|
45
dotfiles/i3/.i3blocks.conf
Normal file
45
dotfiles/i3/.i3blocks.conf
Normal file
|
@ -0,0 +1,45 @@
|
|||
separator=false
|
||||
separator_block_width=5
|
||||
border_top=0
|
||||
border_left=0
|
||||
border_right=0
|
||||
border_bottom=2
|
||||
|
||||
[volume]
|
||||
command=$HOME/.i3/scripts/volume-pulseaudio | cut -d '[' -f1
|
||||
interval=5
|
||||
signal=1
|
||||
markup=pango
|
||||
border=#cc241d
|
||||
|
||||
[temperature]
|
||||
label=
|
||||
command=$HOME/.i3/scripts/sensors
|
||||
interval=5
|
||||
border=#b16286
|
||||
|
||||
# [weather]
|
||||
# command=$HOME/.i3/scripts/weather
|
||||
# interval=60
|
||||
# border=#198981
|
||||
|
||||
[wireless]
|
||||
label=
|
||||
command=[[ -z "$(iwgetid -r)" ]] || echo "$(iwgetid -r) "
|
||||
interval=2
|
||||
border=#98971a
|
||||
|
||||
[battery]
|
||||
command=$HOME/.i3/scripts/battery
|
||||
interval=30
|
||||
markup=pango
|
||||
LABEL=⚡
|
||||
BAT_NUMBER=0
|
||||
border=#458588
|
||||
|
||||
[time]
|
||||
command=echo "`date +'%a %d %b'` <b>`date +'%T'`</b> "
|
||||
interval=1
|
||||
markup=pango
|
||||
border=#928374
|
||||
separator_block_width=0
|
260
dotfiles/shells/.Xmodmap
Normal file
260
dotfiles/shells/.Xmodmap
Normal file
|
@ -0,0 +1,260 @@
|
|||
keycode 8 =
|
||||
keycode 9 = Escape NoSymbol Escape
|
||||
keycode 10 = 1 exclam 1 exclam bar exclamdown bar
|
||||
keycode 11 = 2 quotedbl 2 quotedbl at oneeighth at
|
||||
keycode 12 = 3 periodcentered 3 periodcentered numbersign sterling numbersign
|
||||
keycode 13 = 4 dollar 4 dollar asciitilde dollar asciitilde
|
||||
keycode 14 = 5 percent 5 percent onehalf threeeighths onehalf
|
||||
keycode 15 = 6 ampersand 6 ampersand notsign fiveeighths notsign
|
||||
keycode 16 = 7 slash 7 slash braceleft seveneighths braceleft
|
||||
keycode 17 = 8 parenleft 8 parenleft bracketleft trademark bracketleft
|
||||
keycode 18 = 9 parenright 9 parenright bracketright plusminus bracketright
|
||||
keycode 19 = 0 equal 0 equal braceright degree braceright
|
||||
keycode 20 = apostrophe question apostrophe question backslash questiondown backslash
|
||||
keycode 21 = exclamdown questiondown exclamdown questiondown dead_tilde asciitilde dead_tilde
|
||||
keycode 22 = BackSpace BackSpace BackSpace BackSpace NoSymbol NoSymbol Terminate_Server
|
||||
keycode 23 = Tab ISO_Left_Tab Tab ISO_Left_Tab
|
||||
keycode 24 = q Q q Q at Greek_OMEGA at
|
||||
keycode 25 = w W w W lstroke Lstroke lstroke
|
||||
keycode 26 = e E e E EuroSign cent EuroSign
|
||||
keycode 27 = r R r R paragraph registered paragraph
|
||||
keycode 28 = t T t T tslash Tslash tslash
|
||||
keycode 29 = y Y y Y leftarrow yen leftarrow
|
||||
keycode 30 = u U u U downarrow uparrow downarrow
|
||||
keycode 31 = i I i I rightarrow idotless rightarrow
|
||||
keycode 32 = o O o O oslash Oslash oslash
|
||||
keycode 33 = p P p P thorn THORN thorn
|
||||
keycode 34 = dead_grave dead_circumflex dead_grave dead_circumflex bracketleft dead_abovering bracketleft
|
||||
keycode 35 = plus asterisk plus asterisk bracketright dead_macron bracketright
|
||||
keycode 36 = Return NoSymbol Return
|
||||
keycode 37 = Control_L NoSymbol Control_L
|
||||
keycode 38 = a A a A ae AE ae
|
||||
keycode 39 = s S s S ssharp section ssharp
|
||||
keycode 40 = d D d D eth ETH eth
|
||||
keycode 41 = f F f F dstroke ordfeminine dstroke
|
||||
keycode 42 = g G g G eng ENG eng
|
||||
keycode 43 = h H h H hstroke Hstroke hstroke
|
||||
keycode 44 = j J j J dead_hook dead_horn dead_hook
|
||||
keycode 45 = k K k K kra ampersand kra
|
||||
keycode 46 = l L l L lstroke Lstroke lstroke
|
||||
keycode 47 = ntilde Ntilde ntilde Ntilde asciitilde dead_doubleacute asciitilde
|
||||
keycode 48 = dead_acute dead_diaeresis dead_acute dead_diaeresis braceleft braceleft braceleft
|
||||
keycode 49 = masculine ordfeminine masculine ordfeminine backslash backslash backslash
|
||||
keycode 50 = Shift_L NoSymbol Shift_L
|
||||
keycode 51 = ccedilla Ccedilla ccedilla Ccedilla braceright dead_breve braceright
|
||||
keycode 52 = z Z z Z guillemotleft less guillemotleft
|
||||
keycode 53 = x X x X guillemotright greater guillemotright
|
||||
keycode 54 = c C c C cent copyright cent
|
||||
keycode 55 = v V v V leftdoublequotemark leftsinglequotemark leftdoublequotemark
|
||||
keycode 56 = b B b B rightdoublequotemark rightsinglequotemark rightdoublequotemark
|
||||
keycode 57 = n N n N n N n
|
||||
keycode 58 = m M m M mu masculine mu
|
||||
keycode 59 = comma semicolon comma semicolon horizconnector multiply horizconnector
|
||||
keycode 60 = period colon period colon periodcentered division periodcentered
|
||||
keycode 61 = minus underscore minus underscore dead_belowdot dead_abovedot dead_belowdot
|
||||
keycode 62 = Shift_R NoSymbol Shift_R
|
||||
keycode 63 = KP_Multiply KP_Multiply KP_Multiply KP_Multiply KP_Multiply KP_Multiply XF86ClearGrab
|
||||
keycode 64 = Alt_L Meta_L Alt_L Meta_L
|
||||
keycode 65 = space NoSymbol space
|
||||
keycode 66 = Caps_Lock NoSymbol Caps_Lock
|
||||
keycode 67 = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1
|
||||
keycode 68 = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2
|
||||
keycode 69 = F3 F3 F3 F3 F3 F3 XF86Switch_VT_3
|
||||
keycode 70 = F4 F4 F4 F4 F4 F4 XF86Switch_VT_4
|
||||
keycode 71 = F5 F5 F5 F5 F5 F5 XF86Switch_VT_5
|
||||
keycode 72 = F6 F6 F6 F6 F6 F6 XF86Switch_VT_6
|
||||
keycode 73 = F7 F7 F7 F7 F7 F7 XF86Switch_VT_7
|
||||
keycode 74 = F8 F8 F8 F8 F8 F8 XF86Switch_VT_8
|
||||
keycode 75 = F9 F9 F9 F9 F9 F9 XF86Switch_VT_9
|
||||
keycode 76 = F10 F10 F10 F10 F10 F10 XF86Switch_VT_10
|
||||
keycode 77 = Num_Lock NoSymbol Num_Lock
|
||||
keycode 78 = Scroll_Lock NoSymbol Scroll_Lock
|
||||
keycode 79 = KP_Home 7 KP_Home 7
|
||||
keycode 80 = KP_Up 8 KP_Up 8
|
||||
keycode 81 = KP_Prior 9 KP_Prior 9
|
||||
keycode 82 = KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract XF86Prev_VMode
|
||||
keycode 83 = KP_Left 4 KP_Left 4
|
||||
keycode 84 = KP_Begin 5 KP_Begin 5
|
||||
keycode 85 = KP_Right 6 KP_Right 6
|
||||
keycode 86 = KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add XF86Next_VMode
|
||||
keycode 87 = KP_End 1 KP_End 1
|
||||
keycode 88 = KP_Down 2 KP_Down 2
|
||||
keycode 89 = KP_Next 3 KP_Next 3
|
||||
keycode 90 = KP_Insert 0 KP_Insert 0
|
||||
keycode 91 = KP_Delete KP_Decimal KP_Delete KP_Decimal
|
||||
keycode 92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
|
||||
keycode 93 =
|
||||
keycode 94 = less greater less greater bar brokenbar bar
|
||||
keycode 95 = F11 F11 F11 F11 F11 F11 XF86Switch_VT_11
|
||||
keycode 96 = F12 F12 F12 F12 F12 F12 XF86Switch_VT_12
|
||||
keycode 97 =
|
||||
keycode 98 = Katakana NoSymbol Katakana
|
||||
keycode 99 = Hiragana NoSymbol Hiragana
|
||||
keycode 100 = Henkan_Mode NoSymbol Henkan_Mode
|
||||
keycode 101 = Hiragana_Katakana NoSymbol Hiragana_Katakana
|
||||
keycode 102 = Muhenkan NoSymbol Muhenkan
|
||||
keycode 103 =
|
||||
keycode 104 = KP_Enter NoSymbol KP_Enter
|
||||
keycode 105 = Control_R NoSymbol Control_R
|
||||
keycode 106 = KP_Divide KP_Divide KP_Divide KP_Divide KP_Divide KP_Divide XF86Ungrab
|
||||
keycode 107 = Print Sys_Req Print Sys_Req
|
||||
keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
|
||||
keycode 109 = Linefeed NoSymbol Linefeed
|
||||
keycode 110 = Home NoSymbol Home
|
||||
keycode 111 = Up NoSymbol Up
|
||||
keycode 112 = Prior NoSymbol Prior
|
||||
keycode 113 = Left NoSymbol Left
|
||||
keycode 114 = Right NoSymbol Right
|
||||
keycode 115 = End NoSymbol End
|
||||
keycode 116 = Down NoSymbol Down
|
||||
keycode 117 = Next NoSymbol Next
|
||||
keycode 118 = Insert NoSymbol Insert
|
||||
keycode 119 = Delete NoSymbol Delete
|
||||
keycode 120 =
|
||||
keycode 121 = XF86AudioMute NoSymbol XF86AudioMute
|
||||
keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
|
||||
keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume
|
||||
keycode 124 = XF86PowerOff NoSymbol XF86PowerOff
|
||||
keycode 125 = KP_Equal NoSymbol KP_Equal
|
||||
keycode 126 = plusminus NoSymbol plusminus
|
||||
keycode 127 = Pause Break Pause Break
|
||||
keycode 128 = XF86LaunchA NoSymbol XF86LaunchA
|
||||
keycode 129 = KP_Decimal KP_Decimal KP_Decimal KP_Decimal
|
||||
keycode 130 = Hangul NoSymbol Hangul
|
||||
keycode 131 = Hangul_Hanja NoSymbol Hangul_Hanja
|
||||
keycode 132 =
|
||||
keycode 133 = Super_L NoSymbol Super_L
|
||||
keycode 134 = Super_R NoSymbol Super_R
|
||||
keycode 135 = Super_L NoSymbol Super_L
|
||||
keycode 136 = Cancel NoSymbol Cancel
|
||||
keycode 137 = Redo NoSymbol Redo
|
||||
keycode 138 = SunProps NoSymbol SunProps
|
||||
keycode 139 = Undo NoSymbol Undo
|
||||
keycode 140 = SunFront NoSymbol SunFront
|
||||
keycode 141 = XF86Copy NoSymbol XF86Copy
|
||||
keycode 142 = SunOpen NoSymbol SunOpen
|
||||
keycode 143 = XF86Paste NoSymbol XF86Paste
|
||||
keycode 144 = Find NoSymbol Find
|
||||
keycode 145 = XF86Cut NoSymbol XF86Cut
|
||||
keycode 146 = Help NoSymbol Help
|
||||
keycode 147 = XF86MenuKB NoSymbol XF86MenuKB
|
||||
keycode 148 = XF86Calculator NoSymbol XF86Calculator
|
||||
keycode 149 =
|
||||
keycode 150 = XF86Sleep NoSymbol XF86Sleep
|
||||
keycode 151 = XF86WakeUp NoSymbol XF86WakeUp
|
||||
keycode 152 = XF86Explorer NoSymbol XF86Explorer
|
||||
keycode 153 = XF86Send NoSymbol XF86Send
|
||||
keycode 154 =
|
||||
keycode 155 = XF86Xfer NoSymbol XF86Xfer
|
||||
keycode 156 = XF86Launch1 NoSymbol XF86Launch1
|
||||
keycode 157 = XF86Launch2 NoSymbol XF86Launch2
|
||||
keycode 158 = XF86WWW NoSymbol XF86WWW
|
||||
keycode 159 = XF86DOS NoSymbol XF86DOS
|
||||
keycode 160 = XF86ScreenSaver NoSymbol XF86ScreenSaver
|
||||
keycode 161 =
|
||||
keycode 162 = XF86RotateWindows NoSymbol XF86RotateWindows
|
||||
keycode 163 = XF86Mail NoSymbol XF86Mail
|
||||
keycode 164 = XF86Favorites NoSymbol XF86Favorites
|
||||
keycode 165 = XF86MyComputer NoSymbol XF86MyComputer
|
||||
keycode 166 = XF86Back NoSymbol XF86Back
|
||||
keycode 167 = XF86Forward NoSymbol XF86Forward
|
||||
keycode 168 =
|
||||
keycode 169 = XF86Eject NoSymbol XF86Eject
|
||||
keycode 170 = XF86Eject XF86Eject XF86Eject XF86Eject
|
||||
keycode 171 = XF86AudioNext NoSymbol XF86AudioNext
|
||||
keycode 172 = XF86AudioPlay XF86AudioPause XF86AudioPlay XF86AudioPause
|
||||
keycode 173 = XF86AudioPrev NoSymbol XF86AudioPrev
|
||||
keycode 174 = XF86AudioStop XF86Eject XF86AudioStop XF86Eject
|
||||
keycode 175 = XF86AudioRecord NoSymbol XF86AudioRecord
|
||||
keycode 176 = XF86AudioRewind NoSymbol XF86AudioRewind
|
||||
keycode 177 = XF86Phone NoSymbol XF86Phone
|
||||
keycode 178 =
|
||||
keycode 179 = XF86Tools NoSymbol XF86Tools
|
||||
keycode 180 = XF86HomePage NoSymbol XF86HomePage
|
||||
keycode 181 = XF86Reload NoSymbol XF86Reload
|
||||
keycode 182 = XF86Close NoSymbol XF86Close
|
||||
keycode 183 =
|
||||
keycode 184 =
|
||||
keycode 185 = XF86ScrollUp NoSymbol XF86ScrollUp
|
||||
keycode 186 = XF86ScrollDown NoSymbol XF86ScrollDown
|
||||
keycode 187 = parenleft NoSymbol parenleft
|
||||
keycode 188 = parenright NoSymbol parenright
|
||||
keycode 189 = XF86New NoSymbol XF86New
|
||||
keycode 190 = Redo NoSymbol Redo
|
||||
keycode 191 = XF86Tools NoSymbol XF86Tools
|
||||
keycode 192 = XF86Launch5 NoSymbol XF86Launch5
|
||||
keycode 193 = XF86Launch6 NoSymbol XF86Launch6
|
||||
keycode 194 = XF86Launch7 NoSymbol XF86Launch7
|
||||
keycode 195 = XF86Launch8 NoSymbol XF86Launch8
|
||||
keycode 196 = XF86Launch9 NoSymbol XF86Launch9
|
||||
keycode 197 =
|
||||
keycode 198 =
|
||||
keycode 199 = XF86TouchpadToggle NoSymbol XF86TouchpadToggle
|
||||
keycode 200 = XF86TouchpadOn NoSymbol XF86TouchpadOn
|
||||
keycode 201 = XF86TouchpadOff NoSymbol XF86TouchpadOff
|
||||
keycode 202 =
|
||||
keycode 203 = Mode_switch NoSymbol Mode_switch
|
||||
keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
|
||||
keycode 205 = NoSymbol Meta_L NoSymbol Meta_L
|
||||
keycode 206 = NoSymbol Super_L NoSymbol Super_L
|
||||
keycode 207 = NoSymbol Hyper_L NoSymbol Hyper_L
|
||||
keycode 208 = XF86AudioPlay NoSymbol XF86AudioPlay
|
||||
keycode 209 = XF86AudioPause NoSymbol XF86AudioPause
|
||||
keycode 210 = XF86Launch3 NoSymbol XF86Launch3
|
||||
keycode 211 = XF86Launch4 NoSymbol XF86Launch4
|
||||
keycode 212 = XF86LaunchB NoSymbol XF86LaunchB
|
||||
keycode 213 = XF86Suspend NoSymbol XF86Suspend
|
||||
keycode 214 = XF86Close NoSymbol XF86Close
|
||||
keycode 215 = XF86AudioPlay NoSymbol XF86AudioPlay
|
||||
keycode 216 = XF86AudioForward NoSymbol XF86AudioForward
|
||||
keycode 217 =
|
||||
keycode 218 = Print NoSymbol Print
|
||||
keycode 219 =
|
||||
keycode 220 = XF86WebCam NoSymbol XF86WebCam
|
||||
keycode 221 =
|
||||
keycode 222 =
|
||||
keycode 223 = XF86Mail NoSymbol XF86Mail
|
||||
keycode 224 = XF86Messenger NoSymbol XF86Messenger
|
||||
keycode 225 = XF86Search NoSymbol XF86Search
|
||||
keycode 226 = XF86Go NoSymbol XF86Go
|
||||
keycode 227 = XF86Finance NoSymbol XF86Finance
|
||||
keycode 228 = XF86Game NoSymbol XF86Game
|
||||
keycode 229 = XF86Shop NoSymbol XF86Shop
|
||||
keycode 230 =
|
||||
keycode 231 = Cancel NoSymbol Cancel
|
||||
keycode 232 = XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown
|
||||
keycode 233 = XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp
|
||||
keycode 234 = XF86AudioMedia NoSymbol XF86AudioMedia
|
||||
keycode 235 = XF86Display NoSymbol XF86Display
|
||||
keycode 236 = XF86KbdLightOnOff NoSymbol XF86KbdLightOnOff
|
||||
keycode 237 = XF86KbdBrightnessDown NoSymbol XF86KbdBrightnessDown
|
||||
keycode 238 = XF86KbdBrightnessUp NoSymbol XF86KbdBrightnessUp
|
||||
keycode 239 = XF86Send NoSymbol XF86Send
|
||||
keycode 240 = XF86Reply NoSymbol XF86Reply
|
||||
keycode 241 = XF86MailForward NoSymbol XF86MailForward
|
||||
keycode 242 = XF86Save NoSymbol XF86Save
|
||||
keycode 243 = XF86Documents NoSymbol XF86Documents
|
||||
keycode 244 = XF86Battery NoSymbol XF86Battery
|
||||
keycode 245 = XF86Bluetooth NoSymbol XF86Bluetooth
|
||||
keycode 246 = XF86WLAN NoSymbol XF86WLAN
|
||||
keycode 247 =
|
||||
keycode 248 =
|
||||
keycode 249 =
|
||||
keycode 250 =
|
||||
keycode 251 =
|
||||
keycode 252 =
|
||||
keycode 253 =
|
||||
keycode 254 =
|
||||
keycode 255 =
|
||||
!
|
||||
! Swap Caps_Lock and Control_L
|
||||
!
|
||||
remove Lock = Caps_Lock
|
||||
remove Control = Control_L
|
||||
keysym Control_L = Caps_Lock
|
||||
keysym Caps_Lock = Control_L
|
||||
add Lock = Caps_Lock
|
||||
add Control = Control_L
|
||||
!
|
||||
! Arreglar las putas ctrl + flechas
|
||||
!
|
53
dotfiles/shells/.aliases
Normal file
53
dotfiles/shells/.aliases
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Generic
|
||||
alias rm="$HOME/bin/safer.sh"
|
||||
alias ipcurl='curl icanhazip.com && curl --silent https://geoiptool.com/|grep maker_country | cut -d" " -f5 | cut -d"<" -f1 | head -n1'
|
||||
alias toripcurl='torify curl icanhazip.com && torify curl --silent http://geoiptool.com/|grep maker_country | cut -d" " -f5 | cut -d"<" -f1 | head -n1'
|
||||
alias grep="grep --color"
|
||||
alias notify-send='notify-send -i terminal'
|
||||
alias ec="emacsclient -t"
|
||||
alias rmr="/bin/rm"
|
||||
alias watch='watch -n1'
|
||||
alias cwd='pwd | tr -d "\r\n" | xclip -selection clipboard'
|
||||
alias alarm="notify-send -u critical \"Ya ha terminado el proceso\""
|
||||
alias finished="echo \"Ya ha terminado el proceso\" | espeak -ves 2> /dev/null"
|
||||
alias cat="ccat"
|
||||
alias ls="exa"
|
||||
alias how="howdoi"
|
||||
|
||||
# Apps
|
||||
alias alpine='docker run -ti -v `pwd`:/data alpine sh'
|
||||
alias linkcheck='docker run -ti registry.daemons.it/linkcheck'
|
||||
alias cjira='docker run -ti -v $HOME/.jira-cl.json:/root/.jira-cl.json registry.daemons.it/jira'
|
||||
|
||||
# Kubernetes, copied from oh my zsh plugin
|
||||
alias kaf='kubectl apply -f'
|
||||
alias keti='kubectl exec -ti'
|
||||
alias kgp='kubectl get pods'
|
||||
alias kgs='kubectl get svc'
|
||||
alias kgi='kubectl get ingress'
|
||||
alias kgsec='kubectl get secret'
|
||||
alias kgd='kubectl get deployment'
|
||||
alias kgrs='kubectl get rs'
|
||||
alias kl='kubectl logs'
|
||||
alias klf='kubectl logs -f'
|
||||
|
||||
# History
|
||||
alias hist='history -E -20'
|
||||
|
||||
# Terraform
|
||||
alias tf="terraform"
|
||||
alias tfa="terraform apply"
|
||||
alias tfi="terraform init; alarm"
|
||||
alias tfaa="terraform apply --auto-approve; alarm"
|
||||
alias tfp="terraform plan; alarm"
|
||||
alias tfd="terraform destroy; alarm"
|
||||
|
||||
# Alertmanager
|
||||
# Config https://github.com/prometheus/alertmanager#configuration
|
||||
alertmanager_version="v0.15.1"
|
||||
alias amtool="docker run --name amtool --rm -ti --entrypoint amtool -v $HOME/.config/amtool/config.yml:/root/.config/amtool/config.yml quay.io/prometheus/alertmanager:$alertmanager_version"
|
||||
alias amta="amtool alert"
|
||||
alias amts="amtool silence"
|
||||
alias amtsa="amtool silence add"
|
||||
alias amtse="amtool silence expire"
|
||||
alias amtsall="amtool silence add --duration=2h --start=$(date --utc --rfc-3339=seconds | sed 's/ /T/') --comment 'Estamos en ello.' severity=~'info|warning|critical'"
|
96
dotfiles/shells/.bashrc
Normal file
96
dotfiles/shells/.bashrc
Normal file
|
@ -0,0 +1,96 @@
|
|||
# Path
|
||||
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/sbin:/sbin:/usr/local/bin"
|
||||
|
||||
# Prompt verde
|
||||
#PS1='\[\e[0;92m\]\u\[\e[0;93m\] % \[\e[0;92m\]\h \[\e[1;93m\]\w\[\e[0;92m\]\$ '
|
||||
# Prompt azul
|
||||
PS1='\[\e[1;94m\]\u\[\e[0m\] % \[\e[1;91m\]\h \[\e[1;93m\]\w\[\e[1;34m\] $\[\033[0m\] '
|
||||
|
||||
# Terms típicas de emacs
|
||||
[[ $TERM == "dumb" ]] && TERM=xterm; PS1='$ '
|
||||
[[ $TERM == "emacs" ]] && PS1='$ '
|
||||
[[ $TERM == "xterm" ]] && PS1='$ '
|
||||
|
||||
# Term
|
||||
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
|
||||
TERM=linux
|
||||
fi
|
||||
|
||||
# Notificar correo nuevo
|
||||
if [ -x /usr/bin/biff ]; then
|
||||
biff y 2> /dev/null
|
||||
fi
|
||||
|
||||
# Usar scripts en /etc/profile.d/
|
||||
for profile_script in /etc/profile.d/*.sh ; do
|
||||
if [ -x $profile_script ]; then
|
||||
. $profile_script
|
||||
fi
|
||||
done
|
||||
unset profile_script
|
||||
|
||||
# Alias
|
||||
source ~/.aliases
|
||||
|
||||
# Python
|
||||
export WORKON_HOME=~/.virtualenvs
|
||||
source /usr/local/bin/virtualenvwrapper_lazy.sh
|
||||
|
||||
export EDITOR="emacsclient -t -c"
|
||||
export ALTERNATE_EDITOR="nano"
|
||||
|
||||
ESC="\033"
|
||||
NORMAL="\[$ESC[m\]"
|
||||
RESET="\[$ESC[${DULL};${FG_WHITE};${BG_NULL}m\]"
|
||||
|
||||
if [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
PATH=$PATH:~/Scripts/bin:$HOME/.npm-bin/bin/
|
||||
PATH=$PATH:~/Scripts/bin:$HOME/bin
|
||||
|
||||
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
||||
sleep 0.5
|
||||
|
||||
# --httptoolkit--
|
||||
# This section will be reset each time a HTTP Toolkit terminal is opened
|
||||
if [ -n "$HTTP_TOOLKIT_ACTIVE" ]; then
|
||||
# When HTTP Toolkit is active, we inject various overrides into PATH
|
||||
export PATH="/opt/http-toolkit/resources/app/httptoolkit-server/overrides/path:$PATH"
|
||||
|
||||
if command -v winpty >/dev/null 2>&1; then
|
||||
# Work around for winpty's hijacking of certain commands
|
||||
alias php=php
|
||||
alias node=node
|
||||
fi
|
||||
fi
|
||||
# --httptoolkit-end--
|
||||
# --httptoolkit--
|
||||
# This section will be reset each time a HTTP Toolkit terminal is opened
|
||||
if [ -n "$HTTP_TOOLKIT_ACTIVE" ]; then
|
||||
# When HTTP Toolkit is active, we inject various overrides into PATH
|
||||
export PATH="/opt/http-toolkit/resources/app/httptoolkit-server/overrides/path:$PATH"
|
||||
|
||||
if command -v winpty >/dev/null 2>&1; then
|
||||
# Work around for winpty's hijacking of certain commands
|
||||
alias php=php
|
||||
alias node=node
|
||||
fi
|
||||
fi
|
||||
# --httptoolkit-end--
|
||||
# --httptoolkit--
|
||||
# This section will be reset each time a HTTP Toolkit terminal is opened
|
||||
if [ -n "$HTTP_TOOLKIT_ACTIVE" ]; then
|
||||
# When HTTP Toolkit is active, we inject various overrides into PATH
|
||||
export PATH="/home/ap/.local/share/httptoolkit-server/client/0.1.27/overrides/path:$PATH"
|
||||
|
||||
if command -v winpty >/dev/null 2>&1; then
|
||||
# Work around for winpty's hijacking of certain commands
|
||||
alias php=php
|
||||
alias node=node
|
||||
fi
|
||||
fi
|
||||
# --httptoolkit-end--
|
||||
[[ -s "/home/ap/.gvm/scripts/gvm" ]] && source "/home/ap/.gvm/scripts/gvm"
|
||||
export ELB_NAME='DEV-PORTAL-ELB-12-27-507'
|
||||
export ASG_NAME='DEV-PORTAL-ASG-12.27.507-2021-06-25T12-13-36Z'
|
211
dotfiles/shells/.functions
Normal file
211
dotfiles/shells/.functions
Normal file
|
@ -0,0 +1,211 @@
|
|||
# Busca en la basura
|
||||
function busca() {
|
||||
find "*$@*" ~/Trash/
|
||||
}
|
||||
|
||||
function cdtemp() {
|
||||
cd `mktemp -d`
|
||||
}
|
||||
|
||||
# Un bucle infinito facilitado
|
||||
function always(){
|
||||
while true;
|
||||
do
|
||||
eval $1
|
||||
eval $2
|
||||
done
|
||||
}
|
||||
|
||||
# Check that the directories of the main directory are updated git repos
|
||||
function git_updated() {
|
||||
local ROOT=`pwd`
|
||||
local gitstatus
|
||||
|
||||
for dir in `ls --color=none | grep -v Archive`
|
||||
do
|
||||
if [[ -d $dir ]]
|
||||
then
|
||||
cd $dir
|
||||
if [[ -d .git ]]
|
||||
then
|
||||
gitstatus="`git status -s | awk '{print $2}'`"
|
||||
cd $ROOT
|
||||
if [[ -n $gitstatus ]]
|
||||
then
|
||||
echo "- \033[0;31m$dir\033[0m:\n$gitstatus"
|
||||
fi
|
||||
else
|
||||
# Recursion at it's finest
|
||||
git_updated
|
||||
cd $ROOT
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# fzf functions
|
||||
## insert located file
|
||||
fzf-locate-widget() {
|
||||
local selected
|
||||
if selected=$(locate / | fzf -q "$LBUFFER"); then
|
||||
LBUFFER=$selected
|
||||
fi
|
||||
zle redisplay
|
||||
}
|
||||
zle -N fzf-locate-widget
|
||||
bindkey '\ei' fzf-locate-widget
|
||||
|
||||
## Git stuff
|
||||
# fco - checkout git branch/tag
|
||||
unalias gco
|
||||
gco() {
|
||||
local tags branches target
|
||||
tags=$(
|
||||
git tag | awk '{print "\x1b[31;1mtag\x1b[m\t" $1}') || return
|
||||
branches=$(
|
||||
git branch --all | grep -v HEAD |
|
||||
sed "s/.* //" | sed "s#remotes/[^/]*/##" |
|
||||
sort -u | awk '{print "\x1b[34;1mbranch\x1b[m\t" $1}') || return
|
||||
target=$(
|
||||
(echo "$tags"; echo "$branches") |
|
||||
fzf-tmux -l30 -- --no-hscroll --ansi +m -d "\t" -n 2) || return
|
||||
git checkout $(echo "$target" | awk '{print $2}')
|
||||
}
|
||||
|
||||
# warn_me about stuff at any time
|
||||
function warn_me (){
|
||||
echo "notify-send --urgency=critical \"$1\"" | at $2
|
||||
}
|
||||
|
||||
|
||||
# Kubectl functions
|
||||
function kube_dump_logs(){
|
||||
local deploy="$1"
|
||||
local namespace="$2"
|
||||
local time="$3"
|
||||
|
||||
if [[ -z "$deploy" ]]
|
||||
then
|
||||
echo "You must pass a kubernetes deployment as an argument."
|
||||
return 1
|
||||
fi
|
||||
if [[ -z "$time" ]]
|
||||
then
|
||||
time=1h
|
||||
fi
|
||||
|
||||
if [[ -z "$namespace" ]]
|
||||
then
|
||||
namespace_param="-n default"
|
||||
else
|
||||
namespace_param="-n $namespace"
|
||||
fi
|
||||
|
||||
mkdir -p "$deploy"
|
||||
|
||||
for pod in $(kube_get_deploy_pods $deploy $namespace)
|
||||
do
|
||||
echo Dumping "$pod" ...
|
||||
eval kubectl logs "$pod" --since="$time" "$namespace_param" > "$deploy"/"$pod"
|
||||
done
|
||||
echo "Dumped $deploy logs."
|
||||
}
|
||||
|
||||
function kube_get_deploy_pods(){
|
||||
local deploy="$1"
|
||||
local namespace="$2"
|
||||
|
||||
if [[ -z "$deploy" ]]
|
||||
then
|
||||
echo "You must pass a kubernetes deployment as an argument."
|
||||
return 1
|
||||
fi
|
||||
if [[ -z "$namespace" ]]
|
||||
then
|
||||
namespace="-n default"
|
||||
else
|
||||
namespace="-n $namespace"
|
||||
fi
|
||||
|
||||
eval kubectl get pods $namespace | grep "$deploy" | cut -d ' ' -f1
|
||||
}
|
||||
|
||||
# Crea un pod de debian si no existe y lo borra al terminar
|
||||
function kdebian(){
|
||||
echo "apt update; apt install -y curl" | xclip
|
||||
kubectl run --generator=run-pod/v1 -ti --rm debian --image=debian
|
||||
}
|
||||
|
||||
function kbash(){
|
||||
kubectl exec -ti $1 bash
|
||||
}
|
||||
|
||||
function ksh(){
|
||||
kubectl exec -ti $1 sh
|
||||
}
|
||||
|
||||
# Docker
|
||||
## Reveal
|
||||
function reveal () {
|
||||
function async ()
|
||||
{
|
||||
sleep 3 && xdg-open http:localhost:8000
|
||||
}
|
||||
async &!
|
||||
docker run -ti --name registry.daemons.it/reveal --rm -v `pwd`:/revealjs/files/ -p 127.0.0.1:8000:8000 revealjs
|
||||
}
|
||||
|
||||
## reveal-md
|
||||
function revealmd () {
|
||||
async () {
|
||||
sleep 3 && xdg-open http:localhost:1948/main.md
|
||||
}
|
||||
async &!
|
||||
docker run -ti --rm -v `pwd`:/revealjs/files/ -p 127.0.0.1:1948:1948 registry.daemons.it/reveal-md
|
||||
}
|
||||
|
||||
function nginx_this(){
|
||||
docker stop nginx_this &> /dev/null
|
||||
docker run -d --rm -v `pwd`:/usr/share/nginx/html --name nginx_this -p \
|
||||
127.0.0.1:2000:80 nginx:alpine
|
||||
# open browser
|
||||
firefox "http://127.0.0.1:2000"
|
||||
}
|
||||
|
||||
function promtool(){
|
||||
docker run -ti -v `pwd`:/data --entrypoint promtool --workdir /data prom/prometheus:v2.17.1 "$@"
|
||||
}
|
||||
|
||||
function kterm (){
|
||||
image=$1
|
||||
tag=$2
|
||||
if [[ -z $tag ]]
|
||||
then
|
||||
tag=latest
|
||||
fi
|
||||
kubectl run --generator=run-pod/v1 -ti --rm kterm --image=$image:$tag sh
|
||||
}
|
||||
|
||||
function dterm (){
|
||||
image=$1
|
||||
tag=$2
|
||||
if [[ -z $tag ]]
|
||||
then
|
||||
tag=latest
|
||||
fi
|
||||
bash_exists=$(docker run -ti $image:$tag sh -c "command -v bash")
|
||||
if [[ -n $bash_exists ]]
|
||||
then
|
||||
docker run -ti --network host $image:$tag bash
|
||||
else
|
||||
docker run -ti --network host $image:$tag sh
|
||||
fi
|
||||
}
|
||||
|
||||
function helmfile (){
|
||||
docker run -ti -v `pwd`:/data -w /data -v \
|
||||
$HOME/bin/helmify-kustomize:/usr/local/bin/helmify-kustomize:ro -v \
|
||||
$HOME/.kube:/root/.kube:ro -e \
|
||||
KUBECONFIG=/root/.kube/$(basename `echo $KUBECONFIG`) \
|
||||
quay.io/roboll/helmfile:helm3-v0.140.0 helmfile "$@"
|
||||
}
|
94
dotfiles/shells/.zshrc
Normal file
94
dotfiles/shells/.zshrc
Normal file
|
@ -0,0 +1,94 @@
|
|||
# Debug
|
||||
# set -x
|
||||
# zmodload zsh/zprof
|
||||
|
||||
# Ruta de oh-my-zsh
|
||||
export ZSH=$HOME/.oh-my-zsh
|
||||
|
||||
# Instala cosas
|
||||
if [[ ! -a ~/Instalados/zsh-interactive-cd ]]; then
|
||||
git clone https://github.com/changyuheng/zsh-interactive-cd ~/Instalados/zsh-interactive-cd
|
||||
fi
|
||||
|
||||
|
||||
# Modify path
|
||||
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/sbin:/sbin:/usr/local/bin"
|
||||
export PATH="$PATH:$HOME/bin/"
|
||||
export PATH="$PATH:$HOME/.bin/"
|
||||
export PATH="$PATH:$HOME/.local/bin"
|
||||
export PATH="$PATH:/$HOME/.emacs.d/bin/"
|
||||
export PATH="$PATH:/opt/go/bin"
|
||||
export PATH="$PATH:/opt/brew/bin/"
|
||||
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
||||
export GOPATH=/opt/go
|
||||
|
||||
# Cargar los programas instalados
|
||||
source $HOME/Instalados/zsh-interactive-cd/zsh-interactive-cd.plugin.zsh
|
||||
source /usr/share/z/z.sh
|
||||
# fzf: automatically selects the item if there's only one
|
||||
export FZF_CTRL_T_OPTS="--select-1 --exit-0"
|
||||
|
||||
# fzf The following example uses tree command to show the entries of the directory
|
||||
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
|
||||
|
||||
# Full command on preview window
|
||||
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
|
||||
|
||||
# Term
|
||||
export TERM="xterm-256color"
|
||||
|
||||
# Prompt ZSH
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
# No comprobar si hay actualizaciones
|
||||
DISABLE_AUTO_UPDATE="true"
|
||||
|
||||
# No corregir errores
|
||||
ENABLE_CORRECTION="false"
|
||||
|
||||
# Mostrar puntos rojos mientras se espera el completado
|
||||
COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Formato de tiempo
|
||||
HIST_STAMPS="dd/mm/yyyy"
|
||||
|
||||
# Plugins
|
||||
plugins=(git colored-man-pages ssh-agent daemons-aws gitfast ksp)
|
||||
|
||||
export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
# Usar oh-my-zsh
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# Por algún motivo...
|
||||
# https://github.com/ohmyzsh/ohmyzsh/issues/4607#issuecomment-510494971
|
||||
export FPATH="/usr/local/share/zsh/functions:$FPATH"
|
||||
|
||||
# Lenguaje
|
||||
export LANG=es_ES.UTF-8
|
||||
export LANGUAGE=es_ES.UTF-8
|
||||
export LC_ALL=es_ES.UTF-8
|
||||
|
||||
# Editor preferido
|
||||
export EDITOR="emacsclient -t -c"
|
||||
export ALTERNATE_EDITOR="vim"
|
||||
|
||||
# Python virtualenv
|
||||
export WORKON_HOME=$HOME/.virtualenvs
|
||||
|
||||
# Cosas de Systemd
|
||||
export XDG_RUNTIME_DIR="/run/user/$UID"
|
||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
|
||||
|
||||
# Arduino IDE path
|
||||
export ARDUINO_DIR=/opt/arduino-1.8.7
|
||||
|
||||
source $HOME/.functions
|
||||
source $HOME/.aliases
|
||||
source $HOME/.fzf.zsh
|
||||
|
||||
# No comprobar mails
|
||||
MAILCHECK=0
|
||||
|
||||
# Krew
|
||||
#
|
38
dotfiles/starship/.config/starship.toml
Normal file
38
dotfiles/starship/.config/starship.toml
Normal file
|
@ -0,0 +1,38 @@
|
|||
[battery]
|
||||
full_symbol = "🔋"
|
||||
charging_symbol = "⚡️"
|
||||
discharging_symbol = "💀"
|
||||
|
||||
[[battery.display]]
|
||||
threshold = 10
|
||||
style = "bold red"
|
||||
|
||||
[kubernetes]
|
||||
disabled = false
|
||||
|
||||
[terraform]
|
||||
disabled = true
|
||||
|
||||
[aws]
|
||||
symbol = " "
|
||||
|
||||
[docker_context]
|
||||
symbol = " "
|
||||
|
||||
[golang]
|
||||
symbol = " "
|
||||
|
||||
[java]
|
||||
symbol = " "
|
||||
|
||||
[nodejs]
|
||||
symbol = " "
|
||||
|
||||
[php]
|
||||
symbol = " "
|
||||
|
||||
[python]
|
||||
symbol = " "
|
||||
|
||||
[directory]
|
||||
truncation_length = 5
|
33
dotfiles/system-configuration/etc/backup.d/90.rdiff
Normal file
33
dotfiles/system-configuration/etc/backup.d/90.rdiff
Normal file
|
@ -0,0 +1,33 @@
|
|||
options = --force
|
||||
when = everyday at 02
|
||||
output_as_info = no
|
||||
[source]
|
||||
type = local
|
||||
keep = 60D
|
||||
|
||||
# files to include in the backup
|
||||
include = /etc
|
||||