Merge branch 'master' of frogit:geoffrey/dotfiles

This commit is contained in:
Geoffrey Frogeye 2017-09-16 17:24:25 +00:00
commit 75462e7e5d
64 changed files with 4520 additions and 1008 deletions

View file

@ -1,3 +1,3 @@
#include ".Xresources.d/xft" #include ".Xresources.d/xft"
#include ".Xresources.d/solarized.dark" #include ".Xresources.d/theme"
#include ".Xresources.d/xterm" #include ".Xresources.d/xterm"

View file

@ -1,56 +0,0 @@
#define S_base03 #002b36
#define S_base02 #073642
#define S_base01 #586e75
#define S_base00 #657b83
#define S_base0 #839496
#define S_base1 #93a1a1
#define S_base2 #eee8d5
#define S_base3 #fdf6e3
*background: S_base03
*foreground: S_base0
*fadeColor: S_base03
*cursorColor: S_base1
*pointerColorBackground:S_base01
*pointerColorForeground:S_base1
#define S_yellow #b58900
#define S_orange #cb4b16
#define S_red #dc322f
#define S_magenta #d33682
#define S_violet #6c71c4
#define S_blue #268bd2
#define S_cyan #2aa198
#define S_green #859900
!! black dark/light
*color0: S_base02
*color8: S_base03
!! red dark/light
*color1: S_red
*color9: S_orange
!! green dark/light
*color2: S_green
*color10: S_base01
!! yellow dark/light
*color3: S_yellow
*color11: S_base00
!! blue dark/light
*color4: S_blue
*color12: S_base0
!! magenta dark/light
*color5: S_magenta
*color13: S_violet
!! cyan dark/light
*color6: S_cyan
*color14: S_base1
!! white dark/light
*color7: S_base2
*color15: S_base3

View file

@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
wget "https://raw.githubusercontent.com/solarized/xresources/master/Xresources.light" -O solarized.light
wget "https://raw.githubusercontent.com/solarized/xresources/master/Xresources.dark" -O solarized.dark
mkdir -p $HOME/.local/share/fonts mkdir -p $HOME/.local/share/fonts
echo $(for i in "" "%20Bold" "%20Oblique" "%20Bold%20Oblique"; do echo $(for i in "" "%20Bold" "%20Oblique" "%20Bold%20Oblique"; do
cd $HOME/.local/share/fonts cd $HOME/.local/share/fonts

View file

@ -1,56 +0,0 @@
#define S_base03 #002b36
#define S_base02 #073642
#define S_base01 #586e75
#define S_base00 #657b83
#define S_base0 #839496
#define S_base1 #93a1a1
#define S_base2 #eee8d5
#define S_base3 #fdf6e3
*background: S_base03
*foreground: S_base0
*fadeColor: S_base03
*cursorColor: S_base1
*pointerColorBackground:S_base01
*pointerColorForeground:S_base1
#define S_yellow #b58900
#define S_orange #cb4b16
#define S_red #dc322f
#define S_magenta #d33682
#define S_violet #6c71c4
#define S_blue #268bd2
#define S_cyan #2aa198
#define S_green #859900
!! black dark/light
*color0: S_base02
*color8: S_base03
!! red dark/light
*color1: S_red
*color9: S_orange
!! green dark/light
*color2: S_green
*color10: S_base01
!! yellow dark/light
*color3: S_yellow
*color11: S_base00
!! blue dark/light
*color4: S_blue
*color12: S_base0
!! magenta dark/light
*color5: S_magenta
*color13: S_violet
!! cyan dark/light
*color6: S_cyan
*color14: S_base1
!! white dark/light
*color7: S_base2
*color15: S_base3

View file

@ -1,56 +0,0 @@
#define S_base03 #002b36
#define S_base02 #073642
#define S_base01 #586e75
#define S_base00 #657b83
#define S_base0 #839496
#define S_base1 #93a1a1
#define S_base2 #eee8d5
#define S_base3 #fdf6e3
*background: S_base3
*foreground: S_base00
*fadeColor: S_base3
*cursorColor: S_base01
*pointerColorBackground:S_base1
*pointerColorForeground:S_base01
#define S_yellow #b58900
#define S_orange #cb4b16
#define S_red #dc322f
#define S_magenta #d33682
#define S_violet #6c71c4
#define S_blue #268bd2
#define S_cyan #2aa198
#define S_green #859900
!! black dark/light
*color0: S_base02
*color8: S_base03
!! red dark/light
*color1: S_red
*color9: S_orange
!! green dark/light
*color2: S_green
*color10: S_base01
!! yellow dark/light
*color3: S_yellow
*color11: S_base00
!! blue dark/light
*color4: S_blue
*color12: S_base0
!! magenta dark/light
*color5: S_magenta
*color13: S_violet
!! cyan dark/light
*color6: S_cyan
*color14: S_base1
!! white dark/light
*color7: S_base2
*color15: S_base3

36
Xresources.d/theme Normal file
View file

@ -0,0 +1,36 @@
! special
*.foreground: #f1ebeb
*.background: #272822
*.cursorColor: #f1ebeb
! black
*.color0: #48483e
*.color8: #76715e
! red
*.color1: #dc2566
*.color9: #fa2772
! green
*.color2: #8fc029
*.color10: #a7e22e
! yellow
*.color3: #d4c96e
*.color11: #e7db75
! blue
*.color4: #55bcce
*.color12: #66d9ee
! magenta
*.color5: #9358fe
*.color13: #ae82ff
! cyan
*.color6: #56b7a5
*.color14: #66efd5
! white
*.color7: #acada1
*.color15: #cfd0c2

View file

@ -10,3 +10,6 @@ xterm*rightScrollBar: false
xterm*jumpScroll: true xterm*jumpScroll: true
xterm*multiScroll: true xterm*multiScroll: true
xterm*toolBar: false xterm*toolBar: false
XTerm.vt100.translations: #override \n\
Ctrl Shift <Key>C: copy-selection(CLIPBOARD) \n\
Ctrl Shift <Key>V: insert-selection(CLIPBOARD)

218
bashrc
View file

@ -1,55 +1,79 @@
# Custom scripts #
# ~/.bashrc
#
# ENVIRONMENT VARIABLES
# Region preferences
export LANG=fr_FR.utf8
export TZ=/usr/share/zoneinfo/Europe/Paris
#find ~/.scripts/ ~/.gscripts/ -type f -name "*.sh" | while read script; do # Favourite commands
#source "$script"
#done
[ -f ~/.scripts/index.sh ] && source ~/.scripts/index.sh
[ -f ~/.gscripts/index.sh ] && source ~/.gscripts/index.sh
# Prompt
if [[ $USER == 'root' ]]; then
col=31;
elif [[ -n $ME ]]; then # $ME is a var set by my private config that is not empty if it is my account (and not a system account e.g. `git`)
col=32;
else
col=33;
fi
export USER=$(whoami)
PS1="\[\e]2;\u@\h \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
PS2="> "
PS3="+ "
PS4="- "
# Vars
export PAGER=less export PAGER=less
export EDITOR=vim export EDITOR=vim
export VISUAL=vim export VISUAL=vim
export BROWSER=/usr/bin/qutebrowser export BROWSER=qutebrowser
export TZ=/usr/share/zoneinfo/Europe/Paris
export PATH="$PATH:$HOME/.gem/ruby/2.3.0/bin/" # Some programs need those changes
export LANG=fr_FR.utf8 export PATH="/usr/lib/ccache/bin/:$PATH"
export HISTSIZE=10000 if [ -d $HOME/.gem/ruby/2.4.0/bin ]; then
export HISTFILESIZE=${HISTSIZE} export PATH="$HOME/.gem/ruby/2.4.0/bin/:$PATH"
export HISTCONTROL=ignoreboth fi
#export PATH="$(echo "$PATH" | sed 's|:|\n|g' | sort | uniq | tr '\n' ':' | sed 's|:$||')"
export JAVA_FONTS=/usr/share/fonts/TTF export JAVA_FONTS=/usr/share/fonts/TTF
export ANDROID_HOME=/opt/android-sdk export ANDROID_HOME=/opt/android-sdk
export GOPATH=$HOME/.go export GOPATH=$HOME/.go
export PATH=$GOPATH/bin:$PATH
export XDG_CONFIG_HOME=$HOME/.config
export ARDUINO=/usr/share/arduino
export ARDUINO_DIR=$ARDUINO
export ARDMK_VENDOR=archlinux-arduino
if [ -z $XDG_CONFIG_HOME ]; then # ALIASES
export XDG_CONFIG_HOME=$HOME/.config
# Completion for existing commands
export LS_OPTIONS='--group-directories-first --time-style=+"%d/%m/%Y %H:%M:%S" --color=auto --file-type --human-readable'
alias ls="ls $LS_OPTIONS"
alias grep='grep --color=tty -d skip'
alias mkdir='mkdir -v'
alias cp="cp -i"
alias mv="mv -iv"
alias dd='dd status=progress'
alias rm='rm -Iv --one-file-system'
alias free='free -m'
alias df='df -h'
alias pacman='pacman --color auto'
alias dmesg='dmesg --ctime'
# Frequent mistakes
alias systemclt=systemctl
# Shortcuts for commonly used commands
alias ll="ls -l $LS_OPTIONS"
alias la="ls -la $LS_OPTIONS"
alias al=sl
alias x='startx; logout'
alias s='sudo -s -E'
alias po='eval $(proxy off)'
alias nw="sudo systemctl restart NetworkManager"
alias mc="machines"
alias tracefiles="strace -f -t -e trace=file"
alias vpn="sudo systemctl start openvpn-client@$HOSTNAME"
alias vpno="sudo systemctl stop openvpn-client@$HOSTNAME"
alias vpns="sudo systemctl status openvpn-client@$HOSTNAME"
alias vpnr="sudo systemctl restart openvpn-client@$HOSTNAME"
# Superseding commands with better ones if they are present
if which vim &> /dev/null; then
alias vi='vim'
fi
if which gopass &> /dev/null; then
alias pass='gopass'
fi
if which wakeonlan &> /dev/null; then
alias wol='wakeonlan'
fi fi
# Tweaks # SHELL CUSTOMIZATION
[[ $- != *i* ]] && return
if [ -f /etc/bash_completion ]; then . /etc/bash_completion; fi
xhost +local:root > /dev/null 2>&1
complete -cf sudo complete -cf sudo
@ -62,78 +86,60 @@ shopt -s extglob
shopt -s histappend shopt -s histappend
shopt -s hostcomplete shopt -s hostcomplete
export LS_OPTIONS='--group-directories-first --time-style=+"%d/%m/%Y %H:%M" --color=auto --classify --human-readable' export HISTSIZE=100000
alias ls="ls $LS_OPTIONS" export HISTFILESIZE=${HISTSIZE}
alias ll="ls -l $LS_OPTIONS" export HISTCONTROL=ignoreboth
alias la="ls -la $LS_OPTIONS"
alias al=sl
alias grep='grep --color=tty -d skip'
alias mkdir='mkdir -v'
alias cp="cp -i"
alias mv="mv -iv"
alias dd='dd status=progress'
alias rm='rm -Iv --one-file-system'
alias free='free -m'
alias df='df -h'
alias 49.3='sudo'
alias pacman='pacman --color auto'
alias x='startx; logout'
alias s='sudo -s -E'
# Solarized theme for tty, the dark version. # PROMPT CUSTOMIZATION
# Based on:
# - Solarized (http://ethanschoonover.com/solarized) if [[ $USER == 'root' ]]; then
# - Xresources from http://github.com/altercation/solarized col=31;
# Generated with pty2tty.awk by Joep van Delft elif [[ $USER == 'geoffrey' || $USER == 'gbontoux' || $USER == 'gpreud' ]]; then
# http://github.com/joepvd/tty-solarized col=32;
if [ "$TERM" = "linux" ]; then else
echo -en "\e]PB657b83" # S_base00 col=33;
echo -en "\e]PA586e75" # S_base01
echo -en "\e]P0073642" # S_base02
echo -en "\e]P62aa198" # S_cyan
echo -en "\e]P8002b36" # S_base03
echo -en "\e]P2859900" # S_green
echo -en "\e]P5d33682" # S_magenta
echo -en "\e]P1dc322f" # S_red
echo -en "\e]PC839496" # S_base0
echo -en "\e]PE93a1a1" # S_base1
echo -en "\e]P9cb4b16" # S_orange
echo -en "\e]P7eee8d5" # S_base2
echo -en "\e]P4268bd2" # S_blue
echo -en "\e]P3b58900" # S_yellow
echo -en "\e]PFfdf6e3" # S_base3
echo -en "\e]PD6c71c4" # S_violet
clear # against bg artifacts
fi fi
export PS1="\[\e]2;\u@\h \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
export PS2="> "
export PS3="+ "
export PS4="- "
# Utils # CUSTOM SCRIPTS
alias fuck='eval $(thefuck $(fc -ln -1))'
export PATH="$HOME/.bin/:$HOME/.scripts/:$PATH"
[ -f ~/.gscripts/gprofile ] && source ~/.gscripts/gprofile
# UTILITIES
# Bash completion
[ -f /etc/bash_completion ] && . /etc/bash_completion
# Bad day mood-saver
function fuck {
if which thefuck &> /dev/null
then
eval $(thefuck --alias)
fuck $@
else
echo "thefuck is not installed on this system."
fi
}
alias FUCK='fuck' alias FUCK='fuck'
# Command not found # Node Version Manager
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash function nvm {
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh export NVM_DIR="$HOME/.nvm"
if [ -s "$NVM_DIR/nvm.sh" ]
# Functions then
function clean { . "$NVM_DIR/nvm.sh"
find . -type d -name bower_components -or -name node_modules -print0 | while read file; do [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
rm -rf "$file" nvm $@
done else
find . -type f -name Makefile -print0 | while IFS= read -r -d '' file; do echo "NVM is not installed on this system."
echo "--> $file" fi
(cd "${file//Makefile}"; make clean)
done
find . -type d -name .git -print0 | while IFS= read -r -d '' dir; do
echo "--> $file"
(cd "$dir"; git gc)
done
} }
function dafont { # Command not found handlers
wget "http://dl.dafont.com/dl/?f=$1" -O /tmp/dafont.zip [ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash # Arch
unzip /tmp/dafont.zip -d ~/.local/share/fonts -x *.txt [ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh # Arch (alternative, for Manjaro mostly)
rm -rf /tmp/dafont.zip
}
alias nw="sudo systemctl restart NetworkManager"

2
bin/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

View file

@ -1,15 +1,15 @@
# Beware! This file is rewritten by htop when settings are changed in the interface. # Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly. # The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 40 2 46 47 49 1 fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46 sort_key=47
sort_direction=1 sort_direction=1
hide_threads=0 hide_threads=0
hide_kernel_threads=0 hide_kernel_threads=1
hide_userland_threads=0 hide_userland_threads=1
shadow_other_users=0 shadow_other_users=0
show_thread_names=0 show_thread_names=0
show_program_path=1 show_program_path=0
highlight_base_name=0 highlight_base_name=1
highlight_megabytes=0 highlight_megabytes=0
highlight_threads=1 highlight_threads=1
tree_view=0 tree_view=0

10
config/i3/autorandrdefaultmenu Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
shopt -s nullglob globstar
profile=$(echo -e "$(autorandr 2>&1 | cut -d' ' -f1)" | ~/.config/i3/dmenu_cmd -p "Default profile" "$@")
[[ -n $profile ]] || exit
autorandr --default "$profile"

10
config/i3/autorandrloadmenu Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
shopt -s nullglob globstar
profile=$(echo -e "common\nhorizontal\nvertical\n$(autorandr 2>&1 | cut -d' ' -f1)" | ~/.config/i3/dmenu_cmd -p "Load profile" "$@")
[[ -n $profile ]] || exit
autorandr --load "$profile"

10
config/i3/autorandrremovemenu Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
shopt -s nullglob globstar
profile=$(echo -e "$(autorandr 2>&1 | cut -d' ' -f1)" | ~/.config/i3/dmenu_cmd -p "Remove profile" "$@")
[[ -n $profile ]] || exit
autorandr --remove "$profile"

10
config/i3/autorandrsavemenu Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
shopt -s nullglob globstar
profile=$(echo -e "$(autorandr 2>&1 | cut -d' ' -f1)" | ~/.config/i3/dmenu_cmd -p "Save profile" "$@")
[[ -n $profile ]] || exit
autorandr --save "$profile"

View file

@ -22,6 +22,7 @@ hide_edge_borders both
# Font for window titles. Will also be used by the bar unless a different font # Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below. # is used in the bar {} block below.
font pango:Source Code Pro 8
font pango:DejaVu Sans Mono 8 font pango:DejaVu Sans Mono 8
font pango:Sans 8 font pango:Sans 8
@ -38,7 +39,7 @@ bindsym $mod+F2 exec --no-startup-id ~/.config/i3/dmenu_run
bindsym Mod1+F2 exec --no-startup-id ~/.config/i3/dmenu_run bindsym Mod1+F2 exec --no-startup-id ~/.config/i3/dmenu_run
bindsym $mod+c exec --no-startup-id ~/.config/i3/passmenu bindsym $mod+c exec --no-startup-id ~/.config/i3/passmenu
bindsym $mod+x exec --no-startup-id ~/.config/i3/clipmenu #bindsym $mod+x exec --no-startup-id ~/.config/i3/clipmenu
bindsym $mod+asterisk exec --no-startup-id ~/.config/i3/sshmenu bindsym $mod+asterisk exec --no-startup-id ~/.config/i3/sshmenu
bindsym $mod+dollar exec --no-startup-id ~/.config/i3/sshmenu root bindsym $mod+dollar exec --no-startup-id ~/.config/i3/sshmenu root
@ -51,7 +52,7 @@ set $up_bar killall -USR1 i3status
# Start Applications # Start Applications
bindsym $mod+Return exec xterm bindsym $mod+Return exec xterm
bindsym $mod+p exec thunar bindsym $mod+p exec thunar
bindsym $mod+m exec qutebrowser bindsym $mod+m exec qutebrowser --override-restore --backend=webengine
# Volume control # Volume control
#bindsym XF86AudioRaiseVolume exec amixer -q set Master 5+ unmute; exec $up_bar #bindsym XF86AudioRaiseVolume exec amixer -q set Master 5+ unmute; exec $up_bar
@ -102,7 +103,7 @@ bindsym $mod+Shift+l move right
#bindsym $mod+Shift+Right move right #bindsym $mod+Shift+Right move right
# workspace back and forth (with/without active container) # workspace back and forth (with/without active container)
workspace_auto_back_and_forth yes workspace_auto_back_and_forth no
bindsym $mod+b workspace back_and_forth bindsym $mod+b workspace back_and_forth
bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth
@ -133,16 +134,16 @@ bindsym $mod+a focus parent
bindsym $mod+q focus child bindsym $mod+q focus child
# Workspace names # Workspace names
set $WS1 1 Édition set $WS1 1
set $WS2 2 Éxecution set $WS2 2
set $WS3 3 Organisation set $WS3 3
set $WS4 4 Référence set $WS4 4
set $WS5 5 Divers 1 set $WS5 5
set $WS6 6 Divers 2 set $WS6 6
set $WS7 7 Contact set $WS7 7
set $WS8 8 Social set $WS8 8
set $WS9 9 Veille set $WS9 9
set $WS10 10 Musique set $WS10 10
# Workspace output # Workspace output
workspace "$WS1" output LVDS1 workspace "$WS1" output LVDS1
@ -301,66 +302,55 @@ mode "Resize" {
bindsym $mod+r mode "Resize" bindsym $mod+r mode "Resize"
set $background exec --no-startup-id feh --bg-fill $HOME/.config/i3/bg.jpg set $mode_screen Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default
bindsym $mod+Shift+a $background bindsym $mod+t mode "$mode_screen"
set $mode_screen_select [V] VGA1 [H] HDMI1 mode "$mode_screen" {
mode "$mode_screen_select" { bindsym a exec autorandr --change --force, mode "default"
bindsym v mode "$mode_screen_VGA1" bindsym l exec ~/.config/i3/autorandrloadmenu, mode "default"
bindsym h mode "$mode_screen_HDMI1" bindsym s exec ~/.config/i3/autorandrsavemenu, mode "default"
bindsym r exec ~/.config/i3/autorandrremovemenu, mode "default"
# back to normal: Enter or Escape bindsym d exec ~/.config/i3/autorandrdefaultmenu, mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+t mode "$mode_screen_select"
set $mode_screen_VGA1 VGA [R] Right [L] Left [U] Up [D] Down [C] Copy [O] Off
mode "$mode_screen_VGA1" {
bindsym r exec xrandr --output VGA1 --auto --right-of LVDS1; $background
bindsym l exec xrandr --output VGA1 --auto --left-of LVDS1; $background
bindsym u exec xrandr --output VGA1 --auto --above LVDS1; $background
bindsym d exec xrandr --output VGA1 --auto --below LVDS1; $background
bindsym c exec xrandr --output VGA1 --auto --same-as LVDS1; $background
bindsym o exec xrandr --output VGA1 --auto --off; $background
# back to normal: Enter or Escape # back to normal: Enter or Escape
bindsym Return mode "default" bindsym Return mode "default"
bindsym Escape mode "default" bindsym Escape mode "default"
} }
set $mode_screen_HDMI1 HDMI [R] Right [L] Left [U] Up [D] Down [C] Copy [O] Off # Screen temperature ("redness") setting
mode "$mode_screen_HDMI1" { bindsym $mod+y mode "$mode_temp"
bindsym r exec xrandr --output HDMI1 --auto --right-of LVDS1; $background set $mode_temp Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue
bindsym l exec xrandr --output HDMI1 --auto --left-of LVDS1; $background mode "$mode_temp" {
bindsym u exec xrandr --output HDMI1 --auto --above LVDS1; $background bindsym r exec sct 1000
bindsym d exec xrandr --output HDMI1 --auto --below LVDS1; $background bindsym d exec sct 2000
bindsym c exec xrandr --output HDMI1 --auto --same-as LVDS1; $background bindsym c exec sct 4500
bindsym o exec xrandr --output HDMI1 --auto --off; $background bindsym o exec sct
bindsym a exec sct 8000
bindsym b exec sct 10000
# back to normal: Enter or Escape # back to normal: Enter or Escape
bindsym Return mode "default" bindsym Return mode "default"
bindsym Escape mode "default" bindsym Escape mode "default"
} }
# Start i3bar to display a workspace bar (plus the system information i3status if available) # Colors
bar { set $bg #272822
#i3bar_command ~/.config/lemonbar/i3_lemonbar.sh set $fg #f1ebeb
mode hide set $00 #48483e
status_command i3status set $01 #dc2566
# wheel_up_cmd nop set $02 #8fc029
# wheel_down_cmd nop set $03 #d4c96e
font pango:DejaVu Sans Mono 9 set $04 #55bcce
font pango:Sans 8 set $05 #9358fe
colors { set $06 #56b7a5
separator #4E9C00 set $07 #acada1
background #333333 set $08 #76715e
statusline #FFFFFF set $09 #fa2772
focused_workspace #4E9C00 #4E9C00 #FFFFFF set $10 #a7e22e
active_workspace #333333 #333333 #FFFFFF set $11 #e7db75
inactive_workspace #333333 #222222 #888888 set $12 #66d9ee
urgent_workspace #C20000 #C20000 #FFFFFF set $13 #ae82ff
} set $14 #66efd5
} set $15 #cfd0c2
# Inactivity settings # Inactivity settings
exec --no-startup-id xautolock -time 10 -locker 'xset dpms force standby' -killtime 1 -killer '$locker' exec --no-startup-id xautolock -time 10 -locker 'xset dpms force standby' -killtime 1 -killer '$locker'
@ -369,26 +359,26 @@ bindsym $mod+F5 exec --no-startup-id xautolock -enable
# Autostart applications # Autostart applications
$background exec --no-startup-id autorandr --change # Screen configuration and everything that depends on it
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 # Password remembering exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 # Password remembering
exec --no-startup-id gnome-keyring-daemon # Password remembering exec --no-startup-id gnome-keyring-daemon # Password remembering
exec --no-startup-id numlockx on # Activate Num lock exec --no-startup-id numlockx on # Activate Num lock
#exec --no-startup-id nm-applet # Network manager tray icon #exec --no-startup-id nm-applet # Network manager tray icon
#exec --no-startup-id compton -b # Compositing manager #exec --no-startup-id compton -b # Compositing manager
#exec --no-startup-id conky -c $HOME/.conky/status # Desktop widget
exec --no-startup-id unclutter # Hide mouse cursor after some time exec --no-startup-id unclutter # Hide mouse cursor after some time
exec --no-startup-id dunst # Notifications exec --no-startup-id dunst # Notifications
exec --no-startup-id $HOME/.config/i3/clipmenud # Clipboard manager exec --no-startup-id keynav # Keyboard cursor controller
#exec --no-startup-id $HOME/.config/i3/clipmenud # Clipboard manager
exec --no-startup-id mpd # Music Player Daemon
# Autostart programs set $ignore #ff00000
#exec --no-startup-id i3-msg 'workspace $WS8; exec firefox --new-window tweetdeck.twitter.com'
#exec --no-startup-id i3-msg 'workspace $WS9; exec firefox --new-window rss.frogeye.fr'
#exec --no-startup-id clementine
#exec --no-startup-id evolution
#exec --no-startup-id pidgin
# Theme colors # Theme colors
client.focused #4E9C00 #4E9C00 #FFFFFF #FFFFFF # class border backgr. text indicator child_border
client.focused_inactive #1B3600 #1B3600 #888888 #FFFFFF client.focused $02 $02 $bg $07 $10
client.unfocused #333333 #333333 #888888 #FFFFFF client.focused_inactive $03 $03 $08 $15 $14
client.urgent #C20000 #C20000 #FFFFFF #FFFFFF client.unfocused $08 $08 $fg $11 $00
client.urgent $01 $01 $fg $05 $09
client.placeholder $ignore $06 $fg $ignore $14
client.background $15

View file

@ -1,2 +1,2 @@
#!/bin/sh #!/bin/sh
dmenu -fn 'DejaVu Sans Mono-10' -nb '#222222' -nf '#888888' -sb '#4E9C00' -sf '#FFFFFF' -l 8 -f -i -h 19 "$@" dmenu -fn 'DejaVu Sans Mono-10' -nb '#48483e' -nf '#f1ebeb' -sb '#8fc029' -sf '#272822' -l 8 -f -i -h 19 "$@"

View file

@ -7,6 +7,6 @@ if [ $? -ne 0 ]; then
} }
trap revert SIGHUP SIGINT SIGTERM trap revert SIGHUP SIGINT SIGTERM
xset dpms 5 5 5 xset dpms 5 5 5
i3lock --nofork --color 648901 --ignore-empty-password i3lock --nofork --color 648901 --image=$HOME/.config/i3/lock.png --tiling --ignore-empty-password
revert revert
fi fi

BIN
config/i3/lock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

1
config/i3/lock.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" height="50" width="50"><path fill="#82a401" d="M0 50h50V0H0z"/><path d="M0 0l50 50H25L0 25zm50 0v25L25 0z" fill="#466c01"/></svg>

After

Width:  |  Height:  |  Size: 189 B

View file

@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
if [ "$1" == 'root' ]; then if [ "$1" == 'root' ]; then
a=" (root)" a=" (root)"
b="sudo -E " b="-t 'sudo -s'"
fi fi
machine=$(cat ~/.ssh/config | grep '^Host ' | cut -d ' ' -f 2 | grep -v '*' | sort | $HOME/.config/i3/dmenu_cmd -p "SSH$a to ") machine=$(cat ~/.ssh/config | grep '^Host ' | cut -d ' ' -f 2 | grep -v '*' | sort | $HOME/.config/i3/dmenu_cmd -p "SSH$a to ")
if [ ! -z $machine ]; then if [ ! -z $machine ]; then
xterm -e "ssh $machine -t '${b}bash --login'" xterm -e "ssh $machine $b"
fi fi

View file

@ -36,7 +36,7 @@ ethernet eth0 {
ethernet usb0 { ethernet usb0 {
# if you use %speed, i3status requires the cap_net_admin capability # if you use %speed, i3status requires the cap_net_admin capability
format_up = " %ip" format_up = " %ip"
format_down = "" format_down = "📱"
} }
cpu_usage { cpu_usage {
@ -56,11 +56,11 @@ battery 0 {
path_exists VPN { path_exists VPN {
# path exists when a VPN tunnel launched by nmcli/nm-applet is active # path exists when a VPN tunnel launched by nmcli/nm-applet is active
path = "/proc/sys/net/ipv4/conf/tun0" path = "/proc/sys/net/ipv4/conf/tun0"
format = "" format = "🔐"
} }
tztime local { tztime local {
format = "%d/%m/%Y %H:%M:%S" format = "🕘 %d/%m/%Y %H:%M:%S"
timezone = "Europe/Paris" timezone = "Europe/Paris"
} }
@ -76,8 +76,8 @@ disk "/home" {
format = " %avail / %total" format = " %avail / %total"
} }
volume master { volume master {
format = " %volume" format = "🔈 %volume"
format_muted = " %volume" format_muted = "🔇 %volume"
device = "default" device = "default"
mixer = "Master" mixer = "Master"
mixer_idx = 0 mixer_idx = 0

24
config/linuxColors.sh Normal file
View file

@ -0,0 +1,24 @@
#!/bin/sh
if [ "$TERM" = "linux" ]; then
/bin/echo -e "
\e]P048483e
\e]P1dc2566
\e]P28fc029
\e]P3d4c96e
\e]P455bcce
\e]P59358fe
\e]P656b7a5
\e]P7acada1
\e]P876715e
\e]P9fa2772
\e]PAa7e22e
\e]PBe7db75
\e]PC66d9ee
\e]PDae82ff
\e]PE66efd5
\e]PFcfd0c2
"
# get rid of artifacts
clear
fi

342
config/polybar/config Normal file
View file

@ -0,0 +1,342 @@
;=====================================================
;
; To learn more about how to configure Polybar
; go to https://github.com/jaagr/polybar
;
; The README contains alot of information
;
;=====================================================
[theme]
foreground = #f1ebeb
background = #272822
blackB = #48483e
blackF = #76715e
redB = #dc2566
redF = #fa2772
greenB = #8fc029
greenF = #a7e22e
yellowB = #d4c96e
yellowF = #e7db75
blueB = #55bcce
blueF = #66d9ee
magentaB = #9358fe
magentaF = #ae82ff
cyanB = #56b7a5
cyanF = #66efd5
whiteB = #acada1
whiteF = #cfd0c2
[colors]
background = ${theme.blackB}
foreground = ${theme.foreground}
[bar/base]
monitor = ${env:display:LVDS1}
width = 100%
height = 20
fixed-center = false
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 0
border-size = 0
border-color = ${colors.background}
padding-left = 2
padding-right = 2
module-margin-left = 1
module-margin-right = 1
font-0 = "Font Awesome:size=10;0"
font-1 = "DejaVu Sans:size=10;0"
font-2 = "DejaVu Sans Mono for Powerline:pixelsize=10;0"
modules-left = i3
;wm-restack = bspwm
wm-restack = i3
;override-redirect = true
;scroll-up = bspwm-desknext
;scroll-down = bspwm-deskprev
;scroll-up = i3wm-wsnext
;scroll-down = i3wm-wsprev
bottom = true
enable-ipc = true
[bar/primary]
inherit = bar/base
modules-right = cpu memory temperature eth wlan xbacklight volume battery date
tray-position = right
tray-padding = 2
tray-transparent = false
[bar/secondary]
inherit = bar/base
modules-center = mpd
modules-right = ethMore wlanMore filesystem xbacklight volume date
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
mount-1 = /home
label-mounted-foreground = ${theme.magentaB}
label-mounted = %{F#ae81ff}%mountpoint%%{F-} %free%
label-unmounted =
[module/i3]
type = internal/i3
pin-workspaces = true
strip-wsnumbers = false
index-sort = true
enable-click = true
enable-scroll = true
wrapping-scroll = false
reverse-scroll = true
fuzzy-match = false
ws-icon-0 = "1;"
ws-icon-1 = "2;"
ws-icon-2 = "3;"
ws-icon-3 = "4;"
ws-icon-4 = "5;▲"
ws-icon-5 = "6;▲"
ws-icon-6 = "7;"
ws-icon-7 = "8;"
ws-icon-8 = "9;"
ws-icon-9 = "10;"
ws-icon-default = ?
format = <label-state> <label-mode>
label-mode = %mode%
label-mode-padding = 2
label-mode-background = ${theme.redB}
label-focused = %index% %icon%
label-focused-foreground = ${theme.background}
label-focused-background = ${theme.greenB}
label-focused-padding = 2
label-unfocused = ${self.label-focused}
label-unfocused-padding = ${self.label-focused-padding}
label-visible = ${self.label-focused}
label-visible-padding = ${self.label-focused-padding}
label-visible-foreground = ${theme.greenF}
label-urgent = ${self.label-focused}
label-urgent-padding = ${self.label-focused-padding}
label-urgent-foreground = ${theme.foreground}
label-urgent-background = ${theme.redB}
[module/mpd]
type = internal/mpd
; format-online = <icon-prev> <icon-seekb> <icon-stop> <toggle> <icon-seekf> <icon-next> <icon-repeat> <icon-random> <bar-progress> <label-time> <label-song>
format-online = <icon-prev> <icon-seekb> <icon-stop> <toggle> <icon-seekf> <icon-next> <icon-repeat> <icon-random> <label-time> <label-song>
format-playing = ${self.format-online}
format-paused = ${self.format-online}
format-stopped = <toggle>
label-song =  %title% - %artist%
label-song-maxlen = 35
label-song-ellipsis = true
label-time = %elapsed%/%total%
label-offline =
icon-play = 
icon-pause = 
icon-stop = 
icon-prev = 
icon-next = 
icon-seekb = 
icon-seekf = 
icon-random = 
icon-repeat = 
icon-repeatone = 1
toggle-on-foreground = ${theme.foreground}
toggle-off-foreground = #55
[module/xbacklight]
type = internal/xbacklight
output = ${env:display:LVDS1}
enable-scroll = true
format = <ramp>
ramp-0 = 🌕
ramp-1 = 🌔
ramp-2 = 🌓
ramp-3 = 🌒
ramp-4 = 🌑
format-foreground = ${theme.redF}
[module/backlight-acpi]
inherit = module/xbacklight
type = internal/backlight
card = intel_backlight
[module/cpu]
type = internal/cpu
interval = 0.5
format = <ramp-coreload>
format-foreground = ${theme.redF}
ramp-coreload-0 = ▁
ramp-coreload-1 = ▂
ramp-coreload-2 = ▃
ramp-coreload-3 = ▄
ramp-coreload-4 = ▅
ramp-coreload-5 = ▆
ramp-coreload-6 = ▇
ramp-coreload-7 = █
[module/memory]
type = internal/memory
interval = 2
format-foreground = ${theme.greenF}
label =  %gb_free%
[module/eth]
type = internal/network
interface = ${env:ethI:eth0}
interval = 1
format-connected =  <label-connected>
label-connected = %local_ip%
format-connected-foreground = ${theme.blueF}
format-disconnected =
[module/ethMore]
inherit = module/eth
label-connected = ↑%upspeed% ↓%downspeed%
[module/wlan]
type = internal/network
interface = ${env:wlanI:wlan0}
interval = 1
format-connected = <ramp-signal> <label-connected>
label-connected = %local_ip% %essid%
format-connected-foreground = ${theme.cyanF}
format-disconnected =
ramp-signal-0 = ▁
ramp-signal-1 = ▂
ramp-signal-2 = ▃
ramp-signal-3 = ▄
ramp-signal-4 = ▅
ramp-signal-5 = ▆
ramp-signal-6 = ▇
ramp-signal-7 = █
animation-packetloss-0 = 
animation-packetloss-1 = 
animation-packetloss-framerate = 500
[module/wlanMore]
inherit = module/wlan
label-connected = ↑%upspeed% ↓%downspeed%
[module/date]
type = internal/date
interval = 1
date = " %d/%m/%Y"
time =  %H:%M:%S
format = <label>
format-foreground = ${theme.cyanF}
label = %date% %time%
[module/volume]
type = internal/volume
master-soundcard = default
format-volume = <ramp-volume> <label-volume>
format-volume-foreground = ${theme.greenF}
label-muted = 
label-muted-foreground = #66
format-muted-foreground = ${self.format-volume-foreground}
ramp-volume-0 = 
ramp-volume-1 = 
ramp-volume-2 = 
[module/battery]
type = internal/battery
battery = BAT0
adapter = ADP0
full-at = 100
time-format = %H:%M
label-full = 
format-charging = <ramp-capacity> <label-charging>
format-charging-foreground = ${theme.yellowF}
label-charging = %percentage%% (%time%)
format-discharging = <ramp-capacity> <label-discharging>
format-discharging-foreground = ${self.format-charging-foreground}
format-discharging-background = ${theme.redB}
label-discharging = %percentage%% (%time%)
format-full-prefix = " "
format-full-foreground = ${self.format-charging-foreground}
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
[module/temperature]
type = internal/temperature
thermal-zone = 2
warn-temperature = 70
format = <ramp> <label>
format-foreground = ${theme.yellowB}
label = %temperature%
format-warn = <ramp> <label-warn>
format-warn-foreground = ${self.format-foreground}
format-warn-background = ${theme.redB}
label-warn = %temperature%
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-3 = 
[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
[global/wm]
margin-top = 5
margin-bottom = 5
; vim:ft=dosini

28
config/polybar/launch.sh Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env sh
# Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -x polybar >/dev/null; do sleep 1; done
# Getting some vars
primary=$(xrandr | grep primary | head -1 | cut -d' ' -f1)
export ethI=$(/bin/ls /sys/class/net/ | grep ^enp* | head -1)
export wlanI=$(/bin/ls /sys/class/net/ | grep ^wl* | head -1)
# Launch bar for each display
polybar -m | cut -d':' -f1 | while read display
do
export display=$display
if [ "$display" == "$primary" ]
then
bar="primary"
else
bar="secondary"
fi
polybar $bar &
done
echo "Bars launched..."

View file

View file

@ -0,0 +1,701 @@
# vim: ft=conf
#
# In this config file, qutebrowser's key bindings are configured.
# The format looks like this:
#
# [keymode]
#
# command
# keychain
# keychain2
# ...
#
# All blank lines and lines starting with '#' are ignored.
# Inline-comments are not permitted.
#
# keymode is a comma separated list of modes in which the key binding should be
# active. If keymode starts with !, the key binding is active in all modes
# except the listed modes.
#
# For special keys (can't be part of a keychain), enclose them in `<`...`>`.
# For modifiers, you can use either `-` or `+` as delimiters, and these names:
#
# * Control: `Control`, `Ctrl`
# * Meta: `Meta`, `Windows`, `Mod4`
# * Alt: `Alt`, `Mod1`
# * Shift: `Shift`
#
# For simple keys (no `<>`-signs), a capital letter means the key is pressed
# with Shift. For special keys (with `<>`-signs), you need to explicitly add
# `Shift-` to match a key pressed with shift.
#
# Note that default keybindings are always bound, and need to be explicitly
# unbound if you wish to remove them:
#
# <unbound>
# keychain
# keychain2
# ...
[!normal]
leave-mode
<escape>
<ctrl-[>
[normal]
# Keybindings for normal mode.
clear-keychain ;; search ;; fullscreen --leave
<escape>
set-cmd-text -s :open
o
set-cmd-text :open {url:pretty}
go
set-cmd-text -s :open -t
O
set-cmd-text :open -t -i {url:pretty}
gO
set-cmd-text -s :open -b
xo
set-cmd-text :open -b -i {url:pretty}
xO
set-cmd-text -s :open -w
wo
set-cmd-text :open -w {url:pretty}
wO
set-cmd-text /
/
set-cmd-text ?
?
set-cmd-text :
:
open -t
ga
<ctrl-t>
open -w
<ctrl-n>
tab-close
d
<ctrl-w>
tab-close -o
D
tab-only
co
tab-focus
T
tab-move
gm
tab-move -
gl
tab-move +
gr
tab-next
L
<ctrl-pgdown>
tab-prev
H
<ctrl-pgup>
tab-clone
gC
reload
r
<f5>
reload -f
R
<ctrl-f5>
back
J
<back>
back -t
tj
back -w
wj
forward
K
<forward>
forward -t
tk
forward -w
wk
fullscreen
<f11>
hint
f
hint all tab
F
hint all window
wf
hint all tab-bg
;b
hint all tab-fg
;f
hint all hover
;h
hint images
;i
hint images tab
;I
hint links fill :open {hint-url}
;o
hint links fill :open -t -i {hint-url}
;O
hint links yank
;y
hint links yank-primary
;Y
hint --rapid links tab-bg
;r
hint --rapid links window
;R
hint links download
;d
hint inputs
;t
scroll left
h
scroll down
j
scroll up
k
scroll right
l
undo
u
<ctrl-shift-t>
scroll-perc 0
gg
scroll-perc
G
search-next
n
search-prev
N
enter-mode insert
i
enter-mode caret
v
enter-mode set_mark
`
enter-mode jump_mark
'
yank
yy
yank -s
yY
yank title
yt
yank title -s
yT
yank domain
yd
yank domain -s
yD
yank pretty-url
yp
yank pretty-url -s
yP
open -- {clipboard}
pp
open -- {primary}
pP
open -t -- {clipboard}
Pp
open -t -- {primary}
PP
open -w -- {clipboard}
wp
open -w -- {primary}
wP
quickmark-save
m
set-cmd-text -s :quickmark-load
b
set-cmd-text -s :quickmark-load -t
B
set-cmd-text -s :quickmark-load -w
wb
bookmark-add
M
set-cmd-text -s :bookmark-load
gb
set-cmd-text -s :bookmark-load -t
gB
set-cmd-text -s :bookmark-load -w
wB
save
sf
set-cmd-text -s :set
ss
set-cmd-text -s :set -t
sl
set-cmd-text -s :bind
sk
zoom-out
-
zoom-in
+
zoom
=
navigate prev
[[
navigate next
]]
navigate prev -t
{{
navigate next -t
}}
navigate up
gu
navigate up -t
gU
navigate increment
<ctrl-a>
navigate decrement
<ctrl-x>
inspector
wi
download
gd
download-cancel
ad
download-clear
cd
view-source
gf
set-cmd-text -s :buffer
gt
tab-focus last
<ctrl-tab>
enter-mode passthrough
<ctrl-v>
quit
<ctrl-q>
scroll-page 0 1
<ctrl-f>
scroll-page 0 -1
<ctrl-b>
scroll-page 0 0.5
<ctrl-d>
scroll-page 0 -0.5
<ctrl-u>
tab-focus 1
<alt-1>
tab-focus 2
<alt-2>
tab-focus 3
<alt-3>
tab-focus 4
<alt-4>
tab-focus 5
<alt-5>
tab-focus 6
<alt-6>
tab-focus 7
<alt-7>
tab-focus 8
<alt-8>
tab-focus 9
<alt-9>
home
<ctrl-h>
stop
<ctrl-s>
print
<ctrl-alt-p>
open qute:settings
Ss
follow-selected
<return>
<ctrl-m>
<ctrl-j>
<shift-return>
<enter>
<shift-enter>
follow-selected -t
<ctrl-return>
<ctrl-enter>
repeat-command
.
record-macro
q
run-macro
@
wq
ZZ
tab-focus -1
g$
tab-pin
<ctrl-p>
[insert]
# Keybindings for insert mode.
# Since normal keypresses are passed through, only special keys are
# supported in this mode.
# Useful hidden commands to map in this section:
# * `open-editor`: Open a texteditor with the focused field.
# * `paste-primary`: Paste primary selection at cursor position.
open-editor
<ctrl-e>
insert-text {primary}
<shift-ins>
[hint]
# Keybindings for hint mode.
# Since normal keypresses are passed through, only special keys are
# supported in this mode.
# Useful hidden commands to map in this section:
# * `follow-hint`: Follow the currently selected hint.
follow-hint
<return>
<ctrl-m>
<ctrl-j>
<shift-return>
<enter>
<shift-enter>
hint --rapid links tab-bg
<ctrl-r>
hint links
<ctrl-f>
hint all tab-bg
<ctrl-b>
[command]
# Keybindings for command mode.
# Since normal keypresses are passed through, only special keys are
# supported in this mode.
# Useful hidden commands to map in this section:
# * `command-history-prev`: Switch to previous command in history.
# * `command-history-next`: Switch to next command in history.
# * `completion-item-focus`: Select another item in completion.
# * `command-accept`: Execute the command currently in the commandline.
command-history-prev
<ctrl-p>
command-history-next
<ctrl-n>
completion-item-focus prev
<shift-tab>
<up>
completion-item-focus next
<tab>
<down>
completion-item-focus next-category
<ctrl-tab>
completion-item-focus prev-category
<ctrl-shift-tab>
completion-item-del
<ctrl-d>
command-accept
<return>
<ctrl-m>
<ctrl-j>
<shift-return>
<enter>
<shift-enter>
[prompt]
# Keybindings for prompts in the status line.
# You can bind normal keys in this mode, but they will be only active
# when a yes/no-prompt is asked. For other prompt modes, you can only
# bind special keys.
# Useful hidden commands to map in this section:
# * `prompt-accept`: Confirm the entered value.
# * `prompt-accept yes`: Answer yes to a yes/no question.
# * `prompt-accept no`: Answer no to a yes/no question.
prompt-accept
<return>
<ctrl-m>
<ctrl-j>
<shift-return>
<enter>
<shift-enter>
prompt-accept yes
y
prompt-accept no
n
prompt-open-download
<ctrl-x>
prompt-item-focus prev
<shift-tab>
<up>
prompt-item-focus next
<tab>
<down>
[command,prompt]
rl-backward-char
<ctrl-b>
rl-forward-char
<ctrl-f>
rl-backward-word
<alt-b>
rl-forward-word
<alt-f>
rl-beginning-of-line
<ctrl-a>
rl-end-of-line
<ctrl-e>
rl-unix-line-discard
<ctrl-u>
rl-kill-line
<ctrl-k>
rl-kill-word
<alt-d>
rl-unix-word-rubout
<ctrl-w>
rl-backward-kill-word
<alt-backspace>
rl-yank
<ctrl-y>
rl-delete-char
<ctrl-?>
rl-backward-delete-char
<ctrl-h>
[caret]
toggle-selection
v
<space>
drop-selection
<ctrl-space>
enter-mode normal
c
move-to-next-line
j
move-to-prev-line
k
move-to-next-char
l
move-to-prev-char
h
move-to-end-of-word
e
move-to-next-word
w
move-to-prev-word
b
move-to-start-of-next-block
]
move-to-start-of-prev-block
[
move-to-end-of-next-block
}
move-to-end-of-prev-block
{
move-to-start-of-line
0
move-to-end-of-line
$
move-to-start-of-document
gg
move-to-end-of-document
G
yank selection -s
Y
yank selection
y
<return>
<ctrl-m>
<ctrl-j>
<shift-return>
<enter>
<shift-enter>
scroll left
H
scroll down
J
scroll up
K
scroll right
L

File diff suppressed because it is too large Load diff

View file

@ -1,2 +1,3 @@
*.swp *.swp
*.swo *.swo
*.ycm_extra_conf.py

37
inputrc
View file

@ -1,16 +1,35 @@
$include /etc/inputrc $include /etc/inputrc
set bell-style none
set completion-ignore-case on
set completion-prefix-display-length 4
set completion-query-items 200
set editing-mode vi set editing-mode vi
set history-preserve-point on
set history-size 10000
set horizontal-scroll-mode off
set mark-directories on
set mark-modified-lines off
set mark-symlinked-directories on
set match-hidden-files on
set page-completions on
set print-completions-horizontally on
set revert-all-at-newline off
set show-all-if-ambiguous on set show-all-if-ambiguous on
set show-all-if-unmodified on
set skip-completed-text on
set visible-stats on set visible-stats on
set page-completions off
$if mode=vi $if mode=vi
set keymap vi-command set keymap vi-command
# these are for vi-command mode # these are for vi-command mode
"\e[A": history-search-backward "\e[A": history-search-backward
"\e[B": history-search-forward "\e[B": history-search-forward
set keymap vi-insert Control-l: clear-screen
# these are for vi-insert mode set keymap vi-insert
"\e[A": history-search-backward # these are for vi-insert mode
"\e[B": history-search-forward "jk": vi-movement-mode
"\e[A": history-search-backward
"\e[B": history-search-forward
Control-l: clear-screen
$endif $endif

12
profile
View file

@ -1,8 +1,12 @@
# #
# ~/.profile # ~/.profile
# #
if [ -z "$SSH_AUTH_SOCK" ] ; then
eval `ssh-agent -s` > /dev/null
fi
[[ -f ~/.bashrc ]] && . ~/.bashrc # SSH agent
[[ -z "$SSH_AUTH_SOCK" && -x "$(which ssh-agent)" ]] && eval `ssh-agent -s` &> /dev/null
# TTY Colors
[ -f "$HOME/.config/linuxColors.sh" ] && . "$HOME/.config/linuxColors.sh"
# Bashrc
[ -f ~/.bashrc ] && . ~/.bashrc

2
scripts/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
sct
node_modules

16
scripts/cleandev Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Removes files that can be regenerated
# from a dev environment
find . -type d -name bower_components -or -name node_modules -print0 | while read file; do
rm -rf "$file"
done
find . -type f -name Makefile -print0 | while IFS= read -r -d '' file; do
echo "--> $file"
(cd "${file//Makefile}"; make clean)
done
find . -type d -name .git -print0 | while IFS= read -r -d '' dir; do
echo "--> $file"
(cd "$dir"; git gc)
done

8
scripts/dafont Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
# Downloads a font from dafont.com and
# extracts it in the user's font dir
wget "http://dl.dafont.com/dl/?f=$1" -O /tmp/dafont.zip
unzip /tmp/dafont.zip -d ~/.local/share/fonts -x *.txt
rm -rf /tmp/dafont.zip

View file

@ -2,34 +2,38 @@
# Installs Debian packages on a Debian system # Installs Debian packages on a Debian system
# with no root access, in the user home # with no root access, in the user home
# (sourceable)
if [ ! -f /etc/apt/sources.list ]; then # CONFIGURATION
# Not a Debian system
return 0 # Verifications
if [[ -z $DEBIAN_MIRROR && ! -f /etc/apt/sources.list ]]; then
echo "Unable to find a mirror. Try setting DEBIAN_MIRROR (see help)."
exit 1
fi
if [[ -z $DEBIAN_DB && ! $(which apt &> /dev/null) ]]; then
echo "Unable to find a database for packages to install. Try setting DEBIAN_DB (see help)."
exit 1
fi fi
# Overrides
ARCH=$(dpkg --print-architecture) [ -z $DEBLOC_PREFIX ] && DEBLOC_PREFIX=$(dpkg --print-architecture)
DEBLOC_DB=$HOME/.config/debloc/$ARCH [ -z $DEBLOC_DB ] && DEBLOC_DB=${XDG_CONFIG_HOME:-$HOME/.config}/debloc/$DEBLOC_PREFIX
DEBLOC_ROOT=$HOME/.debloc/$ARCH [ -z $DEBLOC_ROOT ] && DEBLOC_ROOT=$HOME/.debloc/$DEBLOC_PREFIX
DEBLOC_LD=$DEBLOC_ROOT/ld DEBLOC_LD=$DEBLOC_ROOT/ld
if [ -z $DEBIAN_MIRROR ]; then if [ -z "$DEBIAN_MIRROR" ]; then
DEBIAN_MIRROR="$(cat /etc/apt/sources.list | grep '^deb ' | grep main | grep -v backports)" DEBIAN_MIRROR="$(cat /etc/apt/sources.list | grep '^deb ' | grep main | grep -v backports)"
DEBIAN_MIRROR="$(echo -e "$DEBIAN_MIRROR" | cut -d ' ' -f 2 | sed 's/\/$//')" DEBIAN_MIRROR="$(echo -e "$DEBIAN_MIRROR" | cut -d ' ' -f 2 | sed 's/\/$//' | sort | uniq)"
fi fi
# Preparation
mkdir -p $DEBLOC_DB &> /dev/null mkdir -p $DEBLOC_DB &> /dev/null
mkdir -p $DEBLOC_ROOT &> /dev/null mkdir -p $DEBLOC_ROOT &> /dev/null
export PATH="$DEBLOC_ROOT/usr/bin:$DEBLOC_ROOT/usr/games/:$DEBLOC_ROOT/usr/lib/git-core:$PATH" # PRIVATE FUNCTIONS
export LIBRARY_PATH="$DEBLOC_LD:$LIBRARY_PATH"
export C_INCLUDE_PATH="$DEBLOC_ROOT/usr/include:$C_INCLUDE_PATH"
export CPLUS_INCLUDE_PATH="$DEBLOC_ROOT/usr/include:$CPLUS_INCLUDE_PATH"
export LD_LIBRARY_PATH="$DEBLOC_LD:$LD_LIBRARY_PATH"
export PYTHONPATH="$DEBLOC_ROOT/usr/lib/python3/dist-packages:$PYTHONPATH"
export QT_QPA_PLATFORM_PLUGIN_PATH="$DEBLOC_ROOT/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms"
# Tell if a package exists # Tell if a package exists
function _debloc-exists { # package function _debloc-exists { # package
@ -94,8 +98,11 @@ function _debloc-globallyInstalled { # package
function _debloc-packageShow { # package function _debloc-packageShow { # package
pkg=$1 pkg=$1
if [[ -n $DEBIAN_DB && -f $DEBIAN_DB ]]; then if [[ -n $DEBIAN_DB && -f $DEBIAN_DB ]]; then
startline=$(grep "^Package: ${pkg}\$" $DEBIAN_DB --line-number | cut -d ':' -f 1) startline=$(grep "^Package: ${pkg}\$" $DEBIAN_DB --line-number | tail -1 | cut -d ':' -f 1)
sed -n $startline,$(expr $startline + 100)p $DEBIAN_DB | while read line; do if [ -z "$startline" ]; then
return 0
fi
sed -n "$startline,$(expr $startline + 100)p" $DEBIAN_DB | while read line; do
if [ -z "$line" ]; then if [ -z "$line" ]; then
return 0 return 0
fi fi
@ -107,7 +114,7 @@ function _debloc-packageShow { # package
if [ -z "$line" ]; then if [ -z "$line" ]; then
return 0 return 0
fi fi
echo $line echo "$line"
done done
return 0 return 0
fi fi
@ -184,7 +191,7 @@ function _debloc-install { # package
fi fi
done done
if [ ! -s $DEB_FILE ]; then if [ ! -s $DEB_FILE ]; then
echo "→ Failed!" echo "→ Failed (no deb file)!"
rm $DEBLOC_DB/$pkg &> /dev/null rm $DEBLOC_DB/$pkg &> /dev/null
return 4 return 4
fi fi
@ -194,7 +201,7 @@ function _debloc-install { # package
real=$(md5sum $DEB_FILE | cut -d ' ' -f 1) real=$(md5sum $DEB_FILE | cut -d ' ' -f 1)
if [ "$theo" != "$real" ]; then if [ "$theo" != "$real" ]; then
rm -f $DEB_FILE &> /dev/null rm -f $DEB_FILE &> /dev/null
echo "→ Failed!" echo "→ Failed (sum doesn't match)!"
rm $DEBLOC_DB/$pkg &> /dev/null rm $DEBLOC_DB/$pkg &> /dev/null
return 5 return 5
fi fi
@ -236,8 +243,46 @@ function _debloc-installDeps { # package
return 0 return 0
} }
# Install package with dependencies (user version with verifications) # PUBLIC FUNCTIONS
function debloc-install { # package
function proxy_set_help {
echo "Usage: $0 env"
echo
echo "Examples:"
echo ' eval "$(debloc env)"'
return 0
}
function debloc_env {
echo "export PATH=\"$DEBLOC_ROOT/usr/bin:$DEBLOC_ROOT/usr/games/:$DEBLOC_ROOT/usr/lib/git-core:\$PATH\""
echo "export LIBRARY_PATH=\"$DEBLOC_LD:\$LIBRARY_PATH\""
echo "export C_INCLUDE_PATH=\"$DEBLOC_ROOT/usr/include:\$C_INCLUDE_PATH\""
echo "export CPLUS_INCLUDE_PATH=\"$DEBLOC_ROOT/usr/include:$DEBLOC_ROOT/usr/include/python2.7/:$DEBLOC_ROOT/usr/include/x86_64-linux-gnu/python2.7/:\$CPLUS_INCLUDE_PATH\""
echo "export LD_LIBRARY_PATH=\"$DEBLOC_LD:\$LD_LIBRARY_PATH\""
echo "export PYTHONPATH=\"$DEBLOC_ROOT/usr/lib/python3/dist-packages:\$PYTHONPATH\""
echo "export QT_QPA_PLATFORM_PLUGIN_PATH=\"$DEBLOC_ROOT/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms\""
}
function debloc_info {
echo "DEBLOC_PREFIX=$DEBLOC_PREFIX"
echo "DEBLOC_ROOT=$DEBLOC_ROOT"
echo "DEBLOC_DB=$DEBLOC_DB"
echo "DEBLOC_LD=$DEBLOC_LD"
echo "DEBIAN_MIRROR='$DEBIAN_MIRROR'"
echo "DEBIAN_DB=$DEBIAN_DB"
}
function debloc_install_help {
echo "Usage: $0 install PACKAGE"
echo
echo "Arguments:"
echo " PACKAGE Package name"
return 0
}
function debloc_install { # package
if [ -z $1 ]; then
debloc_deb_help
fi
for pkg in $*; do for pkg in $*; do
pkg=$(_debloc-filterVirtual $pkg) pkg=$(_debloc-filterVirtual $pkg)
_debloc-exists $pkg _debloc-exists $pkg
@ -261,8 +306,17 @@ function debloc-install { # package
} }
# Install debian archive (user version with verifications) function debloc_deb_help {
function debloc-deb { # path echo "Usage: $0 deb PATH"
echo
echo "Arguments:"
echo " PATH Path to the .deb file"
return 0
}
function debloc_deb { # path
if [ -z $1 ]; then
debloc_deb_help
fi
for path in $*; do for path in $*; do
if [ ! -f "$path" ]; then if [ ! -f "$path" ]; then
echo "$path is not a file" echo "$path is not a file"
@ -275,8 +329,82 @@ function debloc-deb { # path
} }
# Remove every package installed with Debloc function debloc_altern_help {
function debloc-flush { echo "Usage: $0 altern PROGRAM ALTERNATIVE"
echo
echo "Arguments:"
echo " PROGRAM Program to set the alternative for"
echo " ALTERNATIVE Alternative to set"
echo
echo "Examples:"
echo " $0 altern vim nox"
echo " $0 altern dmenu xft"
return 0
}
function debloc_altern { # program alternative
if [[ -z $1 || -z $2 ]]; then
debloc_altern_help
exit 1
fi
if [ -f "$DEBLOC_ROOT/usr/bin/$1.$2" ]; then
dest="$DEBLOC_ROOT/usr/bin/$1"
alte="$DEBLOC_ROOT/usr/bin/$1.$2"
elif [ -f "$DEBLOC_ROOT/bin/$1.$2" ]; then
dest="$DEBLOC_ROOT/bin/$1"
alte="$DEBLOC_ROOT/bin/$1.$2"
else
echo "Unknown alternative for $1 : $2"
exit 1
fi
if [ -e "$dest" ]; then
rm $dest
fi
ln -s "$alte" "$dest"
}
function debloc_flush {
rm -rf $DEBLOC_ROOT/* &> /dev/null rm -rf $DEBLOC_ROOT/* &> /dev/null
rm -f $DEBLOC_DB/* &> /dev/null rm -f $DEBLOC_DB/* &> /dev/null
} }
# TODO Other word for 'fake filesystem' and/or explain what this is
function debloc_help {
command="$1"
if [ -n "$command" ]; then
if type "debloc_${command}_help" &> /dev/null; then
shift
"debloc_${command}_help" "$@"
return $?
fi
fi
echo "Usage: $0 COMMAND"
echo
echo "Commands:"
echo " env Provides the environment variables required to run applications from the fake filesystem"
echo " info Gives some information about the fake filesystem"
echo " install Install a debian package in the fake filesystem"
echo " deb Install from a .deb file in the fake filesystem"
echo " altern Update alternative"
echo " flush Remove every package installed from the fake filesystem"
echo " help Get help with commands"
echo
echo "Environment variables:"
echo " DEBLOC_PREFIX Name of the fake filesystem to use (default: uses dpkg architecture)"
echo " DEBLOC_ROOT Path of the fake filesystem (default: ~/.debloc/\$DEBLOC_PREFIX/)"
echo " DEBLOC_DB Database of the fake filesystem (default: \$XDG_CONFIG_HOME/debloc/\$DEBLOC_PREFIX)"
echo " DEBIAN_MIRROR Multiline list of debian mirror (default: uses /etc/apt/sources.list)"
echo " DEBIAN_DB Path to a file with all packages description (default: uses apt-cache showpkg)"
echo " help Get help with commands"
return 0
}
# MAIN
command="$1"
shift
if type "debloc_$command" &> /dev/null; then
"debloc_$command" "$@"
else
debloc_help
fi

11
scripts/docker-image-childs Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env sh
# Find the dependent child image from an image
parent="$1"
# From https://stackoverflow.com/a/41634462
for i in $(docker images -q)
do
docker history "$i" | grep -q "$parent" && echo "$i"
done | grep -v "$parent" | sort -u

5
scripts/docker-rm Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env sh
docker unpause $(docker ps -q)
docker kill $(docker ps -q)
docker container prune -f
docker network prune -f

View file

@ -1,9 +1,7 @@
#!/usrenv bash #!/usr/bin/env bash
# Handles dotfiles # Handles dotfiles
# Yes there are tons of similar scipts yet I wanted no more nor less than what I needed # Yes there are tons of similar scipts yet I wanted no more nor less than what I needed
# (sourceable)
# Config # Config
@ -156,7 +154,19 @@ function _dotfiles-install-dir { # dir
# Script functions # Script functions
function dotfiles-link { # file function dotfiles_link_help {
echo "Usage: $0 link DOTFILE"
echo
echo "Arguments:"
echo " DOTFILE Path to the dotfile"
return 0
}
function dotfiles_link { # file
if [ -z $1 ]; then
dotfiles_link_help
return 1
fi
absSource="$(realpath $1 2> /dev/null)" absSource="$(realpath $1 2> /dev/null)"
if [[ $? != 0 || ! -e "$absSource" ]]; then if [[ $? != 0 || ! -e "$absSource" ]]; then
echo "[ERROR] $1: no such file or directory" echo "[ERROR] $1: no such file or directory"
@ -194,10 +204,41 @@ function dotfiles-link { # file
} }
function dotfiles-install { function dotfiles_install {
_dotfiles-install-dir / _dotfiles-install-dir /
} }
function dotfiles_help {
command="$1"
if [ -n "$command" ]; then
if type "dotfiles_${command}_help" &> /dev/null; then
shift
"dotfiles_${command}_help" "$@"
return $?
fi
fi
echo "Usage: $0 COMMAND"
echo
echo "Commands:"
echo " install Install dotfiles from repository"
echo " link Add dotfile to repository"
echo " help Get help with commands"
echo
echo "Environment variables:"
echo " DOTHOME Where to install dotfiles"
echo " DOTREPO Where do the dotfiles comes from"
return 0
}
# MAIN
command="$1"
shift
if type "dotfiles_$command" &> /dev/null; then
"dotfiles_$command" "$@"
else
dotfiles_help
fi
# TODO dotfiles-{link,unlink,clean,uninstall}, better handling of DRY_RUN (use functions probably), clarify source/target thingy # TODO dotfiles-{link,unlink,clean,uninstall}, better handling of DRY_RUN (use functions probably), clarify source/target thingy
# Link and Unlink should have a clever behavior regarding # Link and Unlink should have a clever behavior regarding
# recusive folders # recusive folders

13
scripts/emergency-clean Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Clears everything it can to save space
rm -rf $HOME/.cache
if which pacman &> /dev/null; then
sudo pacman -Scc
elif which apt-get &> /deb/null; then
sudo apt-get clean
fi
if which journalctl &> /dev/null; then
sudo journalctl --vacuum-size=100M
fi

52
scripts/html2pdf Executable file
View file

@ -0,0 +1,52 @@
#!/usr/bin/env node
// Imports
var fs = require('fs');
var pdf = require('html-pdf');
var yargs = require('yargs');
// Understanding
var argv = yargs
.usage("Usage: $0 -o out.pdf [options]")
.example('$0 -i doc.pdf -o doc.pdf', 'Convert doc.html to PDF using the default values')
.help('h')
.alias('h', 'help')
.describe('i', 'Input file')
.alias('i', 'input')
.default('i', '/dev/stdin')
.describe('o', 'Output file')
.alias('o', 'output')
.describe('t', 'Title of file')
.alias('t', 'title')
.default('t', 'Sans titre')
.demandOption(['o'])
.argv;
// Settings
options = {
"base": "file://" + process.cwd() + '/',
"format": "A4",
"orientation": "portrait",
"border": "2cm",
"footer": {
"height": "10mm",
"contents": {
default: '<div style="text-align: left; float: left;">' + argv.title + '</div> <div style="text-align:right; float: right;">{{page}}/{{pages}}</div>',
}
},
}
// Reading
htmlString = fs.readFileSync(argv.i, "utf8");
// Conversion
pdf.create(htmlString, options).toFile(argv.o, function(err, res) {
if (err) console.error(err);
});

View file

@ -1,10 +0,0 @@
source ~/.scripts/proxy.sh
source ~/.scripts/machines.sh
source ~/.scripts/debloc.sh
source ~/.scripts/dotfiles.sh
source ~/.scripts/installPreferences.sh
source ~/.scripts/installArch.sh
function optimize {
bash ~/.scripts/optimize.sh
}
alias beep=~/.scripts/beep.sh

106
scripts/install-arch Executable file
View file

@ -0,0 +1,106 @@
#!/usr/bin/env bash
# Setups an Arch Linux system the way I like it
# (requires sudo)
if which pacman &> /dev/null; then
echo "This is not an Arch Linux system (or pacman isn't installed)"
return 1
fi
# Configuration
function prompt { # text
while true; do
read -p "$1 [yn] " yn
case $yn in
[Yy]* ) return 1;;
[Nn]* ) return 0;;
* ) echo "Please answer yes or no.";;
esac
done
}
# Don't ask for things that are already there
if which yaourt &> /dev/null; then
local YAOURT=1
fi
if which bauerbill &> /dev/null; then
local BAUERBILL=1
fi
if [ -z $YAOURT ]; then
prompt "Do you want yaourt on this machine?"
local YAOURT=$?
fi
if [ $YAOURT == 1 ]; then
if [ -z $BAUERBILL ]; then
prompt "Do you want bauerbill on this machine?"
local BAUERBILL=$?
fi
else
BAUERBILL=0
fi
# COMMON
# Install packages if they aren't installed
function inst {
for pkg in $*; do
pacman -Q $pkg &> /dev/null
if [ $? == 1 ]; then
sudo pacman -S $pkg --noconfirm
fi
done
}
# Install package from PKGBUILD file
function installPKGBUILD { # url
TMP_DIR="$(mktemp -d /tmp/pkgbuild.XXXXXXXXXX)"
cd "$TMP_DIR"
wget "$1" -O PKGBUILD
makepkg -si
cd -
rm -rf "$TMP_DIR"
}
# SYSTEM
inst wget
pacman -Q yaourt &> /dev/null
if [[ $YAOURT == 1 && $? == 1 ]]; then
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=package-query"
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yaourt"
fi
if pacman -Q pamac ; then
sudo pacman -Rsc pamac
fi
pacman -Q bauerbill &> /dev/null
if [[ $BAUERBILL == 1 && $? == 1 ]]; then
sudo pacman -Sy manjaro-{hotfixes,keyring,release,system} --noconfirm
gpg --recv-keys 1D1F0DC78F173680
installPKGBUILD http://xyne.archlinux.ca/projects/reflector/pkgbuild/PKGBUILD
yaourt -S bauerbill --noconfirm
bb-wrapper -Su
# TODO Prompt if all went well, if not restart
else
sudo pacman -Syu
fi
# Disable predictable network names
sudo ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
# TLP
# sudo pacman -S tlp
# sudo systemctl enable tlp.service tlp-sleep.service
# sudo systemctl disable systemd-rfkill
# TODO
# make -j8 in MAKEPKG
# time
# nfs
# hibernate

313
scripts/install-prefs Executable file
View file

@ -0,0 +1,313 @@
#!/usr/bin/env bash
# Installs user preferences the way I like it
# Configuration
function prompt { # text
while true; do
read -p "$1 [yn] " yn
case $yn in
[Yy]* ) return 1;;
[Nn]* ) return 0;;
* ) echo "Please answer yes or no.";;
esac
done
}
# Don't ask for things that are already there
TERMUX=0
if [ -d /data/data/com.termux/files ]; then
TERMUX=1
GUI=0
fi
if which i3 &> /dev/null; then
GUI=1
fi
if [ -z $ADMIN ]; then
prompt "Are you a superuser on this machine?"
ADMIN=$?
fi
if [ -z $GUI ]; then
prompt "Do you want a X environment on this machine?"
GUI=$?
fi
if [ -z $EXTRA ]; then
prompt "Do you want not-so-needed software on this machine?"
EXTRA=$?
fi
# TODO Verify if the package exists before installing it
# System detection
if which pacman &> /dev/null; then
ARCH=1
if [ $ADMIN == 1 ]; then
sudo pacman -Sy
function installOne { # package
pacman -Q $1 &> /dev/null
if [ $? == 1 ]; then
sudo pacman -S $1 --noconfirm --needed
fi
}
function installFileOne { # file
sudo pacman -U "$1"
}
if which yaourt &> /dev/null; then
function altInstallOne { # package
pacman -Q $1 &> /dev/null
if [ $? == 1 ]; then
yaourt -S "$1" --noconfirm
fi
}
else
# Install package from PKGBUILD file
function installPKGBUILD { # url
TMP_DIR="$(mktemp -d /tmp/pkgbuild.XXXXXXXXXX)"
cd "$TMP_DIR"
wget "$1" -O PKGBUILD
makepkg -si
cd -
rm -rf "$TMP_DIR"
}
function altInstallOne { # package
pacman -Q $1 &> /dev/null
if [ $? == 1 ]; then
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$1"
fi
}
fi
else
echo "You're on a Arch System but it's not yours? Did Arch got that popular?"
return 42
fi
elif which dpkg &> /dev/null; then
DEBIAN=1
if [[ $ADMIN == 1 || $TERMUX == 1 ]]; then
if [ $TERMUX == 1 ]; then
DEBIAN=0
apt update -y
else
sudo apt-get update -y
fi
function installOne { # package
# Finding out if it's already installed or not
STATUS=$(mktemp)
LANG=C dpkg-query --status $1 &> $STATUS
installed=0
if [ $? == 0 ]; then
cat $STATUS | grep '^Status:' | grep ' installed' --quiet
if [ $? == 0 ]; then
installed=1
fi
fi
rm -f $STATUS > /dev/null
echo 101 $1 $installed
# Installing if it's not installed
if [ $installed == 0 ]; then
# TODO noconfirm
if [ $TERMUX == 1 ]; then
apt install $1 -y
else
sudo apt-get install $1 -y
fi
fi
}
function installFileOne { # file
dpkg -i "$1"
}
else
function installOne { # package
debloc install $1
}
function installFileOne { # file
debloc deb "$1"
}
fi
function altInstallOne {
echo "[ERROR] There's no alternate installer for this distribution. Can't install $1."
}
else
echo "Uuuh, what kind of distribution is this?"
return 1
fi
# Install package with the standard
# package manager for the distribution
function inst {
for pkg in $*; do
installOne $pkg
done
}
# Install package FILE with the standard
# package manager for the distribution
function instFile {
for pkg in $*; do
installFileOne $pkg
done
}
# Install package with the alternate
# package manager for the distribution
function altInst {
for pkg in $*; do
altInstallOne $pkg
done
}
# Common CLI
.Xresources.d/configure
# Utils
inst coreutils man openssl-tool grep sed sh tar
if [ $TERMUX == 1 ]; then
inst termux-api
if [ $ADMIN == 1 ]; then
inst tsu
fi
fi
inst moreutils screen ncdu lsof htop proxytunnel pv curl wget sshfs netcat mosh bash-completion rsync
if [ $ARCH == 1 ]; then
inst gopass
else
inst pass
fi
if [[ $ARCH == 1 && $ADMIN == 1 ]]; then
inst pkgfile
sudo systemctl enable pkgfile-update.timer
fi
# Dev
if [ $DEBIAN == 1 ]; then
inst build-essential
elif [ $ARCH == 1 ]; then
inst base-devel
else
inst make
fi
inst git
# Text editor
if [ $TERMUX == 1 ]; then
inst vim-python
elif [ $DEBIAN == 1 ]; then
inst vim-nox
if [ $ADMIN == 0 ]; then
debloc altern vim nox
fi
else
inst vim
fi
if [ $DEBIAN == 1 ]; then
inst exuberant-ctags
else
inst ctags
fi
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
# YouCompleteMe (vim plugin)
if [ $ARCH == 1 ] && [ $ADMIN == 1 ]; then
if [ $EXTRA == 1 ]; then
altInst vim-youcompleteme-git
else
altInst vim-youcompleteme-core-git
fi
else
if [ $DEBIAN == 1 || $TERMUX == 1 ]; then
inst python-dev python3-dev
fi
YCM_ARGS=""
if [ $TERMUX != 1 ]; then
YCM_ARGS="$YCM_ARGS --clang-completer --tern-completer"
fi
python $HOME/.vim/bundle/YouCompleteMe/install.py $YCM_ARGS
fi
# Common GUI
if [ $GUI == 1 ]; then
# Desktop manager
inst i3 i3lock dunst unclutter xautolock feh numlockx scrot xterm xclip
if [ $ARCH == 1 ]; then
altInst polybar-git ttf-font-awesome autorandr-git keynav-enhanced
else
echo "TODO compile polybar-git autorandr-git"
fi
if [ $DEBIAN == 1 ]; then
inst suckless-tools keynav
if [ $ADMIN == 0 ]; then
debloc altern dmenu xft
fi
else
inst dmenu
fi
if [ "$(source /etc/os-release; echo $NAME)" == "Manjaro Linux" ]; then
inst menda-themes menda-circle-icon-theme xcursor-menda
fi
# qutebrowser
if [ $DEBIAN == 1 ]; then
inst python3-lxml python-tox python3-pyqt5 python3-pyqt5.qtwebkit python3-pyqt5.qtquick python3-sip python3-jinja2 python3-pygments python3-yaml
TMP_DIR=$(mktemp -d)
$(cd $TMP_DIR; wget https://qutebrowser.org/python3-pypeg2_2.15.2-1_all.deb)
$(cd $TMP_DIR; wget https://github.com/qutebrowser/qutebrowser/releases/download/v0.9.1/qutebrowser_0.9.1-2_all.deb)
instFile $TMP_DIR/*.deb
rm -rf $TMP_DIR
elif [ $ARCH == 1 ]; then
inst qutebrowser qt5-webengine python-opengl
fi
# Screen filter
if [ $ARCH == 1 ]; then
altInst sct
elif [ $TERMUX != 1 ]; then
if [ ! -f $HOME/.bin/sct ]; then
TMP=$(mktemp)
wget http://www.tedunangst.com/flak/files/sct.c -O $TMP
cc -std=c99 -O2 -I /usr/X11R6/include -o $HOME/.bin/sct $TMP -L /usr/X11R6/lib -lm -lX11 -lXrandr
rm $TMP
fi
fi
# Graphical vim
if [ $DEBIAN == 1 ]; then
inst vim-gtk
else
inst gvim
fi
fi
if [ $EXTRA == 1 ]; then
# Extra dev
inst cmake clang llvm npm
# Extra CLI
inst sl ffmpeg youtube-dl optipng
if [ $ARCH == 1 ]; then
inst jq
altInst pdftk translate-shell git-lfs js-beautify insect visidata-git
fi
# Extra GUI
if [ $GUI == 1 ]; then
inst vlc gimp mpd vimpc alsa-utils
if [ $ARCH == 1 ]; then
inst simplescreenrecorder
fi
fi
fi

41
scripts/install-termux Executable file
View file

@ -0,0 +1,41 @@
#!/data/data/com.termux/files/usr/bin/env bash
# Setups a Termux system the way I like it
if [ ! -d /data/data/com.termux/files ]; then
echo "This is not a Termux system (or pacman isn't installed)"
return 1
fi
# Configuration
function prompt { # text
while true; do
read -p "$1 [yn] " yn
case $yn in
[Yy]* ) return 1;;
[Nn]* ) return 0;;
* ) echo "Please answer yes or no.";;
esac
done
}
if [ -z $ROOT ]; then
prompt "Is this device rooted and BusyBox installed in /system/xbin/?"
ROOT=$?
fi
# Update
apt update
apt upgrade
# (needed for install-prefs)
apt install coreutils
apt install grep
# Config
touch ~/.hushlogin
if [ $ROOT == 1 ]; then
apt install tsu
echo '/system/xbin/mount -o remount,rw /; ln -s /data/data/com.termux/files/usr /usr; /system/xbin/mount -o remount,ro /' | tsu
fi

11
scripts/install-wsl Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Setups a WSL system the way I like it
# Remember to use the alwsl script on GitHub to install Arch Linux on WSL
# Use github:cbucher/console as a console and github:mintty/wsltty as a shell
# (%LOCALAPPDATA%/wsltty/bin/wsl-bridge) to avoid arrow keys bypassing
(cd /usr/share/i18n/charmaps/; sudo gunzip -k UTF8.gz)
echo "fr_FR.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
sudo locale-gen

View file

@ -1,106 +0,0 @@
#!/usr/bin/env bash
# Setups an Arch Linux system the way I like it
# (sourceable, requires sudo)
if which pacman &> /dev/null; then
# Not an Arch system
return 0
fi
# Configuration
function install-arch {
# Configuration
function prompt { # text
while true; do
read -p "$1 [yn] " yn
case $yn in
[Yy]* ) return 1;;
[Nn]* ) return 0;;
* ) echo "Please answer yes or no.";;
esac
done
}
# Don't ask for things that are already there
if which yaourt &> /dev/null; then
local YAOURT=1
fi
if which bauerbill &> /dev/null; then
local BAUERBILL=1
fi
if [ -z $YAOURT ]; then
prompt "Do you want yaourt on this machine?"
local YAOURT=$?
fi
if [ $YAOURT == 1 ]; then
if [ -z $BAUERBILL ]; then
prompt "Do you want bauerbill on this machine?"
local BAUERBILL=$?
fi
else
BAUERBILL=0
fi
# COMMON
# Install packages if they aren't installed
function inst {
for pkg in $*; do
pacman -Q $pkg &> /dev/null
if [ $? == 1 ]; then
sudo pacman -S $pkg --noconfirm
fi
done
}
# Install package from PKGBUILD file
function installPKGBUILD { # url
TMP_DIR="$(mktemp -d /tmp/pkgbuild.XXXXXXXXXX)"
cd "$TMP_DIR"
wget "$1" -O PKGBUILD
makepkg -si
cd -
rm -rf "$TMP_DIR"
}
# SYSTEM
inst wget
pacman -Q yaourt &> /dev/null
if [[ $YAOURT == 1 && $? == 1 ]]; then
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=package-query"
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yaourt"
fi
if pacman -Q pamac ; then
sudo pacman -Rsc pamac
fi
pacman -Q bauerbill &> /dev/null
if [[ $BAUERBILL == 1 && $? == 1 ]]; then
sudo pacman -Sy manjaro-{hotfixes,keyring,release,system} --noconfirm
gpg --recv-keys 1D1F0DC78F173680
installPKGBUILD http://xyne.archlinux.ca/projects/reflector/pkgbuild/PKGBUILD
yaourt -S bauerbill --noconfirm
bb-wrapper -Su
# TODO Prompt if all went well, if not restart
else
sudo pacman -Syu
fi
# Disable predictable network names
sudo ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
# TODO
# make -j8 in MAKEPKG
# time
# nfs
# hibernate
}

View file

@ -1,275 +0,0 @@
#!/usr/bin/env bash
# Installs user preferences the way I like it
# (sourceable)
function install-preferences {
# Configuration
function prompt { # text
while true; do
read -p "$1 [yn] " yn
case $yn in
[Yy]* ) return 1;;
[Nn]* ) return 0;;
* ) echo "Please answer yes or no.";;
esac
done
}
# Don't ask for things that are already there
local TERMUX=0
if [ -d /data/data/com.termux/files ]; then
local TERMUX=1
local GUI=0
fi
if which i3 &> /dev/null; then
local GUI=1
fi
if [ -z $ADMIN ]; then
prompt "Are you a superuser on this machine?"
local ADMIN=$?
fi
if [ -z $GUI ]; then
prompt "Do you want a X environment on this machine?"
local GUI=$?
fi
if [ -z $EXTRA ]; then
prompt "Do you want not-so-needed software on this machine?"
local EXTRA=$?
fi
# TODO Verify if the package exists before installing it
# System detection
if which pacman &> /dev/null; then
ARCH=1
if [ $ADMIN == 1 ]; then
sudo pacman -Sy
function installOne { # package
pacman -Q $1 &> /dev/null
if [ $? == 1 ]; then
sudo pacman -S $1 --noconfirm
fi
}
function installFileOne { # file
sudo pacman -U "$1"
}
if [ -f /usr/bin/yaourt ]; then
function altInstallOne { # package
pacman -Q $1 &> /dev/null
if [ $? == 1 ]; then
yaourt -S "$1" --noconfirm
fi
}
else
# Install package from PKGBUILD file
function installPKGBUILD { # url
TMP_DIR="$(mktemp -d /tmp/pkgbuild.XXXXXXXXXX)"
cd "$TMP_DIR"
wget "$1" -O PKGBUILD
makepkg -si
cd -
rm -rf "$TMP_DIR"
}
function altInstallOne { # package
pacman -Q $1 &> /dev/null
if [ $? == 1 ]; then
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$1"
fi
}
fi
else
echo "You're on a Arch System but it's not yours? Did Arch got that popular?"
return 42
fi
elif which dpkg &> /dev/null; then
DEBIAN=1
if [[ $ADMIN == 1 || $TERMUX == 1 ]]; then
if [ $TERMUX == 1 ]; then
DEBIAN=0
apt update -y
else
sudo apt-get update -y
fi
function installOne { # package
# Finding out if it's already installed or not
STATUS=$(mktemp)
LANG=C dpkg-query --status $1 &> $STATUS
local installed=0
if [ $? == 0 ]; then
cat $STATUS | grep '^Status:' | grep ' installed' --quiet
if [ $? == 0 ]; then
installed=1
fi
fi
rm -f $STATUS > /dev/null
echo 101 $1 $installed
# Installing if it's not installed
if [ $installed == 0 ]; then
# TODO noconfirm
if [ $TERMUX == 1 ]; then
apt install $1 -y
else
sudo apt-get install $1 -y
fi
fi
}
function installFileOne { # file
dpkg -i "$1"
}
else
function installOne { # package
debloc-install $1
}
function installFileOne { # file
debloc-deb "$1"
}
fi
function altInstallOne {
echo "[ERROR] There's no alternate installer for this distribution. Can't install $1."
}
else
echo "Uuuh, what kind of distribution is this?"
return 1
fi
# Install package with the standard
# package manager for the distribution
function inst {
for pkg in $*; do
installOne $pkg
done
}
# Install package FILE with the standard
# package manager for the distribution
function instFile {
for pkg in $*; do
installFileOne $pkg
done
}
# Install package with the alternate
# package manager for the distribution
function altInst {
for pkg in $*; do
altInstallOne $pkg
done
}
# Common CLI
# Utils
inst grep sed sh tar
if [ $TERMUX == 1 ]; then
inst coreutils man termux-api openssl-tool
if [ $ROOT == 1 ]; then
inst tsu
fi
fi
inst moreutils screen ncdu lsof htop proxytunnel pass pv curl wget sshfs netcat
if [[ $ARCH == 1 && $ROOT == 1 ]]; then
inst pkgfile
systemctl enable pkgfile-update.timer
fi
# Dev
if [ $DEBIAN == 1 ]; then
inst build-essential
elif [ $ARCH == 1 ]; then
inst base-devel
else
inst make
fi
inst git cmake clang llvm
# Text editor
if [ $GUI == 1 ]; then
inst gvim
else
if [ $TERMUX == 1 ]; then
inst vim-python
else
inst vim
fi
fi
if [ $DEBIAN == 1 ]; then
inst exuberant-ctags
else
inst ctags
fi
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
# YouCompleteMe (vim plugin)
if [ $DEBIAN == 1 || $TERMUX == 1 ]; then
inst python-dev python3-dev
fi
local YCM_ARGS=""
if [ $TERMUX == 0 ]; then
YCM_ARGS="$YCM_ARGS --clang-completer --tern-completer"
fi
python $HOME/.vim/bundle/YouCompleteMe/install.python $YCM_ARGS
# Common GUI
if [ $GUI == 1 ]; then
# Desktop manager
inst i3 i3lock dmenu dunst unclutter xautolock feh numlockx scrot
if [ $DEBIAN == 1 ]; then
inst suckles-tools
if [ ! $ROOT == 1 ]; then
ln -s $DEBLOC_ROOT/bin/dmenu{.xft,}
fi
else
inst dmenu
fi
if [ "$(source /etc/os-release; echo $NAME)" == "Manjaro Linux" ]; then
inst menda-themes menda-circle-icon-theme xcursor-menda
fi
# qutebrowser
if [ $DEBIAN == 1 ]; then
inst python3-lxml python-tox python3-pyqt5 python3-pyqt5.qtwebkit python3-sip python3-jinja2 python3-pygments python3-yaml
TMP_DIR=$(mktemp -d)
$(cd $TMP_DIR; wget --quiet https://qutebrowser.org/python3-pypeg2_2.15.2-1_all.deb)
$(cd $TMP_DIR; wget --quiet https://github.com/The-Compiler/qutebrowser/releases/download/v0.8.4/qutebrowser_0.8.4-1_all.deb)
instFile $TMP_DIR/*.deb
rm -rf $TMP_DIR
elif [ $ARCH == 1 ]; then
altInst qutebrowser
fi
fi
if [ $EXTRA == 1 ]; then
# Extra CLI
inst sl ffmpeg youtube-dl
if [ $ARCH == 1 ]; then
altInst pdftk
fi
# Extra GUI
if [ $GUI == 1 ]; then
inst vlc gimp mpd vimpc
if [ $ARCH == 1 ]; then
inst simplescreenrecorder
fi
fi
fi
}

22
scripts/lorem Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Generates Lorem Ipsum
original="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.
Ut velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat. Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et tristique ligula justo vitae magna.
Aliquam convallis sollicitudin purus. Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo. Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet. Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet.
"
repet=$1
if [ -z $repet ]; then
repet=1
fi
for i in $(seq 1 $repet)
do
echo -e "$original"
done

View file

@ -2,7 +2,6 @@
# Handles indexing and SSH keys of machines I # Handles indexing and SSH keys of machines I
# have access on # have access on
# (sourceable)
MACHINES_HOME=$HOME MACHINES_HOME=$HOME
MACHINES_CONFIG=$HOME/.config/machines MACHINES_CONFIG=$HOME/.config/machines
@ -51,6 +50,11 @@ function _machines-api {
route=$1 route=$1
shift shift
wget $MACHINES_API/$route --content-on-error --quiet --output-document=- "$@" wget $MACHINES_API/$route --content-on-error --quiet --output-document=- "$@"
result=$?
if [ $result != 0 ]; then
echo "[ERROR] wget returned $result..."
exit 2
fi
} }
function _machines-apiToken { function _machines-apiToken {
@ -59,6 +63,7 @@ function _machines-apiToken {
} }
function _machines-apiSigned { function _machines-apiSigned {
_machines-ensureAdmin
_machines-api "$@" --certificate=$MACHINES_CONFIG/machines.crt --private-key=$MACHINES_CONFIG/machines.key _machines-api "$@" --certificate=$MACHINES_CONFIG/machines.crt --private-key=$MACHINES_CONFIG/machines.key
} }
@ -72,24 +77,11 @@ function _machines-pubFromCrt {
openssl x509 -in $MACHINES_CONFIG/machines.crt -pubkey -noout > $MACHINES_CONFIG/machines.pub openssl x509 -in $MACHINES_CONFIG/machines.crt -pubkey -noout > $MACHINES_CONFIG/machines.pub
} }
function _machines-regenKey {
if [[ -e $MACHINES_CONFIG/machines.key || -e $MACHINES_CONFIG/machines.pub || -e $MACHINES_CONFIG/machines.crt ]]; then
echo "[ERROR] Please delete the pem files manually to prove you know what you're doing."
else
openssl genrsa -out $MACHINES_CONFIG/machines.key 4096
chmod 600 $MACHINES_CONFIG/machines.key
openssl req -key $MACHINES_CONFIG/machines.key -new -out $MACHINES_CONFIG/machines.csr
openssl x509 -req -days 1826 -in $MACHINES_CONFIG/machines.csr -signkey $MACHINES_CONFIG/machines.key -out $MACHINES_CONFIG/machines.crt
_machines-pubFromCrt
fi
}
function _machines-verifyCertificate { function _machines-verifyCertificate {
return
if openssl verify $MACHINES_CONFIG/machines.crt | grep -v 'error 18' | grep 'error' --quiet; then if openssl verify $MACHINES_CONFIG/machines.crt | grep -v 'error 18' | grep 'error' --quiet; then
echo "[ERROR] Invalid certificate" echo "[ERROR] Invalid certificate"
return 1 exit 1
else
return 0
fi fi
} }
@ -104,19 +96,23 @@ function _machines-ensurePub {
mv $CERT_FILE $MACHINES_CONFIG/machines.crt &> /dev/null mv $CERT_FILE $MACHINES_CONFIG/machines.crt &> /dev/null
else else
echo "[ERROR] Certificate rejected." echo "[ERROR] Certificate rejected."
return 1 exit 1
fi fi
fi fi
_machines-verifyCertificate _machines-verifyCertificate
if [ $? != 0 ]; then
return 1
fi
if [ ! -f $MACHINES_CONFIG/machines.pub ]; then if [ ! -f $MACHINES_CONFIG/machines.pub ]; then
_machines-pubFromCrt _machines-pubFromCrt
fi fi
return 0 return 0
} }
function _machines-ensureAdmin {
if [ ! -f $MACHINES_CONFIG/machines.key ]; then
echo "[ERROR] You need have to have the private key to do that"
exit 1
fi
}
# SSH ACCESS KEYS # SSH ACCESS KEYS
function _machines-signAkey { # network function _machines-signAkey { # network
@ -130,9 +126,6 @@ function _machines-signAkey { # network
function _machines-getAkey { # network function _machines-getAkey { # network
_machines-ensurePub _machines-ensurePub
if [ $? != 0 ]; then
return 1
fi
KEY_FILE=$(mktemp) KEY_FILE=$(mktemp)
SIGN_FILE=$(mktemp) SIGN_FILE=$(mktemp)
_machines-api akey/$1 > $KEY_FILE _machines-api akey/$1 > $KEY_FILE
@ -140,11 +133,12 @@ function _machines-getAkey { # network
openssl dgst -sha256 -verify $MACHINES_CONFIG/machines.pub -signature $SIGN_FILE $KEY_FILE &> /dev/null openssl dgst -sha256 -verify $MACHINES_CONFIG/machines.pub -signature $SIGN_FILE $KEY_FILE &> /dev/null
if [ $? == 0 ]; then if [ $? == 0 ]; then
cat $KEY_FILE cat $KEY_FILE
rm $KEY_FILE $SIGN_FILE &> /dev/null
return 0 return 0
else else
return 1
fi
rm $KEY_FILE $SIGN_FILE &> /dev/null rm $KEY_FILE $SIGN_FILE &> /dev/null
exit 1
fi
} }
function _machines-updateAkey { function _machines-updateAkey {
@ -158,50 +152,10 @@ function _machines-updateAkey {
cat $KEY_FILE cat $KEY_FILE
echo "[ERROR] Authorized keys are not properly signed" echo "[ERROR] Authorized keys are not properly signed"
rm $KEY_FILE rm $KEY_FILE
return 1 exit 1
fi fi
} }
# USER ADMIN FUNCTIONS
function machines-verifyLog {
if [ -f $MACHINES_CONFIG/lastVerifiedLog ]; then
from=$(<"$MACHINES_CONFIG/lastVerifiedLog")
else
from=0
fi
d=$(date +%s)
_machines-apiSigned log?from=$from | less
prompt "Is this OK?"
if [ $? == 1 ]; then
echo $d > $MACHINES_CONFIG/lastVerifiedLog
return 0
else
return 1
fi
}
function machines-sign {
machines-verifyLog
if [ $? != 0 ]; then
return 1
fi
echo "Signing default network authorized_keys..."
_machines-signAkey
_machines-apiSigned network | while read network; do
echo "Signing network $network authorized_keys..."
_machines-signAkey $network
done
}
function machines-list {
_machines-apiSigned machine
}
function machines-listNetwork {
_machines-apiSigned network
}
function _machines-postFile { # filename function _machines-postFile { # filename
cat $1 | while read line; do cat $1 | while read line; do
parameter=$(echo $line | cut -d '=' -f 1) parameter=$(echo $line | cut -d '=' -f 1)
@ -217,87 +171,233 @@ function _machines-addElement { # element elementType default
$EDITOR $FILE $EDITOR $FILE
data=$(_machines-postFile $FILE) data=$(_machines-postFile $FILE)
rm $FILE &> /dev/null rm $FILE &> /dev/null
err=$(_machines-apiSigned $2 --post-data "name=$1$data") machines-apiSigned $2 --post-data "name=$1$data"
if [ $? != 0 ]; then
echo "[ERROR] $err"
return 2
fi
}
function machines-add { # machine
_machines-addElement $1 machine "host[]=\nnetwork=\nuserkey=\nhostkey=\nuser="
}
function machines-addNetwork { # network
_machines-addElement $1 network "allowed[]=\nsecure=false"
} }
function _machines-editElement { # element elementType function _machines-editElement { # element elementType
FILE=$(mktemp) FILE=$(mktemp)
_machines-apiSigned $2/$1 > $FILE _machines-apiSigned $2/$1
if [ $? != 0 ]; then
echo "[ERROR] $(cat $FILE)"
rm $FILE &> /dev/null
return 1
fi
$EDITOR $FILE $EDITOR $FILE
data=$(_machines-postFile $FILE) data=$(_machines-postFile $FILE)
rm $FILE &> /dev/null rm $FILE &> /dev/null
err=$(_machines-apiSigned $2/$1 --post-data "$data") err=$(_machines-apiSigned $2/$1 --post-data "$data")
if [ $? != 0 ]; then
echo "[ERROR] $err"
return 2
fi
}
function machines-edit { # machine
_machines-editElement $1 machine
}
function machines-editNetwork { # network
_machines-editElement $1 network
} }
function _machines-deleteElement { # element elementType function _machines-deleteElement { # element elementType
err=$(_machines-apiSigned $2/$1 --method=DELETE) err=$(_machines-apiSigned $2/$1 --method=DELETE)
if [ $? != 0 ]; then }
echo "[ERROR] $err"
return 2
# USER ADMIN FUNCTIONS
function machines_history {
if [ -f $MACHINES_CONFIG/lastVerifiedLog ]; then
from=$(<"$MACHINES_CONFIG/lastVerifiedLog")
else
from=0
fi
d=$(date +%s)
_machines-apiSigned log?from=$from | less
prompt "Is this OK?"
if [ $? == 1 ]; then
echo $d > $MACHINES_CONFIG/lastVerifiedLog
return 0
else
echo "Houston, we have a problem..."
exit 1
fi fi
} }
function machines-delete { # machine function machines_sign {
machines_history
echo "Signing default network authorized_keys..."
_machines-signAkey
_machines-apiSigned network | while read network; do
echo "Signing network $network authorized_keys..."
_machines-signAkey $network
done
}
function machines_machine_list {
_machines-apiSigned machine
}
function machines_network_list {
_machines-apiSigned network
}
function machines_machine_add_help {
echo "Usage: $0 machine|mac|m add MACHINE"
echo
echo "Arguments:"
echo " MACHINE machine to add"
return 0
}
function machines_machine_add { # machine
if [ -z $1 ]; then
machines_machine_add_help
exit 1
fi
_machines-addElement $1 machine "allowed[]=\nsecure=false"
_machines-addElement $1 machine "host[]=\nnetwork=\nuserkey=\nhostkey=\nuser="
}
function machines_network_add_help {
echo "Usage: $0 network|net|n add NETWORK"
echo
echo "Arguments:"
echo " NETWORK Network to add"
return 0
}
function machines_network_add { # network
if [ -z $1 ]; then
machines_network_add_help
exit 1
fi
_machines-addElement $1 network "allowed[]=\nsecure=false"
}
function machines_machine_edit_help {
echo "Usage: $0 machine|mac|m edit MACHINE"
echo
echo "Arguments:"
echo " MACHINE machine to remove"
return 0
}
function machines_machine_edit { # machine
if [ -z $1 ]; then
machines_machine_edit_help
exit 1
fi
_machines-editElement $1 machine
}
function machines_network_edit_help {
echo "Usage: $0 network|net|n edit NETWORK"
echo
echo "Arguments:"
echo " NETWORK Network to remove"
return 0
}
function machines_network_edit { # network
if [ -z $1 ]; then
machines_network_edit_help
exit 1
fi
_machines-editElement $1 network
}
function machines_machine_delete_help {
echo "Usage: $0 machine|mac|m delete machine"
echo
echo "Arguments:"
echo " MACHINE machine to remove"
return 0
}
function machines_machine_delete { # machine
if [ -z $1 ]; then
machines_machine_delete_help
exit 1
fi
_machines-deleteElement $1 machine _machines-deleteElement $1 machine
} }
function machines-deleteNetwork { # network function machines_network_delete_help {
echo "Usage: $0 network|net|n delete NETWORK"
echo
echo "Arguments:"
echo " NETWORK Network to remove"
return 0
}
function machines_network_delete { # network
if [ -z $1 ]; then
machines_network_delete_help
exit 1
fi
_machines-deleteElement $1 network _machines-deleteElement $1 network
} }
function machines-updateAll { function machines_machine_help {
machines-list | while read machine; do echo "Usage: $0 machine|mac|m COMMAND"
echo
echo "Commands:"
echo " list List all machines"
echo " add Interactively add a machine"
echo " edit Interactively edit a specified machine"
echo " delete Remove a specified machine"
echo " help Get help with commands"
return 0
}
function machines_machine {
command="$1"
shift
if type "machines_machine_$command" &> /dev/null; then
"machines_machine_$command" "$@"
else
machines_machine_help
fi
}
function machines_network_help {
echo "Usage: $0 network|net|n COMMAND"
echo
echo "Commands:"
echo " list List all networks"
echo " add Interactively add a network"
echo " edit Interactively edit a specified network"
echo " delete Remove a specified network"
echo " help Get help with commands"
return 0
}
function machines_network {
command="$1"
shift
if type "machines_network_$command" &> /dev/null; then
"machines_network_$command" "$@"
else
machines_network_help
fi
}
machines_mac() { machines_machine "$@"; }
machines_m() { machines_machine "$@"; }
machines_net() { machines_network "$@"; }
machines_n() { machines_network "$@"; }
machines_mac_help() { machines_machine_help "$@"; }
machines_m_help() { machines_machine_help "$@"; }
machines_net_help() { machines_network_help "$@"; }
machines_n_help() { machines_network_help "$@"; }
function machines_update-all {
machines_list | while read machine; do
echo "Updating $machine..." echo "Updating $machine..."
ssh $machine 'machines-update' & ssh $machine 'machines-update' &
done done
} }
# USER FUNCTIONS function machines_regen-keys {
if [[ -e $MACHINES_CONFIG/machines.key || -e $MACHINES_CONFIG/machines.pub || -e $MACHINES_CONFIG/machines.crt ]]; then
function machines-update { echo "[ERROR] Please delete the pem files manually to prove you know what you're doing."
_machines-api machine/$(cat $MACHINES_CONFIG/this.name) > $MACHINES_CONFIG/this exit 1
_machines-updateAkey else
openssl genrsa -out $MACHINES_CONFIG/machines.key 4096
chmod 600 $MACHINES_CONFIG/machines.key
openssl req -key $MACHINES_CONFIG/machines.key -new -out $MACHINES_CONFIG/machines.csr
openssl x509 -req -days 1826 -in $MACHINES_CONFIG/machines.csr -signkey $MACHINES_CONFIG/machines.key -out $MACHINES_CONFIG/machines.crt
_machines-pubFromCrt
fi
} }
function machines-setup {
# USER FUNCTIONS
function machines_setup {
if [ -e $MACHINES_CONFIG/this.name ]; then if [ -e $MACHINES_CONFIG/this.name ]; then
echo "[ERROR] This machine is already set up" echo "[ERROR] This machine is already set up"
return 1 exit 1
fi fi
_machines-ensurePub _machines-ensurePub
if [ $? != 0 ]; then
return 1
fi
# Variables # Variables
read -p 'Machine name? ' name read -p 'Machine name? ' name
@ -324,13 +424,47 @@ function machines-setup {
data="$data&host[]=$(urlencode "$host")" data="$data&host[]=$(urlencode "$host")"
done done
err=$(_machines-apiToken machine --post-data "$data") _machines-apiToken machine --post-data "$data"
if [ $? != 0 ]; then
echo "[ERROR] $err"
return 3
fi
echo $name > $MACHINES_CONFIG/this.name echo $name > $MACHINES_CONFIG/this.name
machines-update machines_update
} }
function machines_update {
_machines-api machine/$(cat $MACHINES_CONFIG/this.name) > $MACHINES_CONFIG/this
_machines-updateAkey
}
function machines_help {
command="$1"
if [ -n "$command" ]; then
if type "machines_${command}_help" &> /dev/null; then
shift
"machines_${command}_help" "$@"
return $?
fi
fi
echo "Usage: $0 COMMAND"
echo
echo "User commands:"
echo " setup Interactive initial setup for new machine"
echo " update Update this machine"
echo " help Get help with commands"
echo
echo "Admin commands:"
echo " machine|mac|m Modify machines"
echo " network|net|n Modify networks"
echo " update-all Update all machines available via SSH"
echo " regen-keys Regenerate system keys"
return 0
}
# MAIN
command="$1"
shift
if type "machines_$command" &> /dev/null; then
"machines_$command" "$@"
else
machines_help
fi

113
scripts/md2html Executable file
View file

@ -0,0 +1,113 @@
#!/usr/bin/env node
// Imports
var fs = require('fs');
var marked = require('marked');
var highlight = require('highlight.js');
var katex = require('katex');
var yargs = require('yargs');
var extend = require('util')._extend;
// Constants
var template = '<!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="UTF-8"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/styles/xcode.min.css" integrity="sha256-OED7Gmqde0cMVVeo1zVd+3fBD4EST32D4h9YT7KY0aY=" crossorigin="anonymous" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous"> <style type="text/css"> image { max-width: 100 % } </style> <title>%TITLE%</title> </head> <body> <main class="page-content" aria-label="Content"> %BODY% </main> </body> </html>'
// Understanding
var argv = yargs
.usage("Usage: $0 [options]")
.example('$0 -i doc.md -o doc.html', 'Convert doc.md to HTML using the default template')
.help('h')
.alias('h', 'help')
.describe('i', 'Input file')
.alias('i', 'input')
.default('i', '/dev/stdin')
.describe('o', 'Output file')
.alias('o', 'output')
.default('o', '/dev/stdout')
.describe('t', 'Template file (%BODY% is replaced by the text)')
.alias('t', 'template')
.argv;
if (argv.t) {
template = fs.readFileSync(argv.t, "utf8");
}
// Settings
var extraLangages = {
avrpseudo: function (hljs) {
lang = extend({}, highlight.getLanguage('avrasm'));
lang.keywords.keyword += ' Si Alors Sinon FinSi TantQue FinTantQue Pour FinPour allant de à ←';
lang.keywords.keyword += ' Lire Sortir sur Appeler Retourner';
lang.keywords.keyword += ' DecalerDroite DecalerGauche';
lang.keywords.keyword += ' Incrementer Decrementer';
lang.keywords.built_in += ' vrai faux';
lang.contains.push({
className: 'meta',
begin: /Configurer.+/,
end: /\n/,
});
return lang;
},
avrasmplus: function (hljs) {
lang = extend({}, highlight.getLanguage('avrasm'));
lang.keywords.keyword += ' si saut alors et ou if then goto && || <-';
lang.contains.push({
className: 'meta',
begin: /@\w+/,
});
return lang;
},
};
for (lang in extraLangages) {
// This must be done before any call to highlight.highlight :/
highlight.registerLanguage(lang, extraLangages[lang]);
}
var renderer = new marked.Renderer();
marked.setOptions({
highlight: function (code, lang) {
if (highlight.getLanguage(lang)) {
return highlight.highlight(lang, code).value;
} else {
// if (extraLangages[lang]) {
// highlight.registerLanguage(lang, extraLangages[lang]);
// return highlight.highlight(lang, code).value;
// } else {
// }
console.warn("Unknown language: " + lang);
return highlight.highlightAuto(code).value;
}
}
});
// Processing
markdownString = fs.readFileSync(argv.i, "utf8");
// TeX
markdownString = markdownString.replace(/\\\$/g, '&dollar;')
markdownString = markdownString.replace(/\$\$([\s\S]+)\$\$/gm, function(glob, formula) {
return katex.renderToString(formula, {displayMode: true});
});
markdownString = markdownString.replace(/\$([^$]+)\$/g, function(glob, formula) {
return katex.renderToString(formula, {displayMode: false});
});
// Conversion
htmlString = marked(markdownString, {renderer: renderer});
fullHtmlString = template.replace('%BODY%', htmlString);
// Saving
if (argv.o == '/dev/stdout') {
console.log(fullHtmlString);
} else {
fs.writeFileSync(argv.o, fullHtmlString);
}

View file

@ -69,13 +69,14 @@ function replaceImg { # candidate original
else else
echo "→ Candidate don't have the same bit map as original, skipping!" echo "→ Candidate don't have the same bit map as original, skipping!"
fi fi
rm "$ppmc" "$ppmo" "$c" rm -f "$ppmc" "$ppmo" "$c"
} }
# JPEG (requires jpegtran) # JPEG (requires jpegtran)
while read image while read image
do do
if [ -z "$image" ]; then continue; fi
echo Processing $image echo Processing $image
prog=$(mktemp --suffix .jpg) prog=$(mktemp --suffix .jpg)
@ -103,6 +104,7 @@ done <<< "$(find "$dir" -type f -iregex ".+.jpe?g$")"
# PNG (requires optipng) # PNG (requires optipng)
while read image while read image
do do
if [ -z "$image" ]; then continue; fi
echo Processing $image echo Processing $image
temp=$(mktemp --suffix .png) temp=$(mktemp --suffix .png)
@ -117,20 +119,18 @@ done <<< "$(find "$dir" -type f -iname "*.png")"
# SVG (requires svgo) # SVG (requires svgo)
while read image while read image
do do
if [ -z "$image" ]; then continue; fi
echo Processing $image echo Processing $image
temp=$(mktemp --suffix .svg) temp=$(mktemp --suffix .svg)
cp "$image" "$temp" cp "$image" "$temp"
svgo --quiet --config $HOME/.scripts/svgo.yml "$temp" svgo --quiet --config $HOME/.config/optiSvgo.yml "$temp"
echo "→ Optimize done" echo "→ Optimize done"
replaceImg "$temp" "$image" replaceImg "$temp" "$image"
done <<< "$(find "$dir" -type f -iname "*.svg")" done <<< "$(find "$dir" -type f -iname "*.svg")"
# GIT (requires git) cleandev
find "$dir" -type d -name .git -print0 | while IFS= read -r -d '' dir; do
(cd "$dir"; git gc)
done
showtotal showtotal

22
scripts/package.json Normal file
View file

@ -0,0 +1,22 @@
{
"name": "geoffreyfrogeye-dotfiles-scripts",
"version": "1.0.0",
"description": "Stores dependencies used for GeoffreyFrogeye's dotfiles scripts.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.frogeye.fr/geoffrey/dotfiles"
},
"author": "GeoffreyFrogeye",
"license": "GPL-3.0",
"dependencies": {
"highlight.js": "^9.11.0",
"html-pdf": "^2.1.0",
"katex": "^0.7.1",
"marked": "^0.3.6",
"yargs": "^8.0.1"
}
}

49
scripts/pdfrename Executable file
View file

@ -0,0 +1,49 @@
#!/usr/bin/env bash
# Change the title of a PDF file
if [[ -z "$1" || -z "$2" ]]; then
echo "Usage: $0 FILE TITLE [CREATOR [PRODUCER]]"
echo
echo "Arguments:"
echo " FILE Path to the PDF document"
echo " TITLE Content of the Title tag"
echo " CREATOR Content of the Creator tag"
echo " PRODUCER Title to give"
exit 1
fi
file="$1"
title="$2"
creator="$3"
producer="$4"
if [ ! -f "$1" ]; then
echo "No such file or directory: $1" >> /dev/stderr
exit 2
fi
instructions=$(mktemp)
echo "InfoBegin" >> "$instructions"
echo "InfoKey: Title" >> "$instructions"
echo "InfoValue: $title" >> "$instructions"
if [ -n "$creator" ]; then
echo "InfoBegin" >> "$instructions"
echo "InfoKey: Creator" >> "$instructions"
echo "InfoValue: $creator" >> "$instructions"
fi
if [ -n "$producer" ]; then
echo "InfoBegin" >> "$instructions"
echo "InfoKey: Producer" >> "$instructions"
echo "InfoValue: $producer" >> "$instructions"
fi
copy=$(mktemp)
cp "$file" "$copy"
pdftk "$copy" update_info "$instructions" output "$file"
rm "$instructions" "$copy"

103
scripts/proxy Executable file
View file

@ -0,0 +1,103 @@
#!/usr/bin/env bash
# Allows easy manipulation of the proxy variables
function proxy_set_help {
echo "Usage: $0 set ADDRESS"
echo
echo "Arguments:"
echo " ADDRESS Address of the proxy"
echo
echo "Examples:"
echo ' eval "$(proxy set http://proxy.mycompany.com:3128/)"'
return 0
}
function proxy_set {
if [ -z $1 ]; then
proxy_set_help
return 1
fi
echo "export http_proxy='$1'"
echo "export https_proxy='$1'"
echo "export ftp_proxy='$1'"
echo "export rsync_proxy='$1'"
exit 0
}
function proxy_setup_help {
echo "Usage: $0 setup"
echo
echo "Examples:"
echo " proxy_set # Then eval the output"
return 0
}
function proxy_setup {
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
if (( $# > 0 )); then
valid=$(echo $@ | sed -n 's/\([0-9]\{1,3\}.\)\{4\}:\([0-9]\+\)/&/p')
if [[ $valid != $@ ]]; then
>&2 echo "Invalid address"
return 1
fi
proxy_set "http://$1/"
return 0
fi
echo -n "User: "; read username
if [[ $username != "" ]]; then
echo -n "Password: "
read -es password
local pre="$username:$password@"
fi
echo -n "Server: "; read server
echo -n "Port: "; read port
proxy_set "http://$pre$server:$port/"
return 0
}
function proxy_off_help {
echo "Usage: $0 off"
echo
echo "Examples:"
echo ' eval $(proxy off)'
return 0
}
function proxy_off {
echo 'unset http_proxy'
echo 'unset https_proxy'
echo 'unset ftp_proxy'
echo 'unset rsync_proxy'
return 0
}
function proxy_help {
command="$1"
if [ -n "$command" ]; then
if type "proxy_${command}_help" &> /dev/null; then
shift
"proxy_${command}_help" "$@"
return $?
fi
fi
echo "Usage: $0 COMMAND"
echo
echo "Commands:"
echo " setup Interactively setup proxy"
echo " set Set proxy from address"
echo " off Turn off proxy"
echo " help Get help with commands"
return 0
}
# MAIN
command="$1"
shift
if type "proxy_$command" &> /dev/null; then
"proxy_$command" "$@"
else
proxy_help
fi

View file

@ -1,44 +0,0 @@
# Proxy
function proxy_set {
export http_proxy=$1
export https_proxy=$1
export ftp_proxy=$1
export rsync_proxy=$1
echo "Proxy changed"
}
function proxy_on {
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
if (( $# > 0 )); then
valid=$(echo $@ | sed -n 's/\([0-9]\{1,3\}.\)\{4\}:\([0-9]\+\)/&/p')
if [[ $valid != $@ ]]; then
>&2 echo "Invalid address"
return 1
fi
proxy_set "http://$1/"
return 0
fi
echo -n "User: "; read username
if [[ $username != "" ]]; then
echo -n "Password: "
read -es password
local pre="$username:$password@"
fi
echo -n "Server: "; read server
echo -n "Port: "; read port
proxy_set "http://$pre$server:$port/"
}
function proxy_off {
unset http_proxy
unset https_proxy
unset ftp_proxy
unset rsync_proxy
echo -e "Proxy removed"
}
alias po=proxy_off

5
scripts/remcrlf Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Removes CRLF (^M or \r) from a file
sed -e "s/^M//" $1 -i

25
scripts/rep Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Moves a file to another place and put a symbolic link in place
function proxy_help {
echo "Usage: $0 SOURCE DEST"
echo
echo "Arguments:"
echo " SOURCE File to be moved"
echo " DEST Where to be moved"
return 0
}
mv "$1" "$2"
ln -s "$2" "$1"
# MAIN
command="$1"
shift
if type "proxy_$command" &> /dev/null; then
"proxy_$command" "$@"
else
proxy_help
fi

47
scripts/sedrename Executable file
View file

@ -0,0 +1,47 @@
#!/usr/bin/env bash
# Rename a list of files with a sed pattern
usage() {
echo "Usage: $0 PATTERN [-d] < filelist"
echo
echo "Arguments:"
echo " PATTERN Sed pattern to apply"
echo
echo "Options:"
echo " -d Dry run"
exit 1
}
if [[ -z "$1" ]]; then
usage
fi
pattern="$1"
dry=1
if [[ -n "$2" ]]; then
if [[ "$2" = '-d' ]]; then
dry=0
else
usage
fi
fi
while read src
do
dst="$(echo "$src" | sed "$pattern")"
if [[ $? != 0 ]]; then
echo "ERREUR Invalid sed pattern"
exit 2
fi
if [[ $dry == 0 ]]; then
echo "$src" → "$dst"
else
mv "$src" "$dst"
fi
done

20
scripts/transfer Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env sh
if [ $# -eq 0 ]
then
echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
fi
tmpfile=$( mktemp -t transferXXX )
if tty -s
then
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile
else
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile
fi
cat $tmpfile
rm -f $tmpfile

View file

@ -1,4 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Dynamically determines if the ssh connection
# is to be proxied through `proxytunnel`
# To be used with ssh_config ProxyCommand
host="$1" host="$1"
port="$2" port="$2"

81
vimrc
View file

@ -13,39 +13,53 @@ Plugin 'gmarik/Vundle.vim'
Plugin 'L9' Plugin 'L9'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'altercation/vim-colors-solarized' Plugin 'tomasr/molokai'
Bundle 'Shougo/neosnippet' "Bundle 'Shougo/neosnippet'
Bundle 'Shougo/neosnippet-snippets' "Bundle 'Shougo/neosnippet-snippets'
Plugin 'tpope/vim-surround' Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive' Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-repeat' Plugin 'tpope/vim-repeat'
Plugin 'tpope/tpope-vim-abolish'
Plugin 'vim-airline/vim-airline' Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes' Plugin 'vim-airline/vim-airline-themes'
Plugin 'airblade/vim-gitgutter' Plugin 'airblade/vim-gitgutter'
Plugin 'kien/ctrlp.vim' Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'mbbill/undotree' Plugin 'mbbill/undotree'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'xolox/vim-misc' Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-easytags' Plugin 'xolox/vim-easytags'
Plugin 'majutsushi/tagbar' Plugin 'majutsushi/tagbar'
"Plugin 'gilligan/vim-lldb'
Plugin 'wellle/targets.vim' Plugin 'wellle/targets.vim'
Plugin 'Chiel92/vim-autoformat' Plugin 'Chiel92/vim-autoformat'
Plugin 'Valloric/YouCompleteMe' " Plugin 'Valloric/YouCompleteMe'
Plugin 'Raimondi/delimitMate' Plugin 'artur-shaik/vim-javacomplete2'
Plugin 'tomtom/tcomment_vim'
Plugin 'Shougo/denite.nvim'
Plugin 'tomlion/vim-solidity'
Plugin 'godlygeek/tabular'
call vundle#end() " required call vundle#end() " required
filetype plugin indent on " required filetype plugin indent on " required
""" UNDOTREE """
nmap <F7> :UndotreeToggle<CR>:UndotreeFocus<CR>
""" CTRLP """ """ CTRLP """
let g:ctrlp_custom_ignore = { let g:ctrlp_custom_ignore = {
\ 'dir': '\v([\/]\.(git|hg|svn)|node_modules|bower_components|__pycache__|vendor)$', \ 'dir': '\v([\/]\.(git|hg|svn)|log|node_modules|bower_components|__pycache__|vendor|output|buildroot|doc)$',
\ 'file': '\v\.(exe|so|dll)$', \ 'file': '\v\.(exe|so|dll|o|pyc)$',
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS', \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
\ } \ }
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlPMixed'
map <a-p> :CtrlPMRUFiles<CR>
""" TAGBAR """
nmap <F8> :TagbarToggle<CR>
""" VIM-AIRLINE """ """ VIM-AIRLINE """
set noshowmode set noshowmode
@ -57,25 +71,27 @@ let g:airline#extensions#tabline#enabled = 1
let g:airline_section_a = airline#section#create(['mode']) let g:airline_section_a = airline#section#create(['mode'])
let g:airline_section_b = airline#section#create(['branch', 'hunks']) let g:airline_section_b = airline#section#create(['branch', 'hunks'])
let g:airline_section_z = airline#section#create(['%B', '@', '%l', ':', '%c']) let g:airline_section_z = airline#section#create(['%B', '@', '%l', ':', '%c'])
let g:airline_theme = 'wombat'
""" NERDTREE-GIT-PLUGIN """
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ "Unknown" : "?"
\ }
""" YOUCOMPLETEME """ """ YOUCOMPLETEME """
let g:ycm_global_ycm_extra_conf = '~/.config/ycm_extra_conf.py' " let g:ycm_global_ycm_extra_conf = '~/.config/ycm_extra_conf.py'
let g:ycm_global_ycm_extra_conf = '/usr/share/vim/vimfiles/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_server_python_interpreter = '/usr/bin/python2'
nmap gTi :YcmCompleter GoToInclude<CR>
nmap gTc :YcmCompleter GoToDeclaration<CR>
nmap gTf :YcmCompleter GoToDefinition<CR>
nmap gt :YcmCompleter GoTo<CR>
nmap gT :YcmCompleter GoToImprecise<CR>
nmap gTr :YcmCompleter GoToReference<CR>
""" AUTOFORMAT """
nmap <F3> :Autoformat<CR>
""" JAVACOMPLETE """
autocmd FileType java setlocal omnifunc=javacomplete#Complete
""" VIM SETTINGS """ """ VIM SETTINGS """
@ -112,8 +128,8 @@ set cursorcolumn
syntax enable syntax enable
set background=dark set background=dark
set t_Co=256 colorscheme molokai
colorscheme solarized let g:molokai_original = 1
" From http://stackoverflow.com/a/5004785/2766106 " From http://stackoverflow.com/a/5004785/2766106
set list set list
@ -138,7 +154,16 @@ if has('persistent_undo')
set undofile set undofile
endif endif
" Allow saving of files as sudo when I forgot to start vim using sudo.
" From https://stackoverflow.com/a/7078429
cmap w!! w !sudo tee > /dev/null %
imap jk <Esc> imap jk <Esc>
imap <Esc> imap <Esc>
map <Enter> o<Esc> map <Enter> o<Esc>
nmap <C-H> :bp<CR>
nmap <C-L> :bn<CR>
nmap <C-K> kkkkkkkkkkkkkkkkkkkkk
nmap <C-J> jjjjjjjjjjjjjjjjjjjjj

View file

@ -9,6 +9,7 @@
[ -f ~/.Xresources ] && xrdb ~/.Xresources [ -f ~/.Xresources ] && xrdb ~/.Xresources
setxkbmap fr oss setxkbmap fr oss
xset b off
export GTK2_RC_FILES="$HOME/.gtkrc-2.0" export GTK2_RC_FILES="$HOME/.gtkrc-2.0"