+ <div class="entry">
+ <div class="title"><a href="http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html">Automatic Google Drive sync using grive in Debian</a></div>
+ <div class="date"> 4th October 2018</div>
+ <div class="body"><p>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
+<a href="http://www.webupd8.org/">the Ubuntu UPD8 PPA</a> 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.</p>
+
+<p>I first created <tt>~/googledrive</tt>, entered the directory and
+ran '<tt>grive -a</tt>' to authenticate the machine/user. Next, I
+created a autostart hook in <tt>~/.config/autostart/grive.desktop</tt>
+to start the sync when the user log in:</p>
+
+<p><blockquote><pre>
+[Desktop Entry]
+Name=Google drive autosync
+Type=Application
+Exec=/home/user/bin/grive-sync
+</pre></blockquote></p>
+
+<p>Finally, I wrote the <tt>~/bin/grive-sync</tt> script to sync
+~/googledrive/ with the files in Google Drive.</p>
+
+<p><blockquote><pre>
+#!/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:%"
+</pre></blockquote></p>
+
+<p>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.</p>
+
+<p>As usual, if you use Bitcoin and want to show your support of my
+activities, please send Bitcoin donations to my address
+<b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p>
+</div>
+ <div class="tags">
+
+
+ Tags: <a href="http://people.skolelinux.org/pere/blog/tags/debian">debian</a>, <a href="http://people.skolelinux.org/pere/blog/tags/english">english</a>.
+
+
+ </div>
+ </div>
+ <div class="padding"></div>
+
<div class="entry">
<div class="title"><a href="http://people.skolelinux.org/pere/blog/Valutakrambod___A_python_and_bitcoin_love_story.html">Valutakrambod - A python and bitcoin love story</a></div>
<div class="date">29th September 2018</div>
stream.close()
</pre></blockquote></p>
-<p>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:</p>
+<p>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:</p>
<p><blockquote><pre>
Bl3p BTC-EUR: 5687.110 5653.690
</div>
<div class="padding"></div>
- <div class="entry">
- <div class="title"><a href="http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_in_2018_.html">What is the most supported MIME type in Debian in 2018?</a></div>
- <div class="date"> 9th July 2018</div>
- <div class="body"><p>Five years ago,
-<a href="http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_.html">I
-measured what the most supported MIME type in Debian was</a>, 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:
-
-<p><strong>Debian Unstable:</strong></p>
-
-<pre>
- 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
-</pre>
-
-<p>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"</p>
-
-<p>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:</p>
-
-<p><blockquote><pre>
-% 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
-%
-</pre></blockquote></p>
-
-<p>Using the same method, I can quickly discover that the Sketchup file
-format is not yet supported by any package in Debian:</p>
-
-<p><blockquote><pre>
-% appstreamcli what-provides mimetype application/vnd.sketchup.skp
-Could not find component providing 'mimetype::application/vnd.sketchup.skp'.
-%
-</pre></blockquote></p>
-
-<p>Yesterday I used it to figure out which packages support the STL 3D
-format:</p>
-
-<p><blockquote><pre>
-% appstreamcli what-provides mimetype application/sla|grep Package
-Package: cura
-Package: meshlab
-Package: printrun
-%
-</pre></blockquote></p>
-
-<p>PS: A new version of Cura was uploaded to Debian yesterday.</p>
-
-<p>As usual, if you use Bitcoin and want to show your support of my
-activities, please send Bitcoin donations to my address
-<b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p>
-</div>
- <div class="tags">
-
-
- Tags: <a href="http://people.skolelinux.org/pere/blog/tags/debian">debian</a>, <a href="http://people.skolelinux.org/pere/blog/tags/english">english</a>, <a href="http://people.skolelinux.org/pere/blog/tags/isenkram">isenkram</a>.
-
-
- </div>
- </div>
- <div class="padding"></div>
-
<p style="text-align: right;"><a href="index.rss"><img src="http://people.skolelinux.org/pere/blog/xml.gif" alt="RSS feed" width="36" height="14" /></a></p>
<div id="sidebar">
<li><a href="http://people.skolelinux.org/pere/blog/archive/2018/09/">September (3)</a></li>
+<li><a href="http://people.skolelinux.org/pere/blog/archive/2018/10/">October (1)</a></li>
+
</ul></li>
<li>2017
<li><a href="http://people.skolelinux.org/pere/blog/tags/chrpath">chrpath (2)</a></li>
- <li><a href="http://people.skolelinux.org/pere/blog/tags/debian">debian (162)</a></li>
+ <li><a href="http://people.skolelinux.org/pere/blog/tags/debian">debian (163)</a></li>
<li><a href="http://people.skolelinux.org/pere/blog/tags/debian edu">debian edu (158)</a></li>
<li><a href="http://people.skolelinux.org/pere/blog/tags/drivstoffpriser">drivstoffpriser (4)</a></li>
- <li><a href="http://people.skolelinux.org/pere/blog/tags/english">english (385)</a></li>
+ <li><a href="http://people.skolelinux.org/pere/blog/tags/english">english (386)</a></li>
<li><a href="http://people.skolelinux.org/pere/blog/tags/fiksgatami">fiksgatami (23)</a></li>