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