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>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><p
>Yesterday, I had the pleasure of watching on Frikanalen the OWASP
15 talk by Scott Helme titled
16 "<a href=
"https://frikanalen.no/video/
626080/
">What We’ve Learned From
17 Billions of Security Reports
</a
>". I had not heard of the
18 <a href=
"https://en.wikipedia.org/wiki/Content_Security_Policy
">Content
19 Security Policy standard
</a
> nor its ability to
"call home
" 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.
</p
>
23 <p
>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
"only
26 local content
" policy despite web designers urge to fetch programs
27 from random sites on the Internet, like the one
28 <a href=
"https://securityaffairs.co/wordpress/
68966/hacking/browsealoud-plugin-hack.html
">enabling
29 the attack
</a
> reported by Scott Helme earlier this year.
</p
>
31 <p
>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 <a href=
"https://www.w3.org/TR/CSP/
">standardized under W3C
</a
> these
36 days, and is supposed by most web browsers
</p
>
38 <p
>I managed to find
<a href=
"https://github.com/mozilla/django-csp
">a
39 Django middleware for implementing CSP
</a
> 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.
</p
>
43 <p
>As usual, if you use Bitcoin and want to show your support of my
44 activities, please send Bitcoin donations to my address
45 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
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><p
>If you read my blog regularly, you probably know I am involved in
55 running and developing the
<a href=
"https://frikanalen.no/
">Norwegian
56 TV channel Frikanalen
</a
>. 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 <a href=
"https://kodi.tv/addon/plugins-video-add-ons/frikanalen-nett-tv
">new
63 and improved version
0.0.3 Frikanalen addon
</a
> 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
<a href=
"https://casparcg.com/
">CasparCG
</a
>
70 output look like. The alternative is the SD video stream, generated
71 using MLT. CasparCG is controlled by our
72 <a href=
"https://github.com/Frikanalen/mltplayout/
">mltplayout
73 server
</a
> which instead of talking to mlt is giving PLAY instructions
74 to the CasparCG server when it is time to start a new program.
</p
>
76 <p
>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
<a href=
"https://www.nuug.no/
">NUUG
</a
>,
79 <a href=
"https://www.debconf.org/
">Debconf
</a
>, Makercon, and TED,
80 but there are also some periods with
81 <a href=
"https://www.empo.no/
">EMPT TV
</a
> and
82 <a href=
"https://www.p7.no/
">P7
</a
>.
84 <p
>As usual, if you use Bitcoin and want to show your support of my
85 activities, please send Bitcoin donations to my address
86 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
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><p
>As part of my involvement in
96 <a href=
"https://gitlab.com/OsloMet-ABI/nikita-noark5-core
">the Nikita
97 archive API project
</a
>, I
'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
<a href=
"https://notmuchmail.org/
">my
100 notmuch email database
</a
>, 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 <a href=
"https://www.iana.org/assignments/media-types/media-types.xhtml
">an
106 official MIME type
</a
> 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.
</p
>
113 <p
>To try to get one official MIME type for these files, I
've brought
115 <a href=
"https://www.ietf.org/mailman/listinfo/media-types
">the
116 media-types mailing list
</a
>. 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?
</p
>
121 <p
>As usual, if you use Bitcoin and want to show your support of my
122 activities, please send Bitcoin donations to my address
123 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
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><p
><img src=
"http://people.skolelinux.org/pere/blog/images/
2018-
10-
22-audmes-measure-speakers.png
" align=
"right
" width=
"40%
"/
></p
>
134 <p
>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
'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 <a href=
"https://www.diyaudioandvideo.com/Tutorial/SpeakerResponseTesting/
">Speaker
141 Testing and Analysis
</a
> describing how to test speakers, and it listing
142 several software options, among them
143 <a href=
"https://sourceforge.net/projects/audmes/
">AUDio MEasurement
144 System (AUDMES)
</a
>. 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 <a href=
"http://novo.press/understanding-speaker-specifications-and-frequency-response/
">Understanding
148 Speaker Specifications and Frequency Response
</a
> and an article from
150 <a href=
"https://www.ecoustics.com/articles/understanding-speaker-frequency-response/
">Understanding
151 Speaker Frequency Response
</a
>, 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.
</p
>
155 <p
>The first hurdle was that AUDMES hadn
'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.
</p
>
168 <p
>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 <a href=
"http://freehearingtestsoftware.com
">Free Hearing Test
175 Software
</a
>, 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.
</p
>
184 <p
>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 <a href=
"https://bugs.debian.org/
910876">include in Debian
</a
>? 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 <a href=
"https://www.roomeqwizard.com/
">REW
</a
>, but I want something
193 that can be developed also when the vendor looses interest.
</p
>
195 <p
>As usual, if you use Bitcoin and want to show your support of my
196 activities, please send Bitcoin donations to my address
197 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
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><p
>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 <a href=
"https://www.nrk.no/
">NRK
</a
>, Linux distributors like
210 <a href=
"https://www.debian.org/
">Debian
</a
> and
211 <a href=
"https://www.ubuntu.com/
">Ubuntu
</a
>, and of course the
212 <a href=
"https://archive.org/
">Internet archive
</A
>.
214 <p
>Almost a month ago
215 <a href=
"https://tracker.debian.org/pkg/vlc-plugin-bittorrent
">a new
216 package adding Bittorrent support to VLC
</a
> became available in
217 Debian testing and unstable. To test it, simply install it like
221 apt install vlc-plugin-bittorrent
222 </pre
></p
>
224 <p
>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,
235 <a href=
"https://archive.org/details/CopyingIsNotTheft1080p
">Internet
236 Archive page with movies
</a
> using a web browser and click on the
237 torrent link to start streaming the movie.
</p
>
239 <p
>Note, there is still some misfeatures in the plugin. One is the
240 fact that it will hang and
241 <a href=
"https://github.com/johang/vlc-bittorrent/issues/
13">block VLC
242 from exiting until the torrent streaming starts
</a
>. Another is the
244 <a href=
"https://github.com/johang/vlc-bittorrent/issues/
9">will pick
245 and play a random file in a multi file torrent
</a
>. 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.
</p
>
250 <p
>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.
</p
>
257 <p
>As usual, if you use Bitcoin and want to show your support of my
258 activities, please send Bitcoin donations to my address
259 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
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><p
>This morning, the new release of the
269 <a href=
"https://gitlab.com/OsloMet-ABI/nikita-noark5-core/
">Nikita
270 Noark
5 core project
</a
> was
271 <a href=
"https://lists.nuug.no/pipermail/nikita-noark/
2018-October/
000406.html
">announced
272 on the project mailing list
</a
>. 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):
278 <li
>Fix typos in REL names
</li
>
279 <li
>Tidy up error message reporting
</li
>
280 <li
>Fix issue where we used Integer.valueOf(), not Integer.getInteger()
</li
>
281 <li
>Change some String handling to StringBuffer
</li
>
282 <li
>Fix error reporting
</li
>
283 <li
>Code tidy-up
</li
>
284 <li
>Fix issue using static non-synchronized SimpleDateFormat to avoid
285 race conditions
</li
>
286 <li
>Fix problem where deserialisers were treating integers as strings
</li
>
287 <li
>Update methods to make them null-safe
</li
>
288 <li
>Fix many issues reported by coverity
</li
>
289 <li
>Improve equals(), compareTo() and hash() in domain model
</li
>
290 <li
>Improvements to the domain model for metadata classes
</li
>
291 <li
>Fix CORS issues when downloading document
</li
>
292 <li
>Implementation of case-handling with registryEntry and document upload
</li
>
293 <li
>Better support in Javascript for OPTIONS
</li
>
294 <li
>Adding concept description of mail integration
</li
>
295 <li
>Improve setting of default values for GET on ny-journalpost
</li
>
296 <li
>Better handling of required values during deserialisation
</li
>
297 <li
>Changed tilknyttetDato (M620) from date to dateTime
</li
>
298 <li
>Corrected some opprettetDato (M600) (de)serialisation errors.
</li
>
299 <li
>Improve parse error reporting.
</li
>
300 <li
>Started on OData search and filtering.
</li
>
301 <li
>Added Contributor Covenant Code of Conduct to project.
</li
>
302 <li
>Moved repository and project from Github to Gitlab.
</li
>
303 <li
>Restructured repository, moved code into src/ and web/.
</li
>
304 <li
>Updated code to use Spring Boot version
2.
</li
>
305 <li
>Added support for OAuth2 authentication.
</li
>
306 <li
>Fixed several bugs discovered by Coverity.
</li
>
307 <li
>Corrected handling of date/datetime fields.
</li
>
308 <li
>Improved error reporting when rejecting during deserializatoin.
</li
>
309 <li
>Adjusted default values provided for ny-arkivdel, ny-mappe,
310 ny-saksmappe, ny-journalpost and ny-dokumentbeskrivelse.
</li
>
311 <li
>Several fixes for korrespondansepart*.
</li
>
312 <li
>Updated web GUI:
314 <li
>Now handle both file upload and download.
</li
>
315 <li
>Uses new OAuth2 authentication for login.
</li
>
316 <li
>Forms now fetches default values from API using GET.
</li
>
317 <li
>Added RFC
822 (email), TIFF and JPEG to list of possible file formats.
</li
>
318 </ul
></li
>
321 <p
>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(-).
</p
>
325 <p
>If free and open standardized archiving API sound interesting to
326 you, please contact us on IRC
327 (
<a href=
"irc://irc.freenode.net/%
23nikita
">#nikita on
328 irc.freenode.net
</a
>) or email
329 (
<a href=
"https://lists.nuug.no/mailman/listinfo/nikita-noark
">nikita-noark
330 mailing list
</a
>).
</p
>
332 <p
>As usual, if you use Bitcoin and want to show your support of my
333 activities, please send Bitcoin donations to my address
334 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
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><p
>I have earlier covered the basics of trusted timestamping using the
344 'openssl ts
' client. See blog post for
345 <a href=
"http://people.skolelinux.org/pere/blog/Public_Trusted_Timestamping_services_for_everyone.html
">2014</a
>,
346 <a href=
"http://people.skolelinux.org/pere/blog/syslog_trusted_timestamp___chain_of_trusted_timestamps_for_your_syslog.html
">2016</a
>
348 <a href=
"http://people.skolelinux.org/pere/blog/Idea_for_storing_trusted_timestamps_in_a_Noark_5_archive.html
">2017</a
>
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 <a href=
"https://dev.entrouvert.org/projects/python-rfc3161
">the
353 rfc3161 library
</a
> 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 <a href=
"https://github.com/trbs/rfc3161ng/
">the rfc3161ng library
</a
>,
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 <a href=
"https://tracker.debian.org/pkg/python-rfc3161ng
">available in
361 Debian
</a
>, and a few days ago it entered Debian unstable and testing.
</p
>
363 <p
>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:
</p
>
374 Python
3 script demonstrating how to use the rfc3161ng module to
375 get trusted timestamps.
377 The license of this code is the same as the license of the rfc3161ng
383 import pyasn1.codec.der
387 import urllib.request
394 def fetch(url, f=None):
395 response = urllib.request.urlopen(url)
396 data = response.read()
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:
407 # First fetch certificates used by service
408 certificate_data = fetch(
'https://freetsa.org/files/tsa.crt
', cert_f)
409 ca_data_data = fetch(
'https://freetsa.org/files/cacert.pem
', ca_f)
411 # Then timestamp the message
413 rfc3161ng.RemoteTimestamper(
'http://freetsa.org/tsr
',
414 certificate=certificate_data)
415 data = b
"Python forever!\n
"
416 tsr = timestamper(data=data, return_tsr=True)
418 # Finally, convert message and response to something
'openssl ts
' can verify
420 store(tsr_f, pyasn1.codec.der.encoder.encode(tsr))
421 args = [
"openssl
",
"ts
",
"-verify
",
422 "-data
", msg_f.name,
423 "-in
", tsr_f.name,
424 "-CAfile
", ca_f.name,
425 "-untrusted
", cert_f.name]
426 subprocess.check_call(args)
428 if
'__main__
' == __name__:
432 <p
>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
'openssl ts
' to verify the timestamp. A timestamp is
435 around
1.5 kiB in size, and should be fairly easy to store for future
438 <p
>As usual, if you use Bitcoin and want to show your support of my
439 activities, please send Bitcoin donations to my address
440 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
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><p
>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 <a href=
"http://www.webupd8.org/
">the Ubuntu UPD8 PPA
</a
> 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.
</p
>
458 <p
>I first created
<tt
>~/googledrive
</tt
>, entered the directory and
459 ran
'<tt
>grive -a
</tt
>' to authenticate the machine/user. Next, I
460 created a autostart hook in
<tt
>~/.config/autostart/grive.desktop
</tt
>
461 to start the sync when the user log in:
</p
>
463 <p
><blockquote
><pre
>
465 Name=Google drive autosync
467 Exec=/home/user/bin/grive-sync
468 </pre
></blockquote
></p
>
470 <p
>Finally, I wrote the
<tt
>~/bin/grive-sync
</tt
> script to sync
471 ~/googledrive/ with the files in Google Drive.
</p
>
473 <p
><blockquote
><pre
>
478 if [
"$syncpid
" ] ; then
482 trap cleanup EXIT INT QUIT
483 /usr/lib/grive/grive-sync.sh listen googledrive
2>&1 | sed
"s%^%$
0:%
" &
486 if ! xhost
>/dev/null
2>&1 ; then
487 echo
"no DISPLAY, exiting as the user probably logged out
"
490 if [ ! -e /run/user/
1000/grive-sync.sh_googledrive ] ; then
491 /usr/lib/grive/grive-sync.sh sync googledrive
494 done
2>&1 | sed
"s%^%$
0:%
"
495 </pre
></blockquote
></p
>
497 <p
>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.
</p
>
501 <p
>As usual, if you use Bitcoin and want to show your support of my
502 activities, please send Bitcoin donations to my address
503 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
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><p
>It would come as no surprise to anyone that I am interested in
513 bitcoins and virtual currencies. I
'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.
</p
>
520 <p
>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
524 <a href=
"http://github.com/petterreinholdtsen/valutakrambod
">github
</a
>.
</p
>
526 </p
>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:
</p
>
531 <p
><blockquote
><pre
>
533 import tornado.ioloop
535 class SimpleClient(object):
540 def newdata(self, service, pair, changed):
541 print(
"%-
15s %s-%s: %
8.3f %
8.3f
" % (
542 service.servicename(),
545 service.rates[pair][
'ask
'],
546 service.rates[pair][
'bid
'])
548 async def refresh(self, service):
549 await service.fetchRates(service.wantedpairs)
551 self.ioloop = tornado.ioloop.IOLoop.current()
552 self.services = valutakrambod.service.knownServices()
553 for e in self.services:
555 service.subscribe(self.newdata)
556 stream = service.websocket()
558 self.streams.append(stream)
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:
569 except KeyboardInterrupt:
570 print(
"Interrupted by keyboard, closing all connections.
")
572 for stream in self.streams:
574 </pre
></blockquote
></p
>
576 <p
>The library client loops over all known
"public
" 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:
</p
>
583 <p
><blockquote
><pre
>
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 </pre
></blockquote
></p
>
600 <p
>The exchange order book is tracked in addition to the best buy/sell
601 price, for those that need to know the details.
</p
>
603 <p
>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
'-c
' argument. Without the argument the
"curses
" output
607 is printed without using curses, which is useful for debugging. The
608 curses view look like this:
</p
>
610 <p
><blockquote
><pre
>
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 </pre
></blockquote
></p
>
644 <p
>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.
</p
>
652 <p
>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
've
654 implemented a trading API. It might be the topic of a future blog
657 <p
>As usual, if you use Bitcoin and want to show your support of my
658 activities, please send Bitcoin donations to my address
659 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
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><p
>Back in February, I got curious to see
669 <a href=
"http://people.skolelinux.org/pere/blog/Using_VLC_to_stream_bittorrent_sources.html
">if
670 VLC now supported Bittorrent streaming
</a
>. 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 <a href=
"https://github.com/johang/vlc-bittorrent
">a standalone plugin
674 for VLC
</a
> 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 <a href=
"https://tracker.debian.org/pkg/vlc-plugin-bittorrent
">entered
678 Debian
</a
> a few hours ago, and should be available in Debian/Unstable
679 tomorrow, and Debian/Testing in a few days.
</p
>
681 <p
>With the vlc-plugin-bittorrent package installed you should be able
682 to stream videos using a simple call to
</p
>
684 <p
><blockquote
><pre
>
685 vlc https://archive.org/download/TheGoat/TheGoat_archive.torrent
686 </pre
></blockquote
></p
>
688 </p
>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. :)
</p
>
696 <p
>I would love to get help maintaining this package. Get in touch if
697 you are interested.
</p
>
699 <p
>As usual, if you use Bitcoin and want to show your support of my
700 activities, please send Bitcoin donations to my address
701 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>