X-Git-Url: https://pere.pagekite.me/gitweb/homepage.git/blobdiff_plain/c913de3857357e75baa77bdd69f7f34e4f711fa6..a5f4bdf4e8b5407e0e69b78fc77db623de7d967c:/blog/index.html diff --git a/blog/index.html b/blog/index.html index a505cb5b80..6b3194e75e 100644 --- a/blog/index.html +++ b/blog/index.html @@ -19,6 +19,75 @@ +
+
Automatic Google Drive sync using grive in Debian
+
4th October 2018
+

A few days, I rescued a Windows victim over to Debian. To try to +rescue the remains, I helped set up automatic sync with Google Drive. +I did not find any sensible Debian package handling this +automatically, so I rebuild the grive2 source from +the Ubuntu UPD8 PPA to do the +task and added a autostart desktop entry and a small shell script to +run in the background while the user is logged in to do the sync. +Here is a sketch of the setup for future reference.

+ +

I first created ~/googledrive, entered the directory and +ran 'grive -a' to authenticate the machine/user. Next, I +created a autostart hook in ~/.config/autostart/grive.desktop +to start the sync when the user log in:

+ +

+[Desktop Entry]
+Name=Google drive autosync
+Type=Application
+Exec=/home/user/bin/grive-sync
+

+ +

Finally, I wrote the ~/bin/grive-sync script to sync +~/googledrive/ with the files in Google Drive.

+ +

+#!/bin/sh
+set -e
+cd ~/
+cleanup() {
+    if [ "$syncpid" ] ; then
+        kill $syncpid
+    fi
+}
+trap cleanup EXIT INT QUIT
+/usr/lib/grive/grive-sync.sh listen googledrive 2>&1 | sed "s%^%$0:%" &
+syncpdi=$!
+while true; do
+    if ! xhost >/dev/null 2>&1 ; then
+        echo "no DISPLAY, exiting as the user probably logged out"
+        exit 1
+    fi
+    if [ ! -e /run/user/1000/grive-sync.sh_googledrive ] ; then
+        /usr/lib/grive/grive-sync.sh sync googledrive
+    fi
+    sleep 300
+done 2>&1 | sed "s%^%$0:%"
+

+ +

Feel free to use the setup if you want. It can be assumed to be +GNU GPL v2 licensed (or any later version, at your leisure), but I +doubt this code is possible to claim copyright on.

+ +

As usual, if you use Bitcoin and want to show your support of my +activities, please send Bitcoin donations to my address +15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b.

+
+
+ + + Tags: debian, english. + + +
+
+
+
Valutakrambod - A python and bitcoin love story
29th September 2018
@@ -86,12 +155,12 @@ class SimpleClient(object): stream.close()

-

The library client loop over all known "public" services, -initialises it, subscribe to any updates from the service, check and -activate websocket streaming if the service provide it, and if no -streaming is supported, fetch information from the service and set up -a periodic update every 60 seconds. The output from this client can -look like this:

+

The library client loops over all known "public" services, +initialises it, subscribes to any updates from the service, checks and +activates websocket streaming if the service provide it, and if no +streaming is supported, fetches information from the service and sets +up a periodic update every 60 seconds. The output from this client +can look like this:

 Bl3p            BTC-EUR: 5687.110 5653.690
@@ -729,128 +798,6 @@ activities, please send Bitcoin donations to my address
     
-
-
What is the most supported MIME type in Debian in 2018?
-
9th July 2018
-

Five years ago, -I -measured what the most supported MIME type in Debian was, by -analysing the desktop files in all packages in the archive. Since -then, the DEP-11 AppStream system has been put into production, making -the task a lot easier. This made me want to repeat the measurement, -to see how much things changed. Here are the new numbers, for -unstable only this time: - -

Debian Unstable:

- -
-  count MIME type
-  ----- -----------------------
-     56 image/jpeg
-     55 image/png
-     49 image/tiff
-     48 image/gif
-     39 image/bmp
-     38 text/plain
-     37 audio/mpeg
-     34 application/ogg
-     33 audio/x-flac
-     32 audio/x-mp3
-     30 audio/x-wav
-     30 audio/x-vorbis+ogg
-     29 image/x-portable-pixmap
-     27 inode/directory
-     27 image/x-portable-bitmap
-     27 audio/x-mpeg
-     26 application/x-ogg
-     25 audio/x-mpegurl
-     25 audio/ogg
-     24 text/html
-
- -

The list was created like this using a sid chroot: "cat -/var/lib/apt/lists/*sid*_dep11_Components-amd64.yml.gz| zcat | awk '/^ -- \S+\/\S+$/ {print $2 }' | sort | uniq -c | sort -nr | head -20"

- -

It is interesting to see how image formats have passed text/plain -as the most announced supported MIME type. These days, thanks to the -AppStream system, if you run into a file format you do not know, and -want to figure out which packages support the format, you can find the -MIME type of the file using "file --mime <filename>", and then -look up all packages announcing support for this format in their -AppStream metadata (XML or .desktop file) using "appstreamcli -what-provides mimetype <mime-type>. For example if you, like -me, want to know which packages support inode/directory, you can get a -list like this:

- -

-% appstreamcli what-provides mimetype inode/directory | grep Package: | sort
-Package: anjuta
-Package: audacious
-Package: baobab
-Package: cervisia
-Package: chirp
-Package: dolphin
-Package: doublecmd-common
-Package: easytag
-Package: enlightenment
-Package: ephoto
-Package: filelight
-Package: gwenview
-Package: k4dirstat
-Package: kaffeine
-Package: kdesvn
-Package: kid3
-Package: kid3-qt
-Package: nautilus
-Package: nemo
-Package: pcmanfm
-Package: pcmanfm-qt
-Package: qweborf
-Package: ranger
-Package: sirikali
-Package: spacefm
-Package: spacefm
-Package: vifm
-%
-

- -

Using the same method, I can quickly discover that the Sketchup file -format is not yet supported by any package in Debian:

- -

-% appstreamcli what-provides mimetype  application/vnd.sketchup.skp
-Could not find component providing 'mimetype::application/vnd.sketchup.skp'.
-%
-

- -

Yesterday I used it to figure out which packages support the STL 3D -format:

- -

-% appstreamcli what-provides mimetype  application/sla|grep Package
-Package: cura
-Package: meshlab
-Package: printrun
-%
-

- -

PS: A new version of Cura was uploaded to Debian yesterday.

- -

As usual, if you use Bitcoin and want to show your support of my -activities, please send Bitcoin donations to my address -15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b.

-
-
- - - Tags: debian, english, isenkram. - - -
-
-
-

RSS feed