]> 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>Fetching trusted timestamps using the rfc3161ng python module</title>
11 <link>http://people.skolelinux.org/pere/blog/Fetching_trusted_timestamps_using_the_rfc3161ng_python_module.html</link>
12 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Fetching_trusted_timestamps_using_the_rfc3161ng_python_module.html</guid>
13 <pubDate>Mon, 8 Oct 2018 12:30:00 +0200</pubDate>
14 <description>&lt;p&gt;I have earlier covered the basics of trusted timestamping using the
15 &#39;openssl ts&#39; client. See blog post for
16 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/Public_Trusted_Timestamping_services_for_everyone.html&quot;&gt;2014&lt;/a&gt;,
17 &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;
18 and
19 &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;
20 for those stories. But some times I want to integrate the timestamping
21 in other code, and recently I needed to integrate it into Python.
22 After searching a bit, I found
23 &lt;a href=&quot;https://dev.entrouvert.org/projects/python-rfc3161&quot;&gt;the
24 rfc3161 library&lt;/a&gt; which seemed like a good fit, but I soon
25 discovered it only worked for python version 2, and I needed something
26 that work with python version 3. Luckily I next came across
27 &lt;a href=&quot;https://github.com/trbs/rfc3161ng/&quot;&gt;the rfc3161ng library&lt;/a&gt;,
28 a fork of the original rfc3161 library. Not only is it working with
29 python 3, it have fixed a few of the bugs in the original library, and
30 it has an active maintainer. I decided to wrap it up and make it
31 &lt;a href=&quot;https://tracker.debian.org/pkg/python-rfc3161ng&quot;&gt;available in
32 Debian&lt;/a&gt;, and a few days ago it entered Debian unstable and testing.&lt;/p&gt;
33
34 &lt;p&gt;Using the library is fairly straight forward. The only slightly
35 problematic step is to fetch the required certificates to verify the
36 timestamp. For some services it is straight forward, while for others
37 I have not yet figured out how to do it. Here is a small standalone
38 code example based on of the integration tests in the library code:&lt;/p&gt;
39
40 &lt;pre&gt;
41 #!/usr/bin/python3
42
43 &quot;&quot;&quot;
44
45 Python 3 script demonstrating how to use the rfc3161ng module to
46 get trusted timestamps.
47
48 The license of this code is the same as the license of the rfc3161ng
49 library, ie MIT/BSD.
50
51 &quot;&quot;&quot;
52
53 import os
54 import pyasn1.codec.der
55 import rfc3161ng
56 import subprocess
57 import tempfile
58 import urllib.request
59
60 def store(f, data):
61 f.write(data)
62 f.flush()
63 f.seek(0)
64
65 def fetch(url, f=None):
66 response = urllib.request.urlopen(url)
67 data = response.read()
68 if f:
69 store(f, data)
70 return data
71
72 def main():
73 with tempfile.NamedTemporaryFile() as cert_f,\
74 tempfile.NamedTemporaryFile() as ca_f,\
75 tempfile.NamedTemporaryFile() as msg_f,\
76 tempfile.NamedTemporaryFile() as tsr_f:
77
78 # First fetch certificates used by service
79 certificate_data = fetch(&#39;https://freetsa.org/files/tsa.crt&#39;, cert_f)
80 ca_data_data = fetch(&#39;https://freetsa.org/files/cacert.pem&#39;, ca_f)
81
82 # Then timestamp the message
83 timestamper = \
84 rfc3161ng.RemoteTimestamper(&#39;http://freetsa.org/tsr&#39;,
85 certificate=certificate_data)
86 data = b&quot;Python forever!\n&quot;
87 tsr = timestamper(data=data, return_tsr=True)
88
89 # Finally, convert message and response to something &#39;openssl ts&#39; can verify
90 store(msg_f, data)
91 store(tsr_f, pyasn1.codec.der.encoder.encode(tsr))
92 args = [&quot;openssl&quot;, &quot;ts&quot;, &quot;-verify&quot;,
93 &quot;-data&quot;, msg_f.name,
94 &quot;-in&quot;, tsr_f.name,
95 &quot;-CAfile&quot;, ca_f.name,
96 &quot;-untrusted&quot;, cert_f.name]
97 subprocess.check_call(args)
98
99 if &#39;__main__&#39; == __name__:
100 main()
101 &lt;/pre&gt;
102
103 &lt;p&gt;The code fetches the required certificates, store them as temporary
104 files, timestamp a simple message, store the message and timestamp to
105 disk and ask &#39;openssl ts&#39; to verify the timestamp. A timestamp is
106 around 1.5 kiB in size, and should be fairly easy to store for future
107 use.&lt;/p&gt;
108
109 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
110 activities, please send Bitcoin donations to my address
111 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
112 </description>
113 </item>
114
115 <item>
116 <title>Automatic Google Drive sync using grive in Debian</title>
117 <link>http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html</link>
118 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html</guid>
119 <pubDate>Thu, 4 Oct 2018 15:20:00 +0200</pubDate>
120 <description>&lt;p&gt;A few days, I rescued a Windows victim over to Debian. To try to
121 rescue the remains, I helped set up automatic sync with Google Drive.
122 I did not find any sensible Debian package handling this
123 automatically, so I rebuild the grive2 source from
124 &lt;a href=&quot;http://www.webupd8.org/&quot;&gt;the Ubuntu UPD8 PPA&lt;/a&gt; to do the
125 task and added a autostart desktop entry and a small shell script to
126 run in the background while the user is logged in to do the sync.
127 Here is a sketch of the setup for future reference.&lt;/p&gt;
128
129 &lt;p&gt;I first created &lt;tt&gt;~/googledrive&lt;/tt&gt;, entered the directory and
130 ran &#39;&lt;tt&gt;grive -a&lt;/tt&gt;&#39; to authenticate the machine/user. Next, I
131 created a autostart hook in &lt;tt&gt;~/.config/autostart/grive.desktop&lt;/tt&gt;
132 to start the sync when the user log in:&lt;/p&gt;
133
134 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
135 [Desktop Entry]
136 Name=Google drive autosync
137 Type=Application
138 Exec=/home/user/bin/grive-sync
139 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
140
141 &lt;p&gt;Finally, I wrote the &lt;tt&gt;~/bin/grive-sync&lt;/tt&gt; script to sync
142 ~/googledrive/ with the files in Google Drive.&lt;/p&gt;
143
144 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
145 #!/bin/sh
146 set -e
147 cd ~/
148 cleanup() {
149 if [ &quot;$syncpid&quot; ] ; then
150 kill $syncpid
151 fi
152 }
153 trap cleanup EXIT INT QUIT
154 /usr/lib/grive/grive-sync.sh listen googledrive 2&gt;&amp;1 | sed &quot;s%^%$0:%&quot; &amp;
155 syncpdi=$!
156 while true; do
157 if ! xhost &gt;/dev/null 2&gt;&amp;1 ; then
158 echo &quot;no DISPLAY, exiting as the user probably logged out&quot;
159 exit 1
160 fi
161 if [ ! -e /run/user/1000/grive-sync.sh_googledrive ] ; then
162 /usr/lib/grive/grive-sync.sh sync googledrive
163 fi
164 sleep 300
165 done 2&gt;&amp;1 | sed &quot;s%^%$0:%&quot;
166 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
167
168 &lt;p&gt;Feel free to use the setup if you want. It can be assumed to be
169 GNU GPL v2 licensed (or any later version, at your leisure), but I
170 doubt this code is possible to claim copyright on.&lt;/p&gt;
171
172 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
173 activities, please send Bitcoin donations to my address
174 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
175 </description>
176 </item>
177
178 <item>
179 <title>Valutakrambod - A python and bitcoin love story</title>
180 <link>http://people.skolelinux.org/pere/blog/Valutakrambod___A_python_and_bitcoin_love_story.html</link>
181 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Valutakrambod___A_python_and_bitcoin_love_story.html</guid>
182 <pubDate>Sat, 29 Sep 2018 22:20:00 +0200</pubDate>
183 <description>&lt;p&gt;It would come as no surprise to anyone that I am interested in
184 bitcoins and virtual currencies. I&#39;ve been keeping an eye on virtual
185 currencies for many years, and it is part of the reason a few months
186 ago, I started writing a python library for collecting currency
187 exchange rates and trade on virtual currency exchanges. I decided to
188 name the end result valutakrambod, which perhaps can be translated to
189 small currency shop.&lt;/p&gt;
190
191 &lt;p&gt;The library uses the tornado python library to handle HTTP and
192 websocket connections, and provide a asynchronous system for
193 connecting to and tracking several services. The code is available
194 from
195 &lt;a href=&quot;http://github.com/petterreinholdtsen/valutakrambod&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;
196
197 &lt;/p&gt;There are two example clients of the library. One is very simple and
198 list every updated buy/sell price received from the various services.
199 This code is started by running bin/btc-rates and call the client code
200 in valutakrambod/client.py. The simple client look like this:&lt;/p&gt;
201
202 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
203 import functools
204 import tornado.ioloop
205 import valutakrambod
206 class SimpleClient(object):
207 def __init__(self):
208 self.services = []
209 self.streams = []
210 pass
211 def newdata(self, service, pair, changed):
212 print(&quot;%-15s %s-%s: %8.3f %8.3f&quot; % (
213 service.servicename(),
214 pair[0],
215 pair[1],
216 service.rates[pair][&#39;ask&#39;],
217 service.rates[pair][&#39;bid&#39;])
218 )
219 async def refresh(self, service):
220 await service.fetchRates(service.wantedpairs)
221 def run(self):
222 self.ioloop = tornado.ioloop.IOLoop.current()
223 self.services = valutakrambod.service.knownServices()
224 for e in self.services:
225 service = e()
226 service.subscribe(self.newdata)
227 stream = service.websocket()
228 if stream:
229 self.streams.append(stream)
230 else:
231 # Fetch information from non-streaming services immediately
232 self.ioloop.call_later(len(self.services),
233 functools.partial(self.refresh, service))
234 # as well as regularly
235 service.periodicUpdate(60)
236 for stream in self.streams:
237 stream.connect()
238 try:
239 self.ioloop.start()
240 except KeyboardInterrupt:
241 print(&quot;Interrupted by keyboard, closing all connections.&quot;)
242 pass
243 for stream in self.streams:
244 stream.close()
245 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
246
247 &lt;p&gt;The library client loops over all known &quot;public&quot; services,
248 initialises it, subscribes to any updates from the service, checks and
249 activates websocket streaming if the service provide it, and if no
250 streaming is supported, fetches information from the service and sets
251 up a periodic update every 60 seconds. The output from this client
252 can look like this:&lt;/p&gt;
253
254 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
255 Bl3p BTC-EUR: 5687.110 5653.690
256 Bl3p BTC-EUR: 5687.110 5653.690
257 Bl3p BTC-EUR: 5687.110 5653.690
258 Hitbtc BTC-USD: 6594.560 6593.690
259 Hitbtc BTC-USD: 6594.560 6593.690
260 Bl3p BTC-EUR: 5687.110 5653.690
261 Hitbtc BTC-USD: 6594.570 6593.690
262 Bitstamp EUR-USD: 1.159 1.154
263 Hitbtc BTC-USD: 6594.570 6593.690
264 Hitbtc BTC-USD: 6594.580 6593.690
265 Hitbtc BTC-USD: 6594.580 6593.690
266 Hitbtc BTC-USD: 6594.580 6593.690
267 Bl3p BTC-EUR: 5687.110 5653.690
268 Paymium BTC-EUR: 5680.000 5620.240
269 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
270
271 &lt;p&gt;The exchange order book is tracked in addition to the best buy/sell
272 price, for those that need to know the details.&lt;/p&gt;
273
274 &lt;p&gt;The other example client is focusing on providing a curses view
275 with updated buy/sell prices as soon as they are received from the
276 services. This code is located in bin/btc-rates-curses and activated
277 by using the &#39;-c&#39; argument. Without the argument the &quot;curses&quot; output
278 is printed without using curses, which is useful for debugging. The
279 curses view look like this:&lt;/p&gt;
280
281 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
282 Name Pair Bid Ask Spr Ftcd Age
283 BitcoinsNorway BTCEUR 5591.8400 5711.0800 2.1% 16 nan 60
284 Bitfinex BTCEUR 5671.0000 5671.2000 0.0% 16 22 59
285 Bitmynt BTCEUR 5580.8000 5807.5200 3.9% 16 41 60
286 Bitpay BTCEUR 5663.2700 nan nan% 15 nan 60
287 Bitstamp BTCEUR 5664.8400 5676.5300 0.2% 0 1 1
288 Bl3p BTCEUR 5653.6900 5684.9400 0.5% 0 nan 19
289 Coinbase BTCEUR 5600.8200 5714.9000 2.0% 15 nan nan
290 Kraken BTCEUR 5670.1000 5670.2000 0.0% 14 17 60
291 Paymium BTCEUR 5620.0600 5680.0000 1.1% 1 7515 nan
292 BitcoinsNorway BTCNOK 52898.9700 54034.6100 2.1% 16 nan 60
293 Bitmynt BTCNOK 52960.3200 54031.1900 2.0% 16 41 60
294 Bitpay BTCNOK 53477.7833 nan nan% 16 nan 60
295 Coinbase BTCNOK 52990.3500 54063.0600 2.0% 15 nan nan
296 MiraiEx BTCNOK 52856.5300 54100.6000 2.3% 16 nan nan
297 BitcoinsNorway BTCUSD 6495.5300 6631.5400 2.1% 16 nan 60
298 Bitfinex BTCUSD 6590.6000 6590.7000 0.0% 16 23 57
299 Bitpay BTCUSD 6564.1300 nan nan% 15 nan 60
300 Bitstamp BTCUSD 6561.1400 6565.6200 0.1% 0 2 1
301 Coinbase BTCUSD 6504.0600 6635.9700 2.0% 14 nan 117
302 Gemini BTCUSD 6567.1300 6573.0700 0.1% 16 89 nan
303 Hitbtc+BTCUSD 6592.6200 6594.2100 0.0% 0 0 0
304 Kraken BTCUSD 6565.2000 6570.9000 0.1% 15 17 58
305 Exchangerates EURNOK 9.4665 9.4665 0.0% 16 107789 nan
306 Norgesbank EURNOK 9.4665 9.4665 0.0% 16 107789 nan
307 Bitstamp EURUSD 1.1537 1.1593 0.5% 4 5 1
308 Exchangerates EURUSD 1.1576 1.1576 0.0% 16 107789 nan
309 BitcoinsNorway LTCEUR 1.0000 49.0000 98.0% 16 nan nan
310 BitcoinsNorway LTCNOK 492.4800 503.7500 2.2% 16 nan 60
311 BitcoinsNorway LTCUSD 1.0221 49.0000 97.9% 15 nan nan
312 Norgesbank USDNOK 8.1777 8.1777 0.0% 16 107789 nan
313 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
314
315 &lt;p&gt;The code for this client is too complex for a simple blog post, so
316 you will have to check out the git repository to figure out how it
317 work. What I can tell is how the three last numbers on each line
318 should be interpreted. The first is how many seconds ago information
319 was received from the service. The second is how long ago, according
320 to the service, the provided information was updated. The last is an
321 estimate on how often the buy/sell values change.&lt;/p&gt;
322
323 &lt;p&gt;If you find this library useful, or would like to improve it, I
324 would love to hear from you. Note that for some of the services I&#39;ve
325 implemented a trading API. It might be the topic of a future blog
326 post.&lt;/p&gt;
327
328 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
329 activities, please send Bitcoin donations to my address
330 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
331 </description>
332 </item>
333
334 <item>
335 <title>VLC in Debian now can do bittorrent streaming</title>
336 <link>http://people.skolelinux.org/pere/blog/VLC_in_Debian_now_can_do_bittorrent_streaming.html</link>
337 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/VLC_in_Debian_now_can_do_bittorrent_streaming.html</guid>
338 <pubDate>Mon, 24 Sep 2018 21:20:00 +0200</pubDate>
339 <description>&lt;p&gt;Back in February, I got curious to see
340 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/Using_VLC_to_stream_bittorrent_sources.html&quot;&gt;if
341 VLC now supported Bittorrent streaming&lt;/a&gt;. It did not, despite the
342 fact that the idea and code to handle such streaming had been floating
343 around for years. I did however find
344 &lt;a href=&quot;https://github.com/johang/vlc-bittorrent&quot;&gt;a standalone plugin
345 for VLC&lt;/a&gt; to do it, and half a year later I decided to wrap up the
346 plugin and get it into Debian. I uploaded it to NEW a few days ago,
347 and am very happy to report that it
348 &lt;a href=&quot;https://tracker.debian.org/pkg/vlc-plugin-bittorrent&quot;&gt;entered
349 Debian&lt;/a&gt; a few hours ago, and should be available in Debian/Unstable
350 tomorrow, and Debian/Testing in a few days.&lt;/p&gt;
351
352 &lt;p&gt;With the vlc-plugin-bittorrent package installed you should be able
353 to stream videos using a simple call to&lt;/p&gt;
354
355 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
356 vlc https://archive.org/download/TheGoat/TheGoat_archive.torrent
357 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
358
359 &lt;/p&gt;It can handle magnet links too. Now if only native vlc had
360 bittorrent support. Then a lot more would be helping each other to
361 share public domain and creative commons movies. The plugin need some
362 stability work with seeking and picking the right file in a torrent
363 with many files, but is already usable. Please note that the plugin
364 is not removing downloaded files when vlc is stopped, so it can fill
365 up your disk if you are not careful. Have fun. :)&lt;/p&gt;
366
367 &lt;p&gt;I would love to get help maintaining this package. Get in touch if
368 you are interested.&lt;/p&gt;
369
370 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
371 activities, please send Bitcoin donations to my address
372 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
373 </description>
374 </item>
375
376 <item>
377 <title>Using the Kodi API to play Youtube videos</title>
378 <link>http://people.skolelinux.org/pere/blog/Using_the_Kodi_API_to_play_Youtube_videos.html</link>
379 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Using_the_Kodi_API_to_play_Youtube_videos.html</guid>
380 <pubDate>Sun, 2 Sep 2018 23:40:00 +0200</pubDate>
381 <description>&lt;p&gt;I continue to explore my Kodi installation, and today I wanted to
382 tell it to play a youtube URL I received in a chat, without having to
383 insert search terms using the on-screen keyboard. After searching the
384 web for API access to the Youtube plugin and testing a bit, I managed
385 to find a recipe that worked. If you got a kodi instance with its API
386 available from http://kodihost/jsonrpc, you can try the following to
387 have check out a nice cover band.&lt;/p&gt;
388
389 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;curl --silent --header &#39;Content-Type: application/json&#39; \
390 --data-binary &#39;{ &quot;id&quot;: 1, &quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;method&quot;: &quot;Player.Open&quot;,
391 &quot;params&quot;: {&quot;item&quot;: { &quot;file&quot;:
392 &quot;plugin://plugin.video.youtube/play/?video_id=LuRGVM9O0qg&quot; } } }&#39; \
393 http://projector.local/jsonrpc&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
394
395 &lt;p&gt;I&#39;ve extended kodi-stream program to take a video source as its
396 first argument. It can now handle direct video links, youtube links
397 and &#39;desktop&#39; to stream my desktop to Kodi. It is almost like a
398 Chromecast. :)&lt;/p&gt;
399
400 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
401 activities, please send Bitcoin donations to my address
402 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
403 </description>
404 </item>
405
406 <item>
407 <title>Software created using taxpayers’ money should be Free Software</title>
408 <link>http://people.skolelinux.org/pere/blog/Software_created_using_taxpayers__money_should_be_Free_Software.html</link>
409 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Software_created_using_taxpayers__money_should_be_Free_Software.html</guid>
410 <pubDate>Thu, 30 Aug 2018 13:50:00 +0200</pubDate>
411 <description>&lt;p&gt;It might seem obvious that software created using tax money should
412 be available for everyone to use and improve. Free Software
413 Foundation Europe recentlystarted a campaign to help get more people
414 to understand this, and I just signed the petition on
415 &lt;a href=&quot;https://publiccode.eu/&quot;&gt;Public Money, Public Code&lt;/a&gt; to help
416 them. I hope you too will do the same.&lt;/p&gt;
417 </description>
418 </item>
419
420 <item>
421 <title>A bit more on privacy respecting health monitor / fitness tracker</title>
422 <link>http://people.skolelinux.org/pere/blog/A_bit_more_on_privacy_respecting_health_monitor___fitness_tracker.html</link>
423 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/A_bit_more_on_privacy_respecting_health_monitor___fitness_tracker.html</guid>
424 <pubDate>Mon, 13 Aug 2018 09:00:00 +0200</pubDate>
425 <description>&lt;p&gt;A few days ago, I wondered if there are any privacy respecting
426 health monitors and/or fitness trackers available for sale these days.
427 I would like to buy one, but do not want to share my personal data
428 with strangers, nor be forced to have a mobile phone to get data out
429 of the unit. I&#39;ve received some ideas, and would like to share them
430 with you.
431
432 One interesting data point was a pointer to a Free Software app for
433 Android named
434 &lt;a href=&quot;https://github.com/Freeyourgadget/Gadgetbridge/&quot;&gt;Gadgetbridge&lt;/a&gt;.
435 It provide cloudless collection and storing of data from a variety of
436 trackers. Its
437 &lt;a href=&quot;https://github.com/Freeyourgadget/Gadgetbridge/#supported-devices&quot;&gt;list
438 of supported devices&lt;/a&gt; is a good indicator for units where the
439 protocol is fairly open, as it is obviously being handled by Free
440 Software. Other units are reportedly encrypting the collected
441 information with their own public key, making sure only the vendor
442 cloud service is able to extract data from the unit. The people
443 contacting me about Gadgetbirde said they were using
444 &lt;a href=&quot;https://us.amazfit.com/shop/bip?variant=336750&quot;&gt;Amazfit
445 Bip&lt;/a&gt; and
446 &lt;a href=&quot;http://www.xiaomimi6phone.com/xiaomi-mi-band-3-features-release-date-rumors/&quot;&gt;Xiaomi
447 Band 3&lt;/a&gt;.&lt;/p&gt;
448
449 &lt;p&gt;I also got a suggestion to look at some of the units from Garmin.
450 I was told their GPS watches can be connected via USB and show up as a
451 USB storage device with
452 &lt;a href=&quot;https://www.gpsbabel.org/htmldoc-development/fmt_garmin_fit.html&quot;&gt;Garmin
453 FIT files&lt;/a&gt; containing the collected measurements. While
454 proprietary, FIT files apparently can be read at least by
455 &lt;a href=&quot;https://www.gpsbabel.org&quot;&gt;GPSBabel&lt;/a&gt; and the
456 &lt;a href=&quot;https://apps.nextcloud.com/apps/gpxpod&quot;&gt;GpxPod&lt;/a&gt; Nextcloud
457 app. It is unclear to me if they can read step count and heart rate
458 data. The person I talked to was using a
459 &lt;a href=&quot;https://buy.garmin.com/en-US/US/p/564291&quot;&gt;Garmin Forerunner
460 935&lt;/a&gt;, which is a fairly expensive unit. I doubt it is worth it for
461 a unit where the vendor clearly is trying its best to move from open
462 to closed systems. I still remember when Garmin dropped NMEA support
463 in its GPSes.&lt;/p&gt;
464
465 &lt;p&gt;A final idea was to build ones own unit, perhaps by basing it on a
466 wearable hardware platforms like
467 &lt;a href=&quot;https://learn.adafruit.com/flora-geo-watch&quot;&gt;the Flora Geo
468 Watch&lt;/a&gt;. Sound like fun, but I had more money than time to spend on
469 the topic, so I suspect it will have to wait for another time.&lt;/p&gt;
470
471 &lt;p&gt;While I was working on tracking down links, I came across an
472 inspiring TED talk by Dave Debronkart about
473 &lt;a href=&quot;https://archive.org/details/DavedeBronkart_2010X&quot;&gt;being a
474 e-patient&lt;/a&gt;, and discovered the web site
475 &lt;a href=&quot;https://participatorymedicine.org/epatients/&quot;&gt;Participatory
476 Medicine&lt;/a&gt;. If you too want to track your own health and fitness
477 without having information about your private life floating around on
478 computers owned by others, I recommend checking it out.&lt;/p&gt;
479
480 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
481 activities, please send Bitcoin donations to my address
482 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
483 </description>
484 </item>
485
486 <item>
487 <title>Privacy respecting health monitor / fitness tracker?</title>
488 <link>http://people.skolelinux.org/pere/blog/Privacy_respecting_health_monitor___fitness_tracker_.html</link>
489 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Privacy_respecting_health_monitor___fitness_tracker_.html</guid>
490 <pubDate>Tue, 7 Aug 2018 16:00:00 +0200</pubDate>
491 <description>&lt;p&gt;Dear lazyweb,&lt;/p&gt;
492
493 &lt;p&gt;I wonder, is there a fitness tracker / health monitor available for
494 sale today that respect the users privacy? With this I mean a
495 watch/bracelet capable of measuring pulse rate and other
496 fitness/health related values (and by all means, also the correct time
497 and location if possible), which is &lt;strong&gt;only&lt;/strong&gt; provided for
498 me to extract/read from the unit with computer without a radio beacon
499 and Internet connection. In other words, it do not depend on a cell
500 phone app, and do make the measurements available via other peoples
501 computer (aka &quot;the cloud&quot;). The collected data should be available
502 using only free software. I&#39;m not interested in depending on some
503 non-free software that will leave me high and dry some time in the
504 future. I&#39;ve been unable to find any such unit. I would like to buy
505 it. The ones I have seen for sale here in Norway are proud to report
506 that they share my health data with strangers (aka &quot;cloud enabled&quot;).
507 Is there an alternative? I&#39;m not interested in giving money to people
508 requiring me to accept &quot;privacy terms&quot; to allow myself to measure my
509 own health.&lt;/p&gt;
510
511 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
512 activities, please send Bitcoin donations to my address
513 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
514 </description>
515 </item>
516
517 <item>
518 <title>Sharing images with friends and family using RSS and EXIF/XMP metadata</title>
519 <link>http://people.skolelinux.org/pere/blog/Sharing_images_with_friends_and_family_using_RSS_and_EXIF_XMP_metadata.html</link>
520 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Sharing_images_with_friends_and_family_using_RSS_and_EXIF_XMP_metadata.html</guid>
521 <pubDate>Tue, 31 Jul 2018 23:30:00 +0200</pubDate>
522 <description>&lt;p&gt;For a while now, I have looked for a sensible way to share images
523 with my family using a self hosted solution, as it is unacceptable to
524 place images from my personal life under the control of strangers
525 working for data hoarders like Google or Dropbox. The last few days I
526 have drafted an approach that might work out, and I would like to
527 share it with you. I would like to publish images on a server under
528 my control, and point some Internet connected display units using some
529 free and open standard to the images I published. As my primary
530 language is not limited to ASCII, I need to store metadata using
531 UTF-8. Many years ago, I hoped to find a digital photo frame capable
532 of reading a RSS feed with image references (aka using the
533 &amp;lt;enclosure&amp;gt; RSS tag), but was unable to find a current supplier
534 of such frames. In the end I gave up that approach.&lt;/p&gt;
535
536 &lt;p&gt;Some months ago, I discovered that
537 &lt;a href=&quot;https://www.jwz.org/xscreensaver/&quot;&gt;XScreensaver&lt;/a&gt; is able to
538 read images from a RSS feed, and used it to set up a screen saver on
539 my home info screen, showing images from the Daily images feed from
540 NASA. This proved to work well. More recently I discovered that
541 &lt;a href=&quot;https://kodi.tv&quot;&gt;Kodi&lt;/a&gt; (both using
542 &lt;a href=&quot;https://www.openelec.tv/&quot;&gt;OpenELEC&lt;/a&gt; and
543 &lt;a href=&quot;https://libreelec.tv&quot;&gt;LibreELEC&lt;/a&gt;) provide the
544 &lt;a href=&quot;https://github.com/grinsted/script.screensaver.feedreader&quot;&gt;Feedreader&lt;/a&gt;
545 screen saver capable of reading a RSS feed with images and news. For
546 fun, I used it this summer to test Kodi on my parents TV by hooking up
547 a Raspberry PI unit with LibreELEC, and wanted to provide them with a
548 screen saver showing selected pictures from my selection.&lt;/p&gt;
549
550 &lt;p&gt;Armed with motivation and a test photo frame, I set out to generate
551 a RSS feed for the Kodi instance. I adjusted my &lt;a
552 href=&quot;https://freedombox.org/&quot;&gt;Freedombox&lt;/a&gt; instance, created
553 /var/www/html/privatepictures/, wrote a small Perl script to extract
554 title and description metadata from the photo files and generate the
555 RSS file. I ended up using Perl instead of python, as the
556 libimage-exiftool-perl Debian package seemed to handle the EXIF/XMP
557 tags I ended up using, while python3-exif did not. The relevant EXIF
558 tags only support ASCII, so I had to find better alternatives. XMP
559 seem to have the support I need.&lt;/p&gt;
560
561 &lt;p&gt;I am a bit unsure which EXIF/XMP tags to use, as I would like to
562 use tags that can be easily added/updated using normal free software
563 photo managing software. I ended up using the tags set using this
564 exiftool command, as these tags can also be set using digiKam:&lt;/p&gt;
565
566 &lt;blockquote&gt;&lt;pre&gt;
567 exiftool -headline=&#39;The RSS image title&#39; \
568 -description=&#39;The RSS image description.&#39; \
569 -subject+=for-family photo.jpeg
570 &lt;/pre&gt;&lt;/blockquote&gt;
571
572 &lt;p&gt;I initially tried the &quot;-title&quot; and &quot;keyword&quot; tags, but they were
573 invisible in digiKam, so I changed to &quot;-headline&quot; and &quot;-subject&quot;. I
574 use the keyword/subject &#39;for-family&#39; to flag that the photo should be
575 shared with my family. Images with this keyword set are located and
576 copied into my Freedombox for the RSS generating script to find.&lt;/p&gt;
577
578 &lt;p&gt;Are there better ways to do this? Get in touch if you have better
579 suggestions.&lt;/p&gt;
580
581 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
582 activities, please send Bitcoin donations to my address
583 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
584 </description>
585 </item>
586
587 <item>
588 <title>Simple streaming the Linux desktop to Kodi using GStreamer and RTP</title>
589 <link>http://people.skolelinux.org/pere/blog/Simple_streaming_the_Linux_desktop_to_Kodi_using_GStreamer_and_RTP.html</link>
590 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Simple_streaming_the_Linux_desktop_to_Kodi_using_GStreamer_and_RTP.html</guid>
591 <pubDate>Thu, 12 Jul 2018 17:55:00 +0200</pubDate>
592 <description>&lt;p&gt;Last night, I wrote
593 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html&quot;&gt;a
594 recipe to stream a Linux desktop using VLC to a instance of Kodi&lt;/a&gt;.
595 During the day I received valuable feedback, and thanks to the
596 suggestions I have been able to rewrite the recipe into a much simpler
597 approach requiring no setup at all. It is a single script that take
598 care of it all.&lt;/p&gt;
599
600 &lt;p&gt;This new script uses GStreamer instead of VLC to capture the
601 desktop and stream it to Kodi. This fixed the video quality issue I
602 saw initially. It further removes the need to add a m3u file on the
603 Kodi machine, as it instead connects to
604 &lt;a href=&quot;https://kodi.wiki/view/JSON-RPC_API/v8&quot;&gt;the JSON-RPC API in
605 Kodi&lt;/a&gt; and simply ask Kodi to play from the stream created using
606 GStreamer. Streaming the desktop to Kodi now become trivial. Copy
607 the script below, run it with the DNS name or IP address of the kodi
608 server to stream to as the only argument, and watch your screen show
609 up on the Kodi screen. Note, it depend on multicast on the local
610 network, so if you need to stream outside the local network, the
611 script must be modified. Also note, I have no idea if audio work, as
612 I only care about the picture part.&lt;/p&gt;
613
614 &lt;blockquote&gt;&lt;pre&gt;
615 #!/bin/sh
616 #
617 # Stream the Linux desktop view to Kodi. See
618 # http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html
619 # for backgorund information.
620
621 # Make sure the stream is stopped in Kodi and the gstreamer process is
622 # killed if something go wrong (for example if curl is unable to find the
623 # kodi server). Do the same when interrupting this script.
624 kodicmd() {
625 host=&quot;$1&quot;
626 cmd=&quot;$2&quot;
627 params=&quot;$3&quot;
628 curl --silent --header &#39;Content-Type: application/json&#39; \
629 --data-binary &quot;{ \&quot;id\&quot;: 1, \&quot;jsonrpc\&quot;: \&quot;2.0\&quot;, \&quot;method\&quot;: \&quot;$cmd\&quot;, \&quot;params\&quot;: $params }&quot; \
630 &quot;http://$host/jsonrpc&quot;
631 }
632 cleanup() {
633 if [ -n &quot;$kodihost&quot; ] ; then
634 # Stop the playing when we end
635 playerid=$(kodicmd &quot;$kodihost&quot; Player.GetActivePlayers &quot;{}&quot; |
636 jq .result[].playerid)
637 kodicmd &quot;$kodihost&quot; Player.Stop &quot;{ \&quot;playerid\&quot; : $playerid }&quot; &gt; /dev/null
638 fi
639 if [ &quot;$gstpid&quot; ] &amp;&amp; kill -0 &quot;$gstpid&quot; &gt;/dev/null 2&gt;&amp;1; then
640 kill &quot;$gstpid&quot;
641 fi
642 }
643 trap cleanup EXIT INT
644
645 if [ -n &quot;$1&quot; ]; then
646 kodihost=$1
647 shift
648 else
649 kodihost=kodi.local
650 fi
651
652 mcast=239.255.0.1
653 mcastport=1234
654 mcastttl=1
655
656 pasrc=$(pactl list | grep -A2 &#39;Source #&#39; | grep &#39;Name: .*\.monitor$&#39; | \
657 cut -d&quot; &quot; -f2|head -1)
658 gst-launch-1.0 ximagesrc use-damage=0 ! video/x-raw,framerate=30/1 ! \
659 videoconvert ! queue2 ! \
660 x264enc bitrate=8000 speed-preset=superfast tune=zerolatency qp-min=30 \
661 key-int-max=15 bframes=2 ! video/x-h264,profile=high ! queue2 ! \
662 mpegtsmux alignment=7 name=mux ! rndbuffersize max=1316 min=1316 ! \
663 udpsink host=$mcast port=$mcastport ttl-mc=$mcastttl auto-multicast=1 sync=0 \
664 pulsesrc device=$pasrc ! audioconvert ! queue2 ! avenc_aac ! queue2 ! mux. \
665 &gt; /dev/null 2&gt;&amp;1 &amp;
666 gstpid=$!
667
668 # Give stream a second to get going
669 sleep 1
670
671 # Ask kodi to start streaming using its JSON-RPC API
672 kodicmd &quot;$kodihost&quot; Player.Open \
673 &quot;{\&quot;item\&quot;: { \&quot;file\&quot;: \&quot;udp://@$mcast:$mcastport\&quot; } }&quot; &gt; /dev/null
674
675 # wait for gst to end
676 wait &quot;$gstpid&quot;
677 &lt;/pre&gt;&lt;/blockquote&gt;
678
679 &lt;p&gt;I hope you find the approach useful. I know I do.&lt;/p&gt;
680
681 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
682 activities, please send Bitcoin donations to my address
683 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
684 </description>
685 </item>
686
687 </channel>
688 </rss>