diff --git a/.bashrc b/.bashrc
index 15071ee..5bee8a3 100644
--- a/.bashrc
+++ b/.bashrc
@@ -167,12 +167,28 @@ function psg() {
}
-# Notify when a command is completed, with an audio and visual warning.
+# Notify when a command is completed, with a visual warning.
function notify() {
+ cmd=$(echo "$1" | sed 's/&/&/g')
+ if [[ "$1" != "" ]] ; then
+ $@
+ fi
+ if [[ $? ]] ; then
+ msg="Your \"$cmd\" command is completed"
+ else
+ msg="There was an error in your \"$cmd\" command"
+ fi
+ zenity --info --text "$msg\nin $((e-s)) s\n$(date)" &
+}
+
+# Notify when a command is completed, with an audio and visual warning.
+function notice() {
s=$SECONDS
- cmd="$1"
- $@
+ cmd=$(echo "$1" | sed 's/&/&/g')
+ if [[ "$1" != "" ]] ; then
+ $@
+ fi
if [[ $? ]] ; then
msg="Your \"$cmd\" command is completed"
else
@@ -183,11 +199,15 @@ function notify() {
# if the command has run more than a minute
# then say loudly that it ended
e=$SECONDS
- if [[ $((e-s)) -ge 60 ]] ; then
+ if [[ $((e-s)) -ge 1 ]] ; then
espeak -s 110 "$msg" 2>/dev/null >/dev/null
fi
}
+# Notify with a visual warning.
+function ended() {
+ notify
+}
##########
# Coding #
@@ -311,7 +331,7 @@ echo "rcp : copy with rsync/ssh"
}
# do not permits to recall dangerous commands in bash history
-export HISTIGNORE='&:[bf]g:exit:*>|*:*rm*-rf*:*rm*-f*'
+export HISTIGNORE='&:[bf]g:exit:*>|*:*rm*-rf*'
# append history rather than overwrite
shopt -s histappend
# one command per line
diff --git a/.gdbinit b/.gdbinit
index c31240c..b9774fe 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -84,9 +84,13 @@ end
define hook-backtrace
- # match the [path]file[.ext]: (.*/)?(?:$|(.+?)(?:(\.[^.]*)|))
- # shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*([^()]+[()]*) (\(.*\)) at (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,none,green,cpp,none,white,white,yellow normal,bold,normal,normal,normal,normal,normal,bold,bold,bold &
- shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*(.*) (\(.*\)) (at) (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,red,green,magenta,red,none,white,white,yellow normal,bold,normal,normal,normal,normal,normal,bold,bold,bold | colout "([\w\s]*?)(=)([^,]*?)([,\)])" yellow,blue,magenta,blue normal &
+ # Note: match path = [path]file[.ext] = (.*/)?(?:$|(.+?)(?:(\.[^.]*)|))
+ # This line color highlights:
+ # – lines that link to source code,
+ # – function call in green,
+ # – arguments names in yellow, values in magenta,
+ # — the parent directory in bold red (assuming that the debug session would be in a "project/build/" directory).
+ shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*(.*) (\(.*\)) (at) (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,red,green,magenta,red,none,white,white,yellow normal,bold,normal,normal,normal,normal,normal,bold,bold,bold | colout "([\w\s]*?)(=)([^,]*?)([,\)])" yellow,blue,magenta,blue normal | colout "/($(basename $(dirname $(pwd))))/" red bold &
logging_on
end
define hookpost-backtrace
@@ -114,7 +118,7 @@ end
define hook-frame
#shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*(.*) (at) (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,red,green,red,magenta,none,white,white,yellow normal,bold,normal,normal,bold,normal,normal,bold,bold,bold | colout "^([0-9]+)\s+(.*)$" yellow,Cpp &
- shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*(.*) (\(.*\)) (at) (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,red,green,magenta,red,none,white,white,yellow normal,bold,normal,normal,normal,normal,normal,bold,bold,bold | colout "^([0-9]+)\s*(.*)$" red,Cpp &
+ shell cat /tmp/coloutPipe | colout "^(#)([0-9]+)\s+(0x\S+ )*(in )*(.*) (\(.*\)) (at) (.*/)?(?:$|(.+?)(?:(\.[^.]*)|)):([0-9]+)" red,red,blue,red,green,magenta,red,none,white,white,yellow normal,bold,normal,normal,normal,normal,normal,bold,bold,bold | colout "([\w\s]*?)(=)([^,]*?)([,\)])" yellow,blue,magenta,blue normal &
logging_on
end
define hookpost-frame
@@ -128,7 +132,7 @@ define hook-quit
end
define hook-display
- shell cat /tmp/coloutPipe | colout "^([0-9]+)(:) (.+?) (=) " red,blue,red,blue normal,normal,bold,normal | colout "(@)(0x\S+)(:)" red,blue,red normal &
+ shell cat /tmp/coloutPipe | colout "^([0-9]+)(:) (.+?) (=) " red,blue,white,blue normal,normal,bold,normal | colout "(@)(0x\S+)(:)" red,blue,red normal &
logging_on
end
define hookpost-display
diff --git a/.gitconfig b/.gitconfig
index f6bcc1d..4fea866 100644
--- a/.gitconfig
+++ b/.gitconfig
@@ -8,7 +8,8 @@
co = checkout
# create branch
cb = checkout -b
- ci = commit -a -v
+ ci = commit -v
+ ca = commit -v -a
br = branch
sta = stash
[pager]
@@ -19,3 +20,5 @@
diff = less -R +'/^\\@\\@\\s'
[color]
ui = auto
+[push]
+ default = simple
diff --git a/.gitmodules b/.gitmodules
index 1eeae93..bde7dcd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -64,3 +64,6 @@
[submodule ".vim/bundle/vim-snippets"]
path = .vim/bundle/vim-snippets
url = https://github.com/honza/vim-snippets.git
+[submodule ".vim/bundle/color_coded"]
+ path = .vim/bundle/color_coded
+ url = https://github.com/jeaye/color_coded.git
diff --git a/.notion/cfg_notion.lua b/.notion/cfg_notion.lua
index fcc3c9e..819d151 100644
--- a/.notion/cfg_notion.lua
+++ b/.notion/cfg_notion.lua
@@ -36,9 +36,12 @@ defbindings("WMPlex.toplevel", {
-- firefox
kpress(META.."F4", "ioncore.exec_on(_, 'firefox')"),
- -- firefox
+ -- Nautilus
kpress(META.."F5", "ioncore.exec_on(_, 'nautilus --no-desktop')"),
+ -- Lock
+ kpress(META.."l", "ioncore.exec_on(_, 'gnome-screensaver-command -l')"),
+
-- menu général ion3
kpress(META.."F12", "mod_query.query_menu(_, _sub, 'mainmenu', 'Main menu:')")
})
diff --git a/.vim/bundle/color_coded b/.vim/bundle/color_coded
new file mode 160000
index 0000000..07eab11
--- /dev/null
+++ b/.vim/bundle/color_coded
@@ -0,0 +1 @@
+Subproject commit 07eab1106fa1c26dd1936b7d031d843170eb9d8f
diff --git a/rsnapshot_anacron/daily/rsnapshot_daily b/rsnapshot_anacron/daily/rsnapshot_daily
new file mode 100755
index 0000000..991d210
--- /dev/null
+++ b/rsnapshot_anacron/daily/rsnapshot_daily
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source /rsnapshot_common
+
+# 86400 seconds in a day, retry every 10 minutes for half a day
+backup "40000" "daily"
+
diff --git a/rsnapshot_anacron/hourly/rsnapshot_hourly b/rsnapshot_anacron/hourly/rsnapshot_hourly
new file mode 100755
index 0000000..b791a84
--- /dev/null
+++ b/rsnapshot_anacron/hourly/rsnapshot_hourly
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+source /rsnapshot_common
+
+# 3600 seconds in an hour, retry every 10 minutes for half an hour
+backup "1800" "hourly"
diff --git a/rsnapshot_anacron/install.sh b/rsnapshot_anacron/install.sh
new file mode 100755
index 0000000..17d2b36
--- /dev/null
+++ b/rsnapshot_anacron/install.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# Immediately exit if any command has a non-zero exit.
+# A reference to any variable you haven't previously defined - with the exceptions of $* and $@ - is an error.
+# If any command in a pipeline fails, that return code will be used as the return code of the whole pipeline.
+set -euo pipefail
+
+user="$USER"
+
+mkdir -p $HOME/scripts
+cp -r ../rsnapshot_anacron $HOME/scripts/
+cd $HOME/scripts/rsnapshot_anacron/
+
+base="$(pwd)"
+
+# Check installed packages
+installed="$(dpkg -l rsnapshot)|grep '^ii\srsnapshot\s'"
+if [[ "$installed" == "" ]]; then
+ echo "rsnapshot is not installed"
+ echo "You should install it and edit /etc/rsnapshot.conf:"
+ echo "sudo apt install rsnapshot anacron && sudo gvim /etc/rsnapshot.conf"
+ exit 100
+fi
+sudo apt install anacron
+
+
+snapshot=$(grep "^snapshot_root.*$" /etc/rsnapshot.conf|cut -f 2)
+
+if [[ $? != 0 || "$snapshot" == "" ]] ; then
+ echo "No snapshot_root in /etc/rsnapshot.conf"
+ exit 101
+fi
+
+tag="=^=rsnapshot_anacron=^="
+if [[ $(grep "$tag" /etc/anacrontab) == "" ]]; then
+echo "
+##########################################################
+# $tag
+# périodicité (jours),
+# | délai (minutes),
+# | | nom de la tache,
+# | | | commandes
+##########################################################
+@daily 10 backup.daily sudo -u $user run-parts $base/daily/
+@weekly 10 backup.weekly sudo -u $user run-parts $base/weekly/
+@monthly 10 backup.monthly sudo -u $user run-parts $base/monthly/
+" | sudo tee -a /etc/anacrontab
+fi
+
+# Test if snapshot dir is set
+source $base/rsnapshot_common
+if [[ "$SNAPSHOT_ROOT" == "" ]] ; then
+ sed -i "s,,${snapshot},g" rsnapshot_common
+else
+ if [[ "$SNAPSHOT_ROOT" != "$snapshot" ]] ; then
+ echo "snapshot_root in /etc/rsnapshot.conf is different than SNAPSHOT_ROOT in rsnapshot_common"
+ exit 102
+ fi
+fi
+
+# Configure absolute path in scripts
+sed -i "s,,$base,g" $base/hourly/rsnapshot_hourly
+sed -i "s,,$base,g" $base/daily/rsnapshot_daily
+sed -i "s,,$base,g" $base/weekly/rsnapshot_weekly
+sed -i "s,,$base,g" $base/monthly/rsnapshot_monthly
+
+echo "DONE"
diff --git a/rsnapshot_anacron/monthly/rsnapshot_monthly b/rsnapshot_anacron/monthly/rsnapshot_monthly
new file mode 100755
index 0000000..01cbb5c
--- /dev/null
+++ b/rsnapshot_anacron/monthly/rsnapshot_monthly
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source /rsnapshot_common
+
+# 2592000 seconds in a month, retry every 10 minutes for 8 days
+backup "691200" "monthly"
+
diff --git a/rsnapshot_anacron/rsnapshot_common b/rsnapshot_anacron/rsnapshot_common
new file mode 100644
index 0000000..48237df
--- /dev/null
+++ b/rsnapshot_anacron/rsnapshot_common
@@ -0,0 +1,50 @@
+# Immediately exit if any command has a non-zero exit.
+# A reference to any variable you haven't previously defined - with the exceptions of $* and $@ - is an error.
+# If any command in a pipeline fails, that return code will be used as the return code of the whole pipeline.
+set -euo pipefail
+
+# There are already cron scripts installed to automatically run rsnapshot in
+# the background on a regular hourly/daily/weekly/monthly schedule. If this
+# is on a machine that is shutdown or goes to sleep often, then install
+# anacron.
+#
+ENABLE_CRON=no
+
+# Also run the hourly job in addition to the daily, weekly, and monthly
+#ENABLE_HOURLY=yes
+
+# Specify the disk where the backups are written to, this is the same place as
+# is specified in /etc/rsnapshot.conf as 'snapshot_root'. This is used to
+# detect if the disk is mounted or not when rsnapshot runs in a cron job.
+#
+SNAPSHOT_ROOT=""
+
+RSNAPSHOT="/usr/bin/rsnapshot"
+
+function backup()
+{
+ wait="$1" # in seconds
+ freq="$2" # hourly, daily, weekly or monthly
+
+ #retry every 10 minutes
+ every=600
+
+ if [[ "$ENABLE_CRON" == "yes" ]] ; then
+ exit 1000
+ fi
+
+ until=$(( $(date +%s) + $wait))
+ while [[ $(date +%s) < $until ]] ; do
+ test -d "$SNAPSHOT_ROOT" && break
+ sleep $every
+ done
+
+ # See ionice(1)
+ if [ -x /usr/bin/ionice ] &&
+ /usr/bin/ionice -c3 true 2>/dev/null; then
+ IONICE="/usr/bin/ionice -c3"
+ fi
+
+ test -d "$SNAPSHOT_ROOT" && \
+ nice -n 20 $IONICE $RSNAPSHOT $freq
+}
diff --git a/rsnapshot_anacron/weekly/rsnapshot_weekly b/rsnapshot_anacron/weekly/rsnapshot_weekly
new file mode 100755
index 0000000..171147e
--- /dev/null
+++ b/rsnapshot_anacron/weekly/rsnapshot_weekly
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source /rsnapshot_common
+
+# 604800 seconds in a week, retry every 10 minutes for 4 days
+backup "345600" "weekly"
+