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