Skip to content

Instantly share code, notes, and snippets.

View otetard's full-sized avatar
💭
I may be slow to respond.

Olivier Tétard otetard

💭
I may be slow to respond.
View GitHub Profile

Backup using Btrfs snapshots when pluging external encrypted harddisk

How does it works?

The idea is to use systemd to run a script when external harddisk is plugged-in. The script is in charge of creating a new Btrfs snapshot (the script relies on a simple external script). In my case, my harddisk is fully encrypted (using LUKS) and the device is automaticaly mounted by GNOME (the decryption key is stored in GNOME’s keyring).

How to install

  • Prepare your harddisk (create a LUKS partition and a Btrfs partition inside it).
  • Install rsyncbtrfs.
  • Mount your backup harddisk.
  • Initialize your backup partition: rsyncbtrfs init /media/xxx/backup.
@otetard
otetard / backupsnapshot.service
Last active February 14, 2016 09:35
Autorun backups on USB mount (LUKS)
## Use `systemctl --all --full -t device` to identify the device name.
##
## Create this file in `/etc/systemd/system/backupsnapshot.service`,
## and then enable it by running `systemctl enable
## backupsnapshot.service`
[Unit]
Description=Start Backup Snapshot (USB Key, Btrfs)
After=dev-mapper-luks\x2ddb936326\x2d91c8\x2d4d15\x2da0e2\x2d777eee7a5d24.device
Index: formulaires/contact.html
===================================================================
--- formulaires/contact.html (révision 77753)
+++ formulaires/contact.html (copie de travail)
@@ -10,7 +10,7 @@
[<p class="reponse_formulaire reponse_formulaire_erreur">(#ENV*{message_erreur})</p>]
<BOUCLE_editable(CONDITION){si #ENV{editable}}>
-<form method='post' action='#ENV{action}#formulaire_contact' enctype='multipart/form-data'>
+<form method='post' action='[(#ENV{action}|ancre_url{formulaire_contact})]' enctype='multipart/form-data'>
Index: inc/ics_to_array.php
===================================================================
--- inc/ics_to_array.php (révision 75941)
+++ inc/ics_to_array.php (copie de travail)
@@ -29,13 +29,14 @@
if (isset($v->$champ)
AND $w = &$v->$champ
AND $date = $table_valeur($w, "value")) {
- $w['str'] = sprintf('%04d-%02d-%02d %02d:%02d:%02d',
+ $w['str'] = date('Y-m-d H:i:s', strtotime(sprintf("%04d-%02d-%02dT%02d:%02d:%02d%s",
--- noisettes/balise_video_html5.html 2013-04-04 18:01:25.000000000 +0200
+++ noisettes/balise_video_html5.html~ 2013-04-04 17:57:42.000000000 +0200
@@ -12,7 +12,7 @@
</BOUCLE_webm>
- <BOUCLE_ogg(DOCUMENTS){extension IN ogg,ogv}{fichier==/#ENV{nomVideo}\.(ogg|ogv)$}{par num titre}>
+ <BOUCLE_ogg(DOCUMENTS){extension IN ogv}{fichier==/#ENV{nomVideo}\.ogv$}{par num titre}>
<source src="#FICHIER" type='video/ogg' /> [(#REM) ; codecs="theora, vorbis" OGV peut utiliser plusieurs codecs, on l'oublie donc ]
</BOUCLE_ogg>
Index: trunk/inclure/site-resume.html
===================================================================
--- trunk/inclure/site-resume.html (révision 70588)
+++ trunk/inclure/site-resume.html (copie de travail)
@@ -2,7 +2,7 @@
<BOUCLE_site(SITES) {id_syndic} {statut?}{compteur_publie forum}>
[(#ENV{style_liste}|=={liste}|oui)
<li class="item">
- <a [(#ENV{liste_lien_externe}|oui)href="#URL_SITE")][(#ENV{liste_lien_externe}|non)href="[(#ID_SYNDIC|generer_url_entite{site,'','',#CONNECT})]")] class="[(#ENV{liste_lien_externe}|oui)spip_out)] [(#ENV{id_syndic_expose}|=={#ID_SYNDIC}|oui)on]"><span class="#EDIT{nom_site}">#NOM_SITE</span></a>
+ <a [(#ENV{liste_lien_externe}|oui)href="#URL_SITE")][(#ENV{liste_lien_externe}|non)href="[(#ID_SYNDIC|generer_url_entite{site,'','',#CONNECT})]"] class="[(#ENV{liste_lien_externe}|oui)spip_out] [(#ENV{id_syndic_expose}|=={#ID_SYNDIC}|oui)on]"><span class="#EDIT{nom_site}">#NOM_SITE</span></a>
diff --git a/src/netzob/Common/Plugins/Capturers/AbstractCapturerController.py b/src/netzob/Common/Plugins/Capturers/AbstractCapturerController.py
index 4401389..ee919f9 100644
--- a/src/netzob/Common/Plugins/Capturers/AbstractCapturerController.py
+++ b/src/netzob/Common/Plugins/Capturers/AbstractCapturerController.py
@@ -52,8 +52,8 @@ class AbstractCapturerController(AbstractPluginController):
Abstract controller for capturer plugins
"""
- def __init__(self, netzob, plugin):
- super(AbstractCapturerController, self).__init__(netzob, plugin)
def traceTreeviewSelection_select_function_cb(self, selection, model, path, is_path_selected, treeStore):
"""This function is in charge of allowing or not, the
selection of an item in the traceTreeview. This Treeview
contains 'ImportedTrace' and 'Session', but we don't want the
user to select two different kind of data."""
# We allow the user to unselect an item.
if is_path_selected:
return True