]> pere.pagekite.me Git - homepage.git/blobdiff - blog/index.rss
Generated.
[homepage.git] / blog / index.rss
index a327511f035618252aab46936a946329775f163f..2faa9a8da375278afb129e0e38a71c06e74898ac 100644 (file)
@@ -6,6 +6,69 @@
                 <link>http://people.skolelinux.org/pere/blog/</link>
                 <atom:link href="http://people.skolelinux.org/pere/blog/index.rss" rel="self" type="application/rss+xml" />
        
+       <item>
+               <title>Automatic Google Drive sync using grive in Debian</title>
+               <link>http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html</link>
+               <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html</guid>
+                <pubDate>Thu, 4 Oct 2018 15:20:00 +0200</pubDate>
+               <description>&lt;p&gt;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
+&lt;a href=&quot;http://www.webupd8.org/&quot;&gt;the Ubuntu UPD8 PPA&lt;/a&gt; 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.&lt;/p&gt;
+
+&lt;p&gt;I first created &lt;tt&gt;~/googledrive&lt;/tt&gt;, entered the directory and
+ran &#39;&lt;tt&gt;grive -a&lt;/tt&gt;&#39; to authenticate the machine/user.  Next, I
+created a autostart hook in &lt;tt&gt;~/.config/autostart/grive.desktop&lt;/tt&gt;
+to start the sync when the user log in:&lt;/p&gt;
+
+&lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
+[Desktop Entry]
+Name=Google drive autosync
+Type=Application
+Exec=/home/user/bin/grive-sync
+&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
+
+&lt;p&gt;Finally, I wrote the &lt;tt&gt;~/bin/grive-sync&lt;/tt&gt; script to sync
+~/googledrive/ with the files in Google Drive.&lt;/p&gt;
+
+&lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
+#!/bin/sh
+set -e
+cd ~/
+cleanup() {
+    if [ &quot;$syncpid&quot; ] ; then
+        kill $syncpid
+    fi
+}
+trap cleanup EXIT INT QUIT
+/usr/lib/grive/grive-sync.sh listen googledrive 2&gt;&amp;1 | sed &quot;s%^%$0:%&quot; &amp;
+syncpdi=$!
+while true; do
+    if ! xhost &gt;/dev/null 2&gt;&amp;1 ; then
+        echo &quot;no DISPLAY, exiting as the user probably logged out&quot;
+        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&gt;&amp;1 | sed &quot;s%^%$0:%&quot;
+&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
+
+&lt;p&gt;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.&lt;/p&gt;
+
+&lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
+activities, please send Bitcoin donations to my address
+&lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
+</description>
+       </item>
+       
        <item>
                <title>Valutakrambod - A python and bitcoin love story</title>
                <link>http://people.skolelinux.org/pere/blog/Valutakrambod___A_python_and_bitcoin_love_story.html</link>
@@ -75,12 +138,12 @@ class SimpleClient(object):
             stream.close()
 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
 
-&lt;p&gt;The library client loop over all known &quot;public&quot; 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:&lt;/p&gt;
+&lt;p&gt;The library client loops over all known &quot;public&quot; 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:&lt;/p&gt;
 
 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
 Bl3p            BTC-EUR: 5687.110 5653.690
@@ -656,122 +719,6 @@ seem to be doing a better job.&lt;/p&gt;
 cvlc screen:// --sout &#39;#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:rtp{mux=ts,dst=239.255.0.1,port=1234,sdp=sap}&#39;
 &lt;/pre&gt;&lt;/blockquote&gt;
 
-&lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
-activities, please send Bitcoin donations to my address
-&lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
-</description>
-       </item>
-       
-       <item>
-               <title>What is the most supported MIME type in Debian in 2018?</title>
-               <link>http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_in_2018_.html</link>
-               <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_in_2018_.html</guid>
-                <pubDate>Mon, 9 Jul 2018 08:05:00 +0200</pubDate>
-               <description>&lt;p&gt;Five years ago,
-&lt;a href=&quot;http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_.html&quot;&gt;I
-measured what the most supported MIME type in Debian was&lt;/a&gt;, 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:
-
-&lt;p&gt;&lt;strong&gt;Debian Unstable:&lt;/strong&gt;&lt;/p&gt;
-
-&lt;pre&gt;
-  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
-&lt;/pre&gt;
-
-&lt;p&gt;The list was created like this using a sid chroot: &quot;cat
-/var/lib/apt/lists/*sid*_dep11_Components-amd64.yml.gz| zcat | awk &#39;/^
-- \S+\/\S+$/ {print $2 }&#39; | sort | uniq -c | sort -nr | head -20&quot;&lt;/p&gt;
-
-&lt;p&gt;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 &quot;file --mime &amp;lt;filename&amp;gt;&quot;, and then
-look up all packages announcing support for this format in their
-AppStream metadata (XML or .desktop file) using &quot;appstreamcli
-what-provides mimetype &amp;lt;mime-type&amp;gt;.  For example if you, like
-me, want to know which packages support inode/directory, you can get a
-list like this:&lt;/p&gt;
-
-&lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
-% 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
-%
-&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
-
-&lt;p&gt;Using the same method, I can quickly discover that the Sketchup file
-format is not yet supported by any package in Debian:&lt;/p&gt;
-
-&lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
-% appstreamcli what-provides mimetype  application/vnd.sketchup.skp
-Could not find component providing &#39;mimetype::application/vnd.sketchup.skp&#39;.
-%
-&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
-
-&lt;p&gt;Yesterday I used it to figure out which packages support the STL 3D
-format:&lt;/p&gt;
-
-&lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
-% appstreamcli what-provides mimetype  application/sla|grep Package
-Package: cura
-Package: meshlab
-Package: printrun
-%
-&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
-
-&lt;p&gt;PS: A new version of Cura was uploaded to Debian yesterday.&lt;/p&gt;
-
 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
 activities, please send Bitcoin donations to my address
 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;