]> pere.pagekite.me Git - homepage.git/blob - blog/index.rss
Generated.
[homepage.git] / blog / index.rss
1 <?xml version="1.0" encoding="utf-8"?>
2 <rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom="http://www.w3.org/2005/Atom">
3 <channel>
4 <title>Petter Reinholdtsen</title>
5 <description></description>
6 <link>http://people.skolelinux.org/pere/blog/</link>
7 <atom:link href="http://people.skolelinux.org/pere/blog/index.rss" rel="self" type="application/rss+xml" />
8
9 <item>
10 <title>Time for an official MIME type for patches?</title>
11 <link>http://people.skolelinux.org/pere/blog/Time_for_an_official_MIME_type_for_patches_.html</link>
12 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Time_for_an_official_MIME_type_for_patches_.html</guid>
13 <pubDate>Thu, 1 Nov 2018 08:15:00 +0100</pubDate>
14 <description>&lt;p&gt;As part of my involvement in
15 &lt;a href=&quot;https://gitlab.com/OsloMet-ABI/nikita-noark5-core&quot;&gt;the Nikita
16 archive API project&lt;/a&gt;, I&#39;ve been importing a fairly large lump of
17 emails into a test instance of the archive to see how well this would
18 go. I picked a subset of &lt;a href=&quot;https://notmuchmail.org/&quot;&gt;my
19 notmuch email database&lt;/a&gt;, all public emails sent to me via
20 @lists.debian.org, giving me a set of around 216 000 emails to import.
21 In the process, I had a look at the various attachments included in
22 these emails, to figure out what to do with attachments, and noticed
23 that one of the most common attachment formats do not have
24 &lt;a href=&quot;https://www.iana.org/assignments/media-types/media-types.xhtml&quot;&gt;an
25 official MIME type&lt;/a&gt; registered with IANA/IETF. The output from
26 diff, ie the input for patch, is on the top 10 list of formats
27 included in these emails. At the moment people seem to use either
28 text/x-patch or text/x-diff, but neither is officially registered. It
29 would be better if one official MIME type were registered and used
30 everywhere.&lt;/p&gt;
31
32 &lt;p&gt;To try to get one official MIME type for these files, I&#39;ve brought
33 up the topic on
34 &lt;a href=&quot;https://www.ietf.org/mailman/listinfo/media-types&quot;&gt;the
35 media-types mailing list&lt;/a&gt;. If you are interested in discussion
36 which MIME type to use as the official for patch files, or involved in
37 making software using a MIME type for patches, perhaps you would like
38 to join the discussion?&lt;/p&gt;
39
40 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
41 activities, please send Bitcoin donations to my address
42 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
43 </description>
44 </item>
45
46 <item>
47 <title>Measuring the speaker frequency response using the AUDMES free software GUI - nice free software</title>
48 <link>http://people.skolelinux.org/pere/blog/Measuring_the_speaker_frequency_response_using_the_AUDMES_free_software_GUI___nice_free_software.html</link>
49 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Measuring_the_speaker_frequency_response_using_the_AUDMES_free_software_GUI___nice_free_software.html</guid>
50 <pubDate>Mon, 22 Oct 2018 08:40:00 +0200</pubDate>
51 <description>&lt;p&gt;&lt;img src=&quot;http://people.skolelinux.org/pere/blog/images/2018-10-22-audmes-measure-speakers.png&quot; align=&quot;right&quot; width=&quot;40%&quot;/&gt;&lt;/p&gt;
52
53 &lt;p&gt;My current home stereo is a patchwork of various pieces I got on
54 flee markeds over the years. It is amazing what kind of equipment
55 show up there. I&#39;ve been wondering for a while if it was possible to
56 measure how well this equipment is working together, and decided to
57 see how far I could get using free software. After trawling the web I
58 came across an article from DIY Audio and Video on
59 &lt;a href=&quot;https://www.diyaudioandvideo.com/Tutorial/SpeakerResponseTesting/&quot;&gt;Speaker
60 Testing and Analysis&lt;/a&gt; describing how to test speakers, and it listing
61 several software options, among them
62 &lt;a href=&quot;https://sourceforge.net/projects/audmes/&quot;&gt;AUDio MEasurement
63 System (AUDMES)&lt;/a&gt;. It is the only free software system I could find
64 focusing on measuring speakers and audio frequency response. In the
65 process I also found an interesting article from NOVO on
66 &lt;a href=&quot;http://novo.press/understanding-speaker-specifications-and-frequency-response/&quot;&gt;Understanding
67 Speaker Specifications and Frequency Response&lt;/a&gt; and an article from
68 ecoustics on
69 &lt;a href=&quot;https://www.ecoustics.com/articles/understanding-speaker-frequency-response/&quot;&gt;Understanding
70 Speaker Frequency Response&lt;/a&gt;, with a lot of information on what to
71 look for and how to interpret the graphs. Armed with this knowledge,
72 I set out to measure the state of my speakers.&lt;/p&gt;
73
74 &lt;p&gt;The first hurdle was that AUDMES hadn&#39;t seen a commit for 10 years
75 and did not build with current compilers and libraries. I got in
76 touch with its author, who no longer was spending time on the program
77 but gave me write access to the subversion repository on Sourceforge.
78 The end result is that now the code build on Linux and is capable of
79 saving and loading the collected frequency response data in CSV
80 format. The application is quite nice and flexible, and I was able to
81 select the input and output audio interfaces independently. This made
82 it possible to use a USB mixer as the input source, while sending
83 output via my laptop headphone connection. I lacked the hardware and
84 cabling to figure out a different way to get independent cabling to
85 speakers and microphone.&lt;/p&gt;
86
87 &lt;p&gt;Using this setup I could see how a large range of high frequencies
88 apparently were not making it out of my speakers. The picture show
89 the frequency response measurement of one of the speakers. Note the
90 frequency lines seem to be slightly misaligned, compared to the CSV
91 output from the program. I can not hear several of these are high
92 frequencies, according to measurement from
93 &lt;a href=&quot;http://freehearingtestsoftware.com&quot;&gt;Free Hearing Test
94 Software&lt;/a&gt;, an freeware system to measure your hearing (still
95 looking for a free software alternative), so I do not know if they are
96 coming out out the speakers. I thus do not quite know how to figure
97 out if the missing frequencies is a problem with the microphone, the
98 amplifier or the speakers, but I managed to rule out the audio card in my
99 PC by measuring my Bose noise canceling headset using its own
100 microphone. This setup was able to see the high frequency tones, so
101 the problem with my stereo had to be in the amplifier or speakers.&lt;/p&gt;
102
103 &lt;p&gt;Anyway, to try to role out one factor I ended up picking up a new
104 set of speakers at a flee marked, and these work a lot better than the
105 old speakers, so I guess the microphone and amplifier is OK. If you
106 need to measure your own speakers, check out AUDMES. If more people
107 get involved, perhaps the project could become good enough to
108 &lt;a href=&quot;https://bugs.debian.org/910876&quot;&gt;include in Debian&lt;/a&gt;? And if
109 you know of some other free software to measure speakers and amplifier
110 performance, please let me know. I am aware of the freeware option
111 &lt;a href=&quot;https://www.roomeqwizard.com/&quot;&gt;REW&lt;/a&gt;, but I want something
112 that can be developed also when the vendor looses interest.&lt;/p&gt;
113
114 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
115 activities, please send Bitcoin donations to my address
116 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
117 </description>
118 </item>
119
120 <item>
121 <title>Web browser integration of VLC with Bittorrent support</title>
122 <link>http://people.skolelinux.org/pere/blog/Web_browser_integration_of_VLC_with_Bittorrent_support.html</link>
123 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Web_browser_integration_of_VLC_with_Bittorrent_support.html</guid>
124 <pubDate>Sun, 21 Oct 2018 09:50:00 +0200</pubDate>
125 <description>&lt;p&gt;Bittorrent is as far as I know, currently the most efficient way to
126 distribute content on the Internet. It is used all by all sorts of
127 content providers, from national TV stations like
128 &lt;a href=&quot;https://www.nrk.no/&quot;&gt;NRK&lt;/a&gt;, Linux distributors like
129 &lt;a href=&quot;https://www.debian.org/&quot;&gt;Debian&lt;/a&gt; and
130 &lt;a href=&quot;https://www.ubuntu.com/&quot;&gt;Ubuntu&lt;/a&gt;, and of course the
131 &lt;a href=&quot;https://archive.org/&quot;&gt;Internet archive&lt;/A&gt;.
132
133 &lt;p&gt;Almost a month ago
134 &lt;a href=&quot;https://tracker.debian.org/pkg/vlc-plugin-bittorrent&quot;&gt;a new
135 package adding Bittorrent support to VLC&lt;/a&gt; became available in
136 Debian testing and unstable. To test it, simply install it like
137 this:&lt;/p&gt;
138
139 &lt;p&gt;&lt;pre&gt;
140 apt install vlc-plugin-bittorrent
141 &lt;/pre&gt;&lt;/p&gt;
142
143 &lt;p&gt;Since the plugin was made available for the first time in Debian,
144 several improvements have been made to it. In version 2.2-4, now
145 available in both testing and unstable, a desktop file is provided to
146 teach browsers to start VLC when the user click on torrent files or
147 magnet links. The last part is thanks to me finally understanding
148 what the strange x-scheme-handler style MIME types in desktop files
149 are used for. By adding x-scheme-handler/magnet to the MimeType entry
150 in the desktop file, at least the browsers Firefox and Chromium will
151 suggest to start VLC when selecting a magnet URI on a web page. The
152 end result is that now, with the plugin installed in Buster and Sid,
153 one can visit any
154 &lt;a href=&quot;https://archive.org/details/CopyingIsNotTheft1080p&quot;&gt;Internet
155 Archive page with movies&lt;/a&gt; using a web browser and click on the
156 torrent link to start streaming the movie.&lt;/p&gt;
157
158 &lt;p&gt;Note, there is still some misfeatures in the plugin. One is the
159 fact that it will hang and
160 &lt;a href=&quot;https://github.com/johang/vlc-bittorrent/issues/13&quot;&gt;block VLC
161 from exiting until the torrent streaming starts&lt;/a&gt;. Another is the
162 fact that it
163 &lt;a href=&quot;https://github.com/johang/vlc-bittorrent/issues/9&quot;&gt;will pick
164 and play a random file in a multi file torrent&lt;/a&gt;. This is not
165 always the video file you want. Combined with the first it can be a
166 bit hard to get the video streaming going. But when it work, it seem
167 to do a good job.&lt;/p&gt;
168
169 &lt;p&gt;For the Debian packaging, I would love to find a good way to test
170 if the plugin work with VLC using autopkgtest. I tried, but do not
171 know enough of the inner workings of VLC to get it working. For now
172 the autopkgtest script is only checking if the .so file was
173 successfully loaded by VLC. If you have any suggestions, please
174 submit a patch to the Debian bug tracking system.&lt;/p&gt;
175
176 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
177 activities, please send Bitcoin donations to my address
178 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
179 </description>
180 </item>
181
182 <item>
183 <title>Release 0.2 of free software archive system Nikita announced</title>
184 <link>http://people.skolelinux.org/pere/blog/Release_0_2_of_free_software_archive_system_Nikita_announced.html</link>
185 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Release_0_2_of_free_software_archive_system_Nikita_announced.html</guid>
186 <pubDate>Thu, 18 Oct 2018 14:40:00 +0200</pubDate>
187 <description>&lt;p&gt;This morning, the new release of the
188 &lt;a href=&quot;https://gitlab.com/OsloMet-ABI/nikita-noark5-core/&quot;&gt;Nikita
189 Noark 5 core project&lt;/a&gt; was
190 &lt;a href=&quot;https://lists.nuug.no/pipermail/nikita-noark/2018-October/000406.html&quot;&gt;announced
191 on the project mailing list&lt;/a&gt;. The free software solution is an
192 implementation of the Norwegian archive standard Noark 5 used by
193 government offices in Norway. These were the changes in version 0.2
194 since version 0.1.1 (from NEWS.md):
195
196 &lt;ul&gt;
197 &lt;li&gt;Fix typos in REL names&lt;/li&gt;
198 &lt;li&gt;Tidy up error message reporting&lt;/li&gt;
199 &lt;li&gt;Fix issue where we used Integer.valueOf(), not Integer.getInteger()&lt;/li&gt;
200 &lt;li&gt;Change some String handling to StringBuffer&lt;/li&gt;
201 &lt;li&gt;Fix error reporting&lt;/li&gt;
202 &lt;li&gt;Code tidy-up&lt;/li&gt;
203 &lt;li&gt;Fix issue using static non-synchronized SimpleDateFormat to avoid
204 race conditions&lt;/li&gt;
205 &lt;li&gt;Fix problem where deserialisers were treating integers as strings&lt;/li&gt;
206 &lt;li&gt;Update methods to make them null-safe&lt;/li&gt;
207 &lt;li&gt;Fix many issues reported by coverity&lt;/li&gt;
208 &lt;li&gt;Improve equals(), compareTo() and hash() in domain model&lt;/li&gt;
209 &lt;li&gt;Improvements to the domain model for metadata classes&lt;/li&gt;
210 &lt;li&gt;Fix CORS issues when downloading document&lt;/li&gt;
211 &lt;li&gt;Implementation of case-handling with registryEntry and document upload&lt;/li&gt;
212 &lt;li&gt;Better support in Javascript for OPTIONS&lt;/li&gt;
213 &lt;li&gt;Adding concept description of mail integration&lt;/li&gt;
214 &lt;li&gt;Improve setting of default values for GET on ny-journalpost&lt;/li&gt;
215 &lt;li&gt;Better handling of required values during deserialisation &lt;/li&gt;
216 &lt;li&gt;Changed tilknyttetDato (M620) from date to dateTime&lt;/li&gt;
217 &lt;li&gt;Corrected some opprettetDato (M600) (de)serialisation errors.&lt;/li&gt;
218 &lt;li&gt;Improve parse error reporting.&lt;/li&gt;
219 &lt;li&gt;Started on OData search and filtering.&lt;/li&gt;
220 &lt;li&gt;Added Contributor Covenant Code of Conduct to project.&lt;/li&gt;
221 &lt;li&gt;Moved repository and project from Github to Gitlab.&lt;/li&gt;
222 &lt;li&gt;Restructured repository, moved code into src/ and web/.&lt;/li&gt;
223 &lt;li&gt;Updated code to use Spring Boot version 2.&lt;/li&gt;
224 &lt;li&gt;Added support for OAuth2 authentication.&lt;/li&gt;
225 &lt;li&gt;Fixed several bugs discovered by Coverity.&lt;/li&gt;
226 &lt;li&gt;Corrected handling of date/datetime fields.&lt;/li&gt;
227 &lt;li&gt;Improved error reporting when rejecting during deserializatoin.&lt;/li&gt;
228 &lt;li&gt;Adjusted default values provided for ny-arkivdel, ny-mappe,
229 ny-saksmappe, ny-journalpost and ny-dokumentbeskrivelse.&lt;/li&gt;
230 &lt;li&gt;Several fixes for korrespondansepart*.&lt;/li&gt;
231 &lt;li&gt;Updated web GUI:
232 &lt;ul&gt;
233 &lt;li&gt;Now handle both file upload and download.&lt;/li&gt;
234 &lt;li&gt;Uses new OAuth2 authentication for login.&lt;/li&gt;
235 &lt;li&gt;Forms now fetches default values from API using GET.&lt;/li&gt;
236 &lt;li&gt;Added RFC 822 (email), TIFF and JPEG to list of possible file formats.&lt;/li&gt;
237 &lt;/ul&gt;&lt;/li&gt;
238 &lt;/ul&gt;
239
240 &lt;p&gt;The changes and improvements are extensive. Running diffstat on
241 the changes between git tab 0.1.1 and 0.2 show 1098 files changed,
242 108666 insertions(+), 54066 deletions(-).&lt;/p&gt;
243
244 &lt;p&gt;If free and open standardized archiving API sound interesting to
245 you, please contact us on IRC
246 (&lt;a href=&quot;irc://irc.freenode.net/%23nikita&quot;&gt;#nikita on
247 irc.freenode.net&lt;/a&gt;) or email
248 (&lt;a href=&quot;https://lists.nuug.no/mailman/listinfo/nikita-noark&quot;&gt;nikita-noark
249 mailing list&lt;/a&gt;).&lt;/p&gt;
250
251 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
252 activities, please send Bitcoin donations to my address
253 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
254 </description>
255 </item>
256
257 <item>
258 <title>Fetching trusted timestamps using the rfc3161ng python module</title>
259 <link>http://people.skolelinux.org/pere/blog/Fetching_trusted_timestamps_using_the_rfc3161ng_python_module.html</link>
260 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Fetching_trusted_timestamps_using_the_rfc3161ng_python_module.html</guid>
261 <pubDate>Mon, 8 Oct 2018 12:30:00 +0200</pubDate>
262 <description>&lt;p&gt;I have earlier covered the basics of trusted timestamping using the
263 &#39;openssl ts&#39; client. See blog post for
264 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/Public_Trusted_Timestamping_services_for_everyone.html&quot;&gt;2014&lt;/a&gt;,
265 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/syslog_trusted_timestamp___chain_of_trusted_timestamps_for_your_syslog.html&quot;&gt;2016&lt;/a&gt;
266 and
267 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/Idea_for_storing_trusted_timestamps_in_a_Noark_5_archive.html&quot;&gt;2017&lt;/a&gt;
268 for those stories. But some times I want to integrate the timestamping
269 in other code, and recently I needed to integrate it into Python.
270 After searching a bit, I found
271 &lt;a href=&quot;https://dev.entrouvert.org/projects/python-rfc3161&quot;&gt;the
272 rfc3161 library&lt;/a&gt; which seemed like a good fit, but I soon
273 discovered it only worked for python version 2, and I needed something
274 that work with python version 3. Luckily I next came across
275 &lt;a href=&quot;https://github.com/trbs/rfc3161ng/&quot;&gt;the rfc3161ng library&lt;/a&gt;,
276 a fork of the original rfc3161 library. Not only is it working with
277 python 3, it have fixed a few of the bugs in the original library, and
278 it has an active maintainer. I decided to wrap it up and make it
279 &lt;a href=&quot;https://tracker.debian.org/pkg/python-rfc3161ng&quot;&gt;available in
280 Debian&lt;/a&gt;, and a few days ago it entered Debian unstable and testing.&lt;/p&gt;
281
282 &lt;p&gt;Using the library is fairly straight forward. The only slightly
283 problematic step is to fetch the required certificates to verify the
284 timestamp. For some services it is straight forward, while for others
285 I have not yet figured out how to do it. Here is a small standalone
286 code example based on of the integration tests in the library code:&lt;/p&gt;
287
288 &lt;pre&gt;
289 #!/usr/bin/python3
290
291 &quot;&quot;&quot;
292
293 Python 3 script demonstrating how to use the rfc3161ng module to
294 get trusted timestamps.
295
296 The license of this code is the same as the license of the rfc3161ng
297 library, ie MIT/BSD.
298
299 &quot;&quot;&quot;
300
301 import os
302 import pyasn1.codec.der
303 import rfc3161ng
304 import subprocess
305 import tempfile
306 import urllib.request
307
308 def store(f, data):
309 f.write(data)
310 f.flush()
311 f.seek(0)
312
313 def fetch(url, f=None):
314 response = urllib.request.urlopen(url)
315 data = response.read()
316 if f:
317 store(f, data)
318 return data
319
320 def main():
321 with tempfile.NamedTemporaryFile() as cert_f,\
322 tempfile.NamedTemporaryFile() as ca_f,\
323 tempfile.NamedTemporaryFile() as msg_f,\
324 tempfile.NamedTemporaryFile() as tsr_f:
325
326 # First fetch certificates used by service
327 certificate_data = fetch(&#39;https://freetsa.org/files/tsa.crt&#39;, cert_f)
328 ca_data_data = fetch(&#39;https://freetsa.org/files/cacert.pem&#39;, ca_f)
329
330 # Then timestamp the message
331 timestamper = \
332 rfc3161ng.RemoteTimestamper(&#39;http://freetsa.org/tsr&#39;,
333 certificate=certificate_data)
334 data = b&quot;Python forever!\n&quot;
335 tsr = timestamper(data=data, return_tsr=True)
336
337 # Finally, convert message and response to something &#39;openssl ts&#39; can verify
338 store(msg_f, data)
339 store(tsr_f, pyasn1.codec.der.encoder.encode(tsr))
340 args = [&quot;openssl&quot;, &quot;ts&quot;, &quot;-verify&quot;,
341 &quot;-data&quot;, msg_f.name,
342 &quot;-in&quot;, tsr_f.name,
343 &quot;-CAfile&quot;, ca_f.name,
344 &quot;-untrusted&quot;, cert_f.name]
345 subprocess.check_call(args)
346
347 if &#39;__main__&#39; == __name__:
348 main()
349 &lt;/pre&gt;
350
351 &lt;p&gt;The code fetches the required certificates, store them as temporary
352 files, timestamp a simple message, store the message and timestamp to
353 disk and ask &#39;openssl ts&#39; to verify the timestamp. A timestamp is
354 around 1.5 kiB in size, and should be fairly easy to store for future
355 use.&lt;/p&gt;
356
357 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
358 activities, please send Bitcoin donations to my address
359 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
360 </description>
361 </item>
362
363 <item>
364 <title>Automatic Google Drive sync using grive in Debian</title>
365 <link>http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html</link>
366 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html</guid>
367 <pubDate>Thu, 4 Oct 2018 15:20:00 +0200</pubDate>
368 <description>&lt;p&gt;A few days, I rescued a Windows victim over to Debian. To try to
369 rescue the remains, I helped set up automatic sync with Google Drive.
370 I did not find any sensible Debian package handling this
371 automatically, so I rebuild the grive2 source from
372 &lt;a href=&quot;http://www.webupd8.org/&quot;&gt;the Ubuntu UPD8 PPA&lt;/a&gt; to do the
373 task and added a autostart desktop entry and a small shell script to
374 run in the background while the user is logged in to do the sync.
375 Here is a sketch of the setup for future reference.&lt;/p&gt;
376
377 &lt;p&gt;I first created &lt;tt&gt;~/googledrive&lt;/tt&gt;, entered the directory and
378 ran &#39;&lt;tt&gt;grive -a&lt;/tt&gt;&#39; to authenticate the machine/user. Next, I
379 created a autostart hook in &lt;tt&gt;~/.config/autostart/grive.desktop&lt;/tt&gt;
380 to start the sync when the user log in:&lt;/p&gt;
381
382 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
383 [Desktop Entry]
384 Name=Google drive autosync
385 Type=Application
386 Exec=/home/user/bin/grive-sync
387 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
388
389 &lt;p&gt;Finally, I wrote the &lt;tt&gt;~/bin/grive-sync&lt;/tt&gt; script to sync
390 ~/googledrive/ with the files in Google Drive.&lt;/p&gt;
391
392 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
393 #!/bin/sh
394 set -e
395 cd ~/
396 cleanup() {
397 if [ &quot;$syncpid&quot; ] ; then
398 kill $syncpid
399 fi
400 }
401 trap cleanup EXIT INT QUIT
402 /usr/lib/grive/grive-sync.sh listen googledrive 2&gt;&amp;1 | sed &quot;s%^%$0:%&quot; &amp;
403 syncpdi=$!
404 while true; do
405 if ! xhost &gt;/dev/null 2&gt;&amp;1 ; then
406 echo &quot;no DISPLAY, exiting as the user probably logged out&quot;
407 exit 1
408 fi
409 if [ ! -e /run/user/1000/grive-sync.sh_googledrive ] ; then
410 /usr/lib/grive/grive-sync.sh sync googledrive
411 fi
412 sleep 300
413 done 2&gt;&amp;1 | sed &quot;s%^%$0:%&quot;
414 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
415
416 &lt;p&gt;Feel free to use the setup if you want. It can be assumed to be
417 GNU GPL v2 licensed (or any later version, at your leisure), but I
418 doubt this code is possible to claim copyright on.&lt;/p&gt;
419
420 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
421 activities, please send Bitcoin donations to my address
422 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
423 </description>
424 </item>
425
426 <item>
427 <title>Valutakrambod - A python and bitcoin love story</title>
428 <link>http://people.skolelinux.org/pere/blog/Valutakrambod___A_python_and_bitcoin_love_story.html</link>
429 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Valutakrambod___A_python_and_bitcoin_love_story.html</guid>
430 <pubDate>Sat, 29 Sep 2018 22:20:00 +0200</pubDate>
431 <description>&lt;p&gt;It would come as no surprise to anyone that I am interested in
432 bitcoins and virtual currencies. I&#39;ve been keeping an eye on virtual
433 currencies for many years, and it is part of the reason a few months
434 ago, I started writing a python library for collecting currency
435 exchange rates and trade on virtual currency exchanges. I decided to
436 name the end result valutakrambod, which perhaps can be translated to
437 small currency shop.&lt;/p&gt;
438
439 &lt;p&gt;The library uses the tornado python library to handle HTTP and
440 websocket connections, and provide a asynchronous system for
441 connecting to and tracking several services. The code is available
442 from
443 &lt;a href=&quot;http://github.com/petterreinholdtsen/valutakrambod&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;
444
445 &lt;/p&gt;There are two example clients of the library. One is very simple and
446 list every updated buy/sell price received from the various services.
447 This code is started by running bin/btc-rates and call the client code
448 in valutakrambod/client.py. The simple client look like this:&lt;/p&gt;
449
450 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
451 import functools
452 import tornado.ioloop
453 import valutakrambod
454 class SimpleClient(object):
455 def __init__(self):
456 self.services = []
457 self.streams = []
458 pass
459 def newdata(self, service, pair, changed):
460 print(&quot;%-15s %s-%s: %8.3f %8.3f&quot; % (
461 service.servicename(),
462 pair[0],
463 pair[1],
464 service.rates[pair][&#39;ask&#39;],
465 service.rates[pair][&#39;bid&#39;])
466 )
467 async def refresh(self, service):
468 await service.fetchRates(service.wantedpairs)
469 def run(self):
470 self.ioloop = tornado.ioloop.IOLoop.current()
471 self.services = valutakrambod.service.knownServices()
472 for e in self.services:
473 service = e()
474 service.subscribe(self.newdata)
475 stream = service.websocket()
476 if stream:
477 self.streams.append(stream)
478 else:
479 # Fetch information from non-streaming services immediately
480 self.ioloop.call_later(len(self.services),
481 functools.partial(self.refresh, service))
482 # as well as regularly
483 service.periodicUpdate(60)
484 for stream in self.streams:
485 stream.connect()
486 try:
487 self.ioloop.start()
488 except KeyboardInterrupt:
489 print(&quot;Interrupted by keyboard, closing all connections.&quot;)
490 pass
491 for stream in self.streams:
492 stream.close()
493 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
494
495 &lt;p&gt;The library client loops over all known &quot;public&quot; services,
496 initialises it, subscribes to any updates from the service, checks and
497 activates websocket streaming if the service provide it, and if no
498 streaming is supported, fetches information from the service and sets
499 up a periodic update every 60 seconds. The output from this client
500 can look like this:&lt;/p&gt;
501
502 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
503 Bl3p BTC-EUR: 5687.110 5653.690
504 Bl3p BTC-EUR: 5687.110 5653.690
505 Bl3p BTC-EUR: 5687.110 5653.690
506 Hitbtc BTC-USD: 6594.560 6593.690
507 Hitbtc BTC-USD: 6594.560 6593.690
508 Bl3p BTC-EUR: 5687.110 5653.690
509 Hitbtc BTC-USD: 6594.570 6593.690
510 Bitstamp EUR-USD: 1.159 1.154
511 Hitbtc BTC-USD: 6594.570 6593.690
512 Hitbtc BTC-USD: 6594.580 6593.690
513 Hitbtc BTC-USD: 6594.580 6593.690
514 Hitbtc BTC-USD: 6594.580 6593.690
515 Bl3p BTC-EUR: 5687.110 5653.690
516 Paymium BTC-EUR: 5680.000 5620.240
517 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
518
519 &lt;p&gt;The exchange order book is tracked in addition to the best buy/sell
520 price, for those that need to know the details.&lt;/p&gt;
521
522 &lt;p&gt;The other example client is focusing on providing a curses view
523 with updated buy/sell prices as soon as they are received from the
524 services. This code is located in bin/btc-rates-curses and activated
525 by using the &#39;-c&#39; argument. Without the argument the &quot;curses&quot; output
526 is printed without using curses, which is useful for debugging. The
527 curses view look like this:&lt;/p&gt;
528
529 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
530 Name Pair Bid Ask Spr Ftcd Age
531 BitcoinsNorway BTCEUR 5591.8400 5711.0800 2.1% 16 nan 60
532 Bitfinex BTCEUR 5671.0000 5671.2000 0.0% 16 22 59
533 Bitmynt BTCEUR 5580.8000 5807.5200 3.9% 16 41 60
534 Bitpay BTCEUR 5663.2700 nan nan% 15 nan 60
535 Bitstamp BTCEUR 5664.8400 5676.5300 0.2% 0 1 1
536 Bl3p BTCEUR 5653.6900 5684.9400 0.5% 0 nan 19
537 Coinbase BTCEUR 5600.8200 5714.9000 2.0% 15 nan nan
538 Kraken BTCEUR 5670.1000 5670.2000 0.0% 14 17 60
539 Paymium BTCEUR 5620.0600 5680.0000 1.1% 1 7515 nan
540 BitcoinsNorway BTCNOK 52898.9700 54034.6100 2.1% 16 nan 60
541 Bitmynt BTCNOK 52960.3200 54031.1900 2.0% 16 41 60
542 Bitpay BTCNOK 53477.7833 nan nan% 16 nan 60
543 Coinbase BTCNOK 52990.3500 54063.0600 2.0% 15 nan nan
544 MiraiEx BTCNOK 52856.5300 54100.6000 2.3% 16 nan nan
545 BitcoinsNorway BTCUSD 6495.5300 6631.5400 2.1% 16 nan 60
546 Bitfinex BTCUSD 6590.6000 6590.7000 0.0% 16 23 57
547 Bitpay BTCUSD 6564.1300 nan nan% 15 nan 60
548 Bitstamp BTCUSD 6561.1400 6565.6200 0.1% 0 2 1
549 Coinbase BTCUSD 6504.0600 6635.9700 2.0% 14 nan 117
550 Gemini BTCUSD 6567.1300 6573.0700 0.1% 16 89 nan
551 Hitbtc+BTCUSD 6592.6200 6594.2100 0.0% 0 0 0
552 Kraken BTCUSD 6565.2000 6570.9000 0.1% 15 17 58
553 Exchangerates EURNOK 9.4665 9.4665 0.0% 16 107789 nan
554 Norgesbank EURNOK 9.4665 9.4665 0.0% 16 107789 nan
555 Bitstamp EURUSD 1.1537 1.1593 0.5% 4 5 1
556 Exchangerates EURUSD 1.1576 1.1576 0.0% 16 107789 nan
557 BitcoinsNorway LTCEUR 1.0000 49.0000 98.0% 16 nan nan
558 BitcoinsNorway LTCNOK 492.4800 503.7500 2.2% 16 nan 60
559 BitcoinsNorway LTCUSD 1.0221 49.0000 97.9% 15 nan nan
560 Norgesbank USDNOK 8.1777 8.1777 0.0% 16 107789 nan
561 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
562
563 &lt;p&gt;The code for this client is too complex for a simple blog post, so
564 you will have to check out the git repository to figure out how it
565 work. What I can tell is how the three last numbers on each line
566 should be interpreted. The first is how many seconds ago information
567 was received from the service. The second is how long ago, according
568 to the service, the provided information was updated. The last is an
569 estimate on how often the buy/sell values change.&lt;/p&gt;
570
571 &lt;p&gt;If you find this library useful, or would like to improve it, I
572 would love to hear from you. Note that for some of the services I&#39;ve
573 implemented a trading API. It might be the topic of a future blog
574 post.&lt;/p&gt;
575
576 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
577 activities, please send Bitcoin donations to my address
578 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
579 </description>
580 </item>
581
582 <item>
583 <title>VLC in Debian now can do bittorrent streaming</title>
584 <link>http://people.skolelinux.org/pere/blog/VLC_in_Debian_now_can_do_bittorrent_streaming.html</link>
585 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/VLC_in_Debian_now_can_do_bittorrent_streaming.html</guid>
586 <pubDate>Mon, 24 Sep 2018 21:20:00 +0200</pubDate>
587 <description>&lt;p&gt;Back in February, I got curious to see
588 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/Using_VLC_to_stream_bittorrent_sources.html&quot;&gt;if
589 VLC now supported Bittorrent streaming&lt;/a&gt;. It did not, despite the
590 fact that the idea and code to handle such streaming had been floating
591 around for years. I did however find
592 &lt;a href=&quot;https://github.com/johang/vlc-bittorrent&quot;&gt;a standalone plugin
593 for VLC&lt;/a&gt; to do it, and half a year later I decided to wrap up the
594 plugin and get it into Debian. I uploaded it to NEW a few days ago,
595 and am very happy to report that it
596 &lt;a href=&quot;https://tracker.debian.org/pkg/vlc-plugin-bittorrent&quot;&gt;entered
597 Debian&lt;/a&gt; a few hours ago, and should be available in Debian/Unstable
598 tomorrow, and Debian/Testing in a few days.&lt;/p&gt;
599
600 &lt;p&gt;With the vlc-plugin-bittorrent package installed you should be able
601 to stream videos using a simple call to&lt;/p&gt;
602
603 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
604 vlc https://archive.org/download/TheGoat/TheGoat_archive.torrent
605 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
606
607 &lt;/p&gt;It can handle magnet links too. Now if only native vlc had
608 bittorrent support. Then a lot more would be helping each other to
609 share public domain and creative commons movies. The plugin need some
610 stability work with seeking and picking the right file in a torrent
611 with many files, but is already usable. Please note that the plugin
612 is not removing downloaded files when vlc is stopped, so it can fill
613 up your disk if you are not careful. Have fun. :)&lt;/p&gt;
614
615 &lt;p&gt;I would love to get help maintaining this package. Get in touch if
616 you are interested.&lt;/p&gt;
617
618 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
619 activities, please send Bitcoin donations to my address
620 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
621 </description>
622 </item>
623
624 <item>
625 <title>Using the Kodi API to play Youtube videos</title>
626 <link>http://people.skolelinux.org/pere/blog/Using_the_Kodi_API_to_play_Youtube_videos.html</link>
627 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Using_the_Kodi_API_to_play_Youtube_videos.html</guid>
628 <pubDate>Sun, 2 Sep 2018 23:40:00 +0200</pubDate>
629 <description>&lt;p&gt;I continue to explore my Kodi installation, and today I wanted to
630 tell it to play a youtube URL I received in a chat, without having to
631 insert search terms using the on-screen keyboard. After searching the
632 web for API access to the Youtube plugin and testing a bit, I managed
633 to find a recipe that worked. If you got a kodi instance with its API
634 available from http://kodihost/jsonrpc, you can try the following to
635 have check out a nice cover band.&lt;/p&gt;
636
637 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;curl --silent --header &#39;Content-Type: application/json&#39; \
638 --data-binary &#39;{ &quot;id&quot;: 1, &quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;method&quot;: &quot;Player.Open&quot;,
639 &quot;params&quot;: {&quot;item&quot;: { &quot;file&quot;:
640 &quot;plugin://plugin.video.youtube/play/?video_id=LuRGVM9O0qg&quot; } } }&#39; \
641 http://projector.local/jsonrpc&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
642
643 &lt;p&gt;I&#39;ve extended kodi-stream program to take a video source as its
644 first argument. It can now handle direct video links, youtube links
645 and &#39;desktop&#39; to stream my desktop to Kodi. It is almost like a
646 Chromecast. :)&lt;/p&gt;
647
648 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
649 activities, please send Bitcoin donations to my address
650 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
651 </description>
652 </item>
653
654 <item>
655 <title>Software created using taxpayers’ money should be Free Software</title>
656 <link>http://people.skolelinux.org/pere/blog/Software_created_using_taxpayers__money_should_be_Free_Software.html</link>
657 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Software_created_using_taxpayers__money_should_be_Free_Software.html</guid>
658 <pubDate>Thu, 30 Aug 2018 13:50:00 +0200</pubDate>
659 <description>&lt;p&gt;It might seem obvious that software created using tax money should
660 be available for everyone to use and improve. Free Software
661 Foundation Europe recentlystarted a campaign to help get more people
662 to understand this, and I just signed the petition on
663 &lt;a href=&quot;https://publiccode.eu/&quot;&gt;Public Money, Public Code&lt;/a&gt; to help
664 them. I hope you too will do the same.&lt;/p&gt;
665 </description>
666 </item>
667
668 </channel>
669 </rss>