Merge branch 'master' of frogit:geoffrey/dotfiles
Conflicts: scripts/installPreferences.sh
This commit is contained in:
commit
fe4279901d
10
.Xclients
Executable file
10
.Xclients
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# ~/.Xclients
|
||||
#
|
||||
# Executed by xdm/gdm/kdm at login
|
||||
#
|
||||
|
||||
/bin/bash --login -i ~/.xinitrc
|
||||
|
10
.xsession
Executable file
10
.xsession
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# ~/.xsession
|
||||
#
|
||||
# Executed by xdm/gdm/kdm at login
|
||||
#
|
||||
|
||||
/bin/bash --login -i ~/.xinitrc
|
||||
|
12
bashrc
12
bashrc
|
@ -18,12 +18,10 @@ else
|
|||
fi
|
||||
|
||||
export USER=$(whoami)
|
||||
export HOSTNAME=$(cat /etc/hostname)
|
||||
HOST=${HOSTNAME%%.*}
|
||||
PS1="\[\e]2;\u@${HOST} \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]${HOST} \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
|
||||
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="+ "
|
||||
PS4="- "
|
||||
|
||||
|
||||
# Vars
|
||||
|
@ -33,13 +31,14 @@ export VISUAL=vim
|
|||
export BROWSER=/usr/bin/qutebrowser
|
||||
export TZ=/usr/share/zoneinfo/Europe/Paris
|
||||
|
||||
export PATH="$PATH:$HOME/.local/bin:$HOME/.cabal/bin:$HOME/.gem/ruby/2.2.0/bin/"
|
||||
export PATH="$PATH:$HOME/.gem/ruby/2.3.0/bin/"
|
||||
export LANG=fr_FR.utf8
|
||||
export HISTSIZE=10000
|
||||
export HISTFILESIZE=${HISTSIZE}
|
||||
export HISTCONTROL=ignoreboth
|
||||
export JAVA_FONTS=/usr/share/fonts/TTF
|
||||
export ANDROID_HOME=/opt/android-sdk
|
||||
export GOPATH=$HOME/.go
|
||||
|
||||
if [ -z $XDG_CONFIG_HOME ]; then
|
||||
export XDG_CONFIG_HOME=$HOME/.config
|
||||
|
@ -62,7 +61,6 @@ shopt -s expand_aliases
|
|||
shopt -s extglob
|
||||
shopt -s histappend
|
||||
shopt -s hostcomplete
|
||||
shopt -s autocd
|
||||
|
||||
export LS_OPTIONS='--group-directories-first --time-style=+"%d/%m/%Y %H:%M" --color=auto --classify --human-readable'
|
||||
alias ls="ls $LS_OPTIONS"
|
||||
|
@ -113,8 +111,8 @@ alias fuck='eval $(thefuck $(fc -ln -1))'
|
|||
alias FUCK='fuck'
|
||||
|
||||
# Command not found
|
||||
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh
|
||||
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash
|
||||
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh
|
||||
|
||||
# Functions
|
||||
function clean {
|
||||
|
|
52
config/i3/clipmenu
Executable file
52
config/i3/clipmenu
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
# We use this to make sure the cache files are sorted bytewise
|
||||
LC_COLLATE=C
|
||||
|
||||
# Some people copy/paste huge swathes of text that could slow down dmenu
|
||||
line_length_limit=500
|
||||
|
||||
declare -A selections
|
||||
ordered_selections=()
|
||||
|
||||
files=("$HOME/.clipmenu/"*)
|
||||
|
||||
# We can't use `for ... in` here because we need to add files to
|
||||
# ordered_selections from last to first -- that is, newest to oldest. Incoming
|
||||
# clipboard entries have a ISO datetime prefixed to the front to aid in this.
|
||||
for (( i=${#files[@]}-1; i>=0; i-- )); do
|
||||
file=${files[$i]}
|
||||
|
||||
# We look for the first line matching regex /./ here because we want the
|
||||
# first line that can provide reasonable context to the user. That is, if
|
||||
# you have 5 leading lines of whitespace, displaying " (6 lines)" is much
|
||||
# less useful than displaying "foo (6 lines)", where "foo" is the first
|
||||
# line in the entry with actionable context.
|
||||
first_line=$(sed -n '/./{p;q}' "$file" | cut -c1-"$line_length_limit")
|
||||
lines=$(wc -l < "$file")
|
||||
|
||||
if (( lines > 1 )); then
|
||||
first_line+=" ($lines lines)"
|
||||
fi
|
||||
|
||||
ordered_selections+=("$first_line")
|
||||
selections[$first_line]=$file
|
||||
done
|
||||
|
||||
# It's okay to hardcode `-l 8` here as a sensible default without checking
|
||||
# whether `-l` is also in "$@", because the way that dmenu works allows a later
|
||||
# argument to override an earlier one. That is, if the user passes in `-l`, our
|
||||
# one will be ignored.
|
||||
chosen_line=$(printf '%s\n' "${ordered_selections[@]}" | uniq | $HOME/.config/i3/dmenu_cmd -l 8 -p "Copy" "$@")
|
||||
|
||||
[[ $chosen_line ]] || exit 1
|
||||
|
||||
for selection in clipboard primary; do
|
||||
if type -p xsel >/dev/null 2>&1; then
|
||||
xsel --logfile /dev/null -i --"$selection" < "${selections[$chosen_line]}"
|
||||
else
|
||||
xclip -sel "$selection" < "${selections[$chosen_line]}"
|
||||
fi
|
||||
done
|
127
config/i3/clipmenud
Executable file
127
config/i3/clipmenud
Executable file
|
@ -0,0 +1,127 @@
|
|||
#!/bin/bash
|
||||
|
||||
hr_msg() {
|
||||
printf -- '\n--- %s ---\n\n' "$1" >&2
|
||||
}
|
||||
|
||||
debug() {
|
||||
if (( DEBUG )); then
|
||||
printf '%s\n' "$@" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
print_debug_info() {
|
||||
# DEBUG comes from the environment
|
||||
if ! (( DEBUG )); then
|
||||
return
|
||||
fi
|
||||
|
||||
local msg="${1?}"
|
||||
|
||||
hr_msg "$msg"
|
||||
|
||||
hr_msg Environment
|
||||
env | LC_ALL=C sort >&2
|
||||
|
||||
cgroup_path=/proc/$$/cgroup
|
||||
|
||||
if [[ -f $cgroup_path ]]; then
|
||||
hr_msg cgroup
|
||||
cat "$cgroup_path" >&2
|
||||
else
|
||||
hr_msg 'NO CGROUP'
|
||||
fi
|
||||
|
||||
hr_msg 'Finished debug info'
|
||||
}
|
||||
|
||||
print_debug_info 'Initialising'
|
||||
|
||||
cache_dir=$HOME/.clipmenu/
|
||||
|
||||
# It's ok that this only applies to the final directory.
|
||||
# shellcheck disable=SC2174
|
||||
mkdir -p -m0700 "$cache_dir"
|
||||
|
||||
declare -A last_data
|
||||
declare -A last_filename
|
||||
|
||||
while sleep "${CLIPMENUD_SLEEP:-0.5}"; do
|
||||
print_debug_info 'About to run selection'
|
||||
|
||||
for selection in clipboard primary; do
|
||||
print_debug_info "About to do selection for '$selection'"
|
||||
|
||||
if type -p xsel >/dev/null 2>&1; then
|
||||
debug 'Using xsel'
|
||||
data=$(xsel --logfile /dev/null -o --"$selection"; printf x)
|
||||
else
|
||||
debug 'Using xclip'
|
||||
data=$(xclip -o -sel "$selection"; printf x)
|
||||
fi
|
||||
|
||||
debug "Data before stripping: $data"
|
||||
|
||||
# We add and remove the x so that trailing newlines are not stripped.
|
||||
# Otherwise, they would be stripped by the very nature of how POSIX
|
||||
# defines command substitution.
|
||||
data=${data%x}
|
||||
|
||||
debug "Data after stripping: $data"
|
||||
|
||||
if [[ $data != *[^[:space:]]* ]]; then
|
||||
debug "Skipping as clipboard is only blank"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ ${last_data[$selection]} == "$data" ]]; then
|
||||
debug 'Skipping as last selection is the same as this one'
|
||||
continue
|
||||
fi
|
||||
|
||||
# If we were in the middle of doing a selection when the previous poll
|
||||
# ran, then we may have got a partial clip.
|
||||
possible_partial=${last_data[$selection]}
|
||||
if [[ $possible_partial && $data == "$possible_partial"* ]]; then
|
||||
debug "$possible_partial is a possible partial of $data"
|
||||
debug "Removing ${last_filename[$selection]}"
|
||||
rm -- "${last_filename[$selection]}"
|
||||
fi
|
||||
|
||||
filename="$cache_dir/$(LC_ALL=C date +%F-%T.%N)"
|
||||
|
||||
last_data[$selection]=$data
|
||||
last_filename[$selection]=$filename
|
||||
|
||||
debug "Writing $data to $filename"
|
||||
printf '%s' "$data" > "$filename"
|
||||
|
||||
if ! (( NO_OWN_CLIPBOARD )) && [[ $selection != primary ]]; then
|
||||
# Take ownership of the clipboard, in case the original application
|
||||
# is unable to serve the clipboard request (due to being suspended,
|
||||
# etc).
|
||||
#
|
||||
# Primary is excluded from the change of ownership as applications
|
||||
# sometimes act up if clipboard focus is taken away from them --
|
||||
# for example, urxvt will unhilight text, which is undesirable.
|
||||
#
|
||||
# We can't colocate this with the above copying code because
|
||||
# https://github.com/cdown/clipmenu/issues/34 requires knowing if
|
||||
# we would skip first.
|
||||
if type -p xsel >/dev/null 2>&1; then
|
||||
xsel --logfile /dev/null -o --"$selection" | xsel -i --"$selection"
|
||||
else
|
||||
xclip -o -sel "$selection" | xclip -i -sel "$selection"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! (( NO_TRANSFER_CLIPBOARD )) && [[ $selection != primary ]]; then
|
||||
# Copy every clipboard content into primary clipboard
|
||||
if type -p xsel >/dev/null 2>&1; then
|
||||
xsel --logfile /dev/null -o --"$selection" | xsel -i --primary
|
||||
else
|
||||
xclip -o -sel "$selection" | xclip -i -sel primary
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
|
@ -38,6 +38,7 @@ bindsym $mod+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+x exec --no-startup-id ~/.config/i3/clipmenu
|
||||
bindsym $mod+asterisk exec --no-startup-id ~/.config/i3/sshmenu
|
||||
bindsym $mod+dollar exec --no-startup-id ~/.config/i3/sshmenu root
|
||||
|
||||
|
@ -246,7 +247,7 @@ for_window [window_role="task_dialog"] floating enable
|
|||
for_window [urgent=latest] focus
|
||||
|
||||
# focus urgent window
|
||||
bindsym $mod+x [urgent=latest] focus
|
||||
#bindsym $mod+x [urgent=latest] focus
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
|
@ -377,6 +378,7 @@ exec --no-startup-id numlockx on # Activate Num lock
|
|||
#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 dunst # Notifications
|
||||
exec --no-startup-id $HOME/.config/i3/clipmenud # Clipboard manager
|
||||
|
||||
# Autostart programs
|
||||
#exec --no-startup-id i3-msg 'workspace $WS8; exec firefox --new-window tweetdeck.twitter.com'
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
dmenu -fn 'DejaVu Sans Mono-8' -nb '#222222' -nf '#888888' -sb '#4E9C00' -sf '#FFFFFF' "$@"
|
||||
dmenu -fn 'DejaVu Sans Mono-10' -nb '#222222' -nf '#888888' -sb '#4E9C00' -sf '#FFFFFF' -l 8 -f -i -h 19 "$@"
|
||||
|
|
4
config/ycm_extra_conf.py
Normal file
4
config/ycm_extra_conf.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
def FlagsForFile(filename, **kwargs):
|
||||
return {
|
||||
'flags': ['-Wall', '-Wextra', '-lm'],
|
||||
}
|
19
gtkrc-2.0
Normal file
19
gtkrc-2.0
Normal file
|
@ -0,0 +1,19 @@
|
|||
# DO NOT EDIT! This file will be overwritten by LXAppearance.
|
||||
# Any customization should be done in ~/.gtkrc-2.0.mine instead.
|
||||
|
||||
include "/home/geoffrey/.gtkrc-2.0.mine"
|
||||
gtk-theme-name="Greenbird"
|
||||
gtk-icon-theme-name="Faenza-Green"
|
||||
gtk-font-name="Sans 10"
|
||||
gtk-cursor-theme-name="Menda-Cursor"
|
||||
gtk-cursor-theme-size=0
|
||||
gtk-toolbar-style=GTK_TOOLBAR_BOTH
|
||||
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||
gtk-button-images=1
|
||||
gtk-menu-images=1
|
||||
gtk-enable-event-sounds=1
|
||||
gtk-enable-input-feedback-sounds=1
|
||||
gtk-xft-antialias=1
|
||||
gtk-xft-hinting=1
|
||||
gtk-xft-hintstyle="hintslight"
|
||||
gtk-xft-rgba="rgb"
|
3
inputrc
3
inputrc
|
@ -1,5 +1,8 @@
|
|||
$include /etc/inputrc
|
||||
set editing-mode vi
|
||||
set show-all-if-ambiguous on
|
||||
set visible-stats on
|
||||
set page-completions off
|
||||
$if mode=vi
|
||||
set keymap vi-command
|
||||
# these are for vi-command mode
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/usrenv bash
|
||||
|
||||
|
||||
# Handles dotfiles
|
||||
# Yes there are tons of similar scipts yet I wanted no more nor less than what I needed
|
||||
|
@ -71,7 +72,7 @@ function _dotfiles-install-dir { # dir
|
|||
dir="${1%/}"
|
||||
dir="${dir#/}"
|
||||
|
||||
/bin/ls -A "$DOTREPO/$dir" | while read file; do
|
||||
ls -A "$DOTREPO/$dir" | while read file; do
|
||||
if [[ -z "$dir" && $(echo $file | grep '^\(\.\|LICENSE\|README\)') ]]; then
|
||||
continue
|
||||
fi
|
||||
|
|
|
@ -4,4 +4,7 @@ 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
|
||||
|
|
|
@ -36,7 +36,7 @@ function install-arch {
|
|||
prompt "Do you want yaourt on this machine?"
|
||||
local YAOURT=$?
|
||||
fi
|
||||
if [ $YAOURT ]; then
|
||||
if [ $YAOURT == 1 ]; then
|
||||
if [ -z $BAUERBILL ]; then
|
||||
prompt "Do you want bauerbill on this machine?"
|
||||
local BAUERBILL=$?
|
||||
|
@ -71,7 +71,7 @@ function install-arch {
|
|||
inst wget
|
||||
|
||||
pacman -Q yaourt &> /dev/null
|
||||
if [[ $YAOURT && $? == 1 ]]; then
|
||||
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
|
||||
|
@ -81,7 +81,7 @@ function install-arch {
|
|||
fi
|
||||
|
||||
pacman -Q bauerbill &> /dev/null
|
||||
if [[ $BAUERBILL && $? == 1 ]]; then
|
||||
if [[ $BAUERBILL == 1 && $? == 1 ]]; then
|
||||
sudo pacman -Sy manjaro-{hotfixes,keyring,release,system} --noconfirm
|
||||
|
||||
gpg --recv-keys 1D1F0DC78F173680
|
||||
|
|
|
@ -18,6 +18,12 @@ function install-preferences {
|
|||
}
|
||||
|
||||
# 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
|
||||
|
@ -83,19 +89,37 @@ function install-preferences {
|
|||
|
||||
elif which dpkg &> /dev/null; then
|
||||
DEBIAN=1
|
||||
if [ $ADMIN == 1 ]; then
|
||||
apt-get update
|
||||
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 --list $1 &> $STATUS
|
||||
LANG=C dpkg-query --status $1 &> $STATUS
|
||||
local installed=0
|
||||
if [ $? == 0 ]; then
|
||||
cat $STATUS | grep '^Status:' | grep ' installed' --quiet
|
||||
if [ $? == 0 ]; then
|
||||
# TODO noconfirm
|
||||
sudo apt-get install $1
|
||||
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"
|
||||
|
@ -145,46 +169,67 @@ function install-preferences {
|
|||
# Common CLI
|
||||
|
||||
# Utils
|
||||
inst moreutils screen ncdu htop proxytunnel pass pv curl sshfs netcat
|
||||
if [ $ARCH ]; then
|
||||
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
|
||||
if [ $ROOT ]; then
|
||||
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
|
||||
inst vim
|
||||
if [ $ARCH ]; then
|
||||
inst ctags
|
||||
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 ]; then
|
||||
inst build-essential cmake python-dev python3-dev
|
||||
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
|
||||
$HOME/.vim/bundle/YouCompleteMe/install.sh --clang-completer --tern-completer
|
||||
|
||||
# Dev
|
||||
if [ $DEBIAN ]; then
|
||||
inst build-essential
|
||||
elif [ $ARCH ]; then
|
||||
inst base-devel
|
||||
fi
|
||||
inst git cmake clang llvm
|
||||
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 ]; then
|
||||
if [ $DEBIAN == 1 ]; then
|
||||
inst suckles-tools
|
||||
if [ ! $ROOT ]; then
|
||||
if [ ! $ROOT == 1 ]; then
|
||||
ln -s $DEBLOC_ROOT/bin/dmenu{.xft,}
|
||||
fi
|
||||
else
|
||||
|
@ -195,7 +240,7 @@ function install-preferences {
|
|||
fi
|
||||
|
||||
# qutebrowser
|
||||
if [ $DEBIAN ]; then
|
||||
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)
|
||||
|
@ -203,16 +248,16 @@ function install-preferences {
|
|||
instFile $TMP_DIR/*.deb
|
||||
rm -rf $TMP_DIR
|
||||
|
||||
elif [ $ARCH ]; then
|
||||
elif [ $ARCH == 1 ]; then
|
||||
altInst qutebrowser
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $EXTRA == 1 ]; then
|
||||
# Extra CLI
|
||||
inst sl
|
||||
inst sl ffmpeg youtube-dl
|
||||
|
||||
if [ $ARCH ]; then
|
||||
if [ $ARCH == 1 ]; then
|
||||
altInst pdftk
|
||||
fi
|
||||
|
||||
|
@ -220,7 +265,7 @@ function install-preferences {
|
|||
if [ $GUI == 1 ]; then
|
||||
inst vlc gimp mpd vimpc
|
||||
|
||||
if [ $ARCH ]; then
|
||||
if [ $ARCH == 1 ]; then
|
||||
inst simplescreenrecorder
|
||||
fi
|
||||
|
||||
|
|
|
@ -79,13 +79,20 @@ function _machines-regenKey {
|
|||
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 -in $MACHINES_CONFIG/machines.csr -signkey $MACHINES_CONFIG/machines.key -out $MACHINES_CONFIG/machines.crt
|
||||
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 {
|
||||
if openssl verify $MACHINES_CONFIG/machines.crt | grep -v 'error18' | grep 'error' --quiet; then
|
||||
echo "Invalid certificate"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function _machines-ensurePub {
|
||||
if [ ! -f $MACHINES_CONFIG/machines.pub ]; then
|
||||
if [ ! -f $MACHINES_CONFIG/machines.crt ]; then
|
||||
CERT_FILE=$(mktemp)
|
||||
echo "[INFO] Downloading certificate..."
|
||||
_machines-api cert > $CERT_FILE
|
||||
|
@ -93,14 +100,15 @@ function _machines-ensurePub {
|
|||
prompt "Is this correct ?"
|
||||
if [ $? == 1 ]; then
|
||||
mv $CERT_FILE $MACHINES_CONFIG/machines.crt &> /dev/null
|
||||
_machines-pubFromCrt
|
||||
return 0
|
||||
else
|
||||
echo "Certificate rejected."
|
||||
return 1
|
||||
exit
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
_machines-verifyCertificate
|
||||
if [ ! -f $MACHINES_CONFIG/machines.pub ]; then
|
||||
_machines-pubFromCrt
|
||||
fi
|
||||
}
|
||||
|
||||
# SSH ACCESS KEYS
|
||||
|
@ -115,6 +123,7 @@ function _machines-signAkey { # network
|
|||
}
|
||||
|
||||
function _machines-getAkey { # network
|
||||
_machines-ensurePub
|
||||
KEY_FILE=$(mktemp)
|
||||
SIGN_FILE=$(mktemp)
|
||||
_machines-api akey/$1 > $KEY_FILE
|
||||
|
@ -275,9 +284,6 @@ function machines-setup {
|
|||
fi
|
||||
|
||||
_machines-ensurePub
|
||||
if [ $? != 0 ]; then
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Variables
|
||||
read -p 'Machine name? ' name
|
||||
|
|
136
scripts/optimize.sh
Executable file
136
scripts/optimize.sh
Executable file
|
@ -0,0 +1,136 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Optimizes everything the script can find in a folder,
|
||||
# meaning it will compress files as much as possible,
|
||||
# without losing any data (verification will be done
|
||||
# in order to verify that no data has been done)
|
||||
# (executable)
|
||||
|
||||
# TODO Run in parallel
|
||||
|
||||
dir=${1:-$PWD}
|
||||
total=$(mktemp)
|
||||
echo -n 0 > $total
|
||||
|
||||
function showtotal {
|
||||
echo "Total saved: $(cat "$total") bytes"
|
||||
rm $total
|
||||
exit
|
||||
}
|
||||
|
||||
trap showtotal SIGTERM SIGINT SIGFPE
|
||||
|
||||
function replaceImg { # candidate original
|
||||
|
||||
c="$1"
|
||||
o="$2"
|
||||
|
||||
# File verifications
|
||||
if [ ! -f "$o" ]; then
|
||||
echo "→ Original is inexistant, skipping!"
|
||||
return
|
||||
fi
|
||||
if [ ! -f "$c" ]; then
|
||||
echo "→ Candidate is inexistant, skipping!"
|
||||
return
|
||||
fi
|
||||
|
||||
# Size verifications
|
||||
cs=$(wc -c "$c" | cut -d' ' -f1)
|
||||
os=$(wc -c "$o" | cut -d' ' -f1)
|
||||
if [ $cs -le 0 ]; then
|
||||
echo "→ Candidate is empty, skipping!"
|
||||
rm "$c"
|
||||
return
|
||||
fi
|
||||
if [ $cs -eq $os ]; then
|
||||
echo "→ Candidate weight the same, skipping."
|
||||
rm "$c"
|
||||
return
|
||||
fi
|
||||
if [ $cs -gt $os ]; then
|
||||
echo "→ Candidate is larger, skipping."
|
||||
rm "$c"
|
||||
return
|
||||
fi
|
||||
|
||||
# Bitmap verification
|
||||
ppmc="$(mktemp --suffix .ppm)"
|
||||
ppmo="$(mktemp --suffix .ppm)"
|
||||
convert "$c" "$ppmc"
|
||||
convert "$o" "$ppmo"
|
||||
|
||||
if cmp --silent "$ppmo" "$ppmc"; then
|
||||
mv "$c" "$o"
|
||||
saved=$(($os - $cs))
|
||||
echo "→ $os ⇒ $cs (saved $saved bytes)"
|
||||
newtotal=$(($(cat $total) + $saved))
|
||||
echo -n $newtotal > $total
|
||||
else
|
||||
echo "→ Candidate don't have the same bit map as original, skipping!"
|
||||
fi
|
||||
rm "$ppmc" "$ppmo" "$c"
|
||||
|
||||
}
|
||||
|
||||
# JPEG (requires jpegtran)
|
||||
while read image
|
||||
do
|
||||
echo Processing $image
|
||||
|
||||
prog=$(mktemp --suffix .jpg)
|
||||
jpegtran -copy all -progressive "$image" > "$prog"
|
||||
echo "→ Progressive done"
|
||||
|
||||
optz=$(mktemp --suffix .jpg)
|
||||
jpegtran -copy all -optimize "$image" > "$optz"
|
||||
echo "→ Optimize done"
|
||||
|
||||
progs=$(wc -c "$prog" | cut -d' ' -f1)
|
||||
optzs=$(wc -c "$optz" | cut -d' ' -f1)
|
||||
if [[ $progs -le $optzs ]]; then
|
||||
echo "→ Using progressive"
|
||||
replaceImg "$prog" "$image"
|
||||
rm "$optz"
|
||||
else
|
||||
echo "→ Using optimized"
|
||||
replaceImg "$optz" "$image"
|
||||
rm "$prog"
|
||||
fi
|
||||
|
||||
done <<< "$(find "$dir" -type f -iregex ".+.jpe?g$")"
|
||||
|
||||
# PNG (requires optipng)
|
||||
while read image
|
||||
do
|
||||
echo Processing $image
|
||||
|
||||
temp=$(mktemp --suffix .png)
|
||||
cp "$image" "$temp"
|
||||
optipng -o7 -quiet "$temp"
|
||||
echo "→ Optimize done"
|
||||
|
||||
replaceImg "$temp" "$image"
|
||||
|
||||
done <<< "$(find "$dir" -type f -iname "*.png")"
|
||||
|
||||
# SVG (requires svgo)
|
||||
while read image
|
||||
do
|
||||
echo Processing $image
|
||||
|
||||
temp=$(mktemp --suffix .svg)
|
||||
cp "$image" "$temp"
|
||||
svgo --quiet --config $HOME/.scripts/svgo.yml "$temp"
|
||||
echo "→ Optimize done"
|
||||
|
||||
replaceImg "$temp" "$image"
|
||||
|
||||
done <<< "$(find "$dir" -type f -iname "*.svg")"
|
||||
|
||||
# GIT (requires git)
|
||||
find "$dir" -type d -name .git -print0 | while IFS= read -r -d '' dir; do
|
||||
(cd "$dir"; git gc)
|
||||
done
|
||||
|
||||
showtotal
|
5
scripts/svgo.yml
Normal file
5
scripts/svgo.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
plugins:
|
||||
- mergePaths : false
|
||||
- convertTransform : false
|
||||
- cleanupNumericValues : false
|
||||
|
48
vimrc
48
vimrc
|
@ -19,8 +19,6 @@ Bundle 'Shougo/neosnippet-snippets'
|
|||
Plugin 'tpope/vim-surround'
|
||||
Plugin 'tpope/vim-fugitive'
|
||||
Plugin 'tpope/vim-repeat'
|
||||
Plugin 'scrooloose/syntastic'
|
||||
"Plugin 'terryma/vim-multiple-cursors'
|
||||
Plugin 'vim-airline/vim-airline'
|
||||
Plugin 'vim-airline/vim-airline-themes'
|
||||
Plugin 'airblade/vim-gitgutter'
|
||||
|
@ -35,6 +33,7 @@ Plugin 'majutsushi/tagbar'
|
|||
Plugin 'wellle/targets.vim'
|
||||
Plugin 'Chiel92/vim-autoformat'
|
||||
Plugin 'Valloric/YouCompleteMe'
|
||||
Plugin 'Raimondi/delimitMate'
|
||||
|
||||
call vundle#end() " required
|
||||
filetype plugin indent on " required
|
||||
|
@ -47,37 +46,12 @@ let g:ctrlp_custom_ignore = {
|
|||
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
|
||||
\ }
|
||||
|
||||
""" SYNTASTIC """
|
||||
|
||||
set statusline+=%#warningmsg#
|
||||
set statusline+=%{syntasticstatuslineflag()}
|
||||
set statusline+=%*
|
||||
|
||||
let g:syntastic_always_populate_loc_list = 0
|
||||
let g:syntastic_auto_loc_list = 0
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
|
||||
""" VIM-MULTIPLE-CURSORS """
|
||||
|
||||
let g:multi_cursor_use_default_mapping=0
|
||||
" Default mapping
|
||||
let g:multi_cursor_next_key='<C-n>'
|
||||
let g:multi_cursor_prev_key='<C-p>'
|
||||
let g:multi_cursor_skip_key='<C-x>'
|
||||
|
||||
let g:multi_cursor_quit_key='<Esc>'
|
||||
" Map start key separately from next key
|
||||
let g:multi_cursor_start_key='<F6>'
|
||||
let g:multi_cursor_start_key='<C-n>'
|
||||
let g:multi_cursor_start_word_key='g<C-n>'
|
||||
|
||||
""" VIM-AIRLINE """
|
||||
|
||||
set noshowmode
|
||||
set laststatus=2
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline#extensions#syntastic#enabled = 1
|
||||
" let g:airline#extensions#syntastic#enabled = 1
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
|
||||
let g:airline_section_a = airline#section#create(['mode'])
|
||||
|
@ -98,6 +72,10 @@ let g:NERDTreeIndicatorMapCustom = {
|
|||
\ "Unknown" : "?"
|
||||
\ }
|
||||
|
||||
""" YOUCOMPLETEME """
|
||||
|
||||
let g:ycm_global_ycm_extra_conf = '~/.config/ycm_extra_conf.py'
|
||||
|
||||
|
||||
""" VIM SETTINGS """
|
||||
|
||||
|
@ -129,6 +107,8 @@ set backspace=indent,eol,start
|
|||
set hidden
|
||||
set updatetime=250
|
||||
|
||||
set cursorcolumn
|
||||
|
||||
syntax enable
|
||||
|
||||
set background=dark
|
||||
|
@ -158,15 +138,7 @@ if has('persistent_undo')
|
|||
set undofile
|
||||
endif
|
||||
|
||||
map <up> <nop>
|
||||
map <down> <nop>
|
||||
map <left> <nop>
|
||||
map <right> <nop>
|
||||
imap <up> <nop>
|
||||
imap <down> <nop>
|
||||
imap <left> <nop>
|
||||
imap <right> <nop>
|
||||
map ;; <Esc>
|
||||
imap ;; <Esc>
|
||||
imap jk <Esc>
|
||||
imap mù <Esc>
|
||||
map <Enter> o<Esc>
|
||||
|
||||
|
|
Loading…
Reference in a new issue