Asko's Maze
  • About
  • Links
  • Posts
  • Ruby

Posts

Posts

Jq and Human Readable Bytes

I wrote a short jq module for converting bytes to more human readable form.

Ruby by Examples

Ruby: Or, how to get the anonymous module from Kernel#load with wrap=true?

With the same technique than in my earlier article it is also possible to capture the anonymous wrapper module that Kernel#load method with wrap=true uses to build the sandbox. This way you can load configuration or other data without polluting your namespace.

Posts

dvb5-zap Extra PIDs Patch

dvb5-zap only supports filtering one channel at the time. Also it doesn’t support subtitles. Thus I made a patch for dvb5-zap to add a new command line option -O to define extra PIDs to capture from DVB MPEG2 Transport Stream.
Posts

Mtftar Large File Support Patch

I wrote a patch to add large file support (larger than 8 GB) to mtftar.
Ruby by Examples

Ruby: How to implement statfs syscall for Ruby 1.8 (pre Fiddle)

Here is statfs implementation for older Ruby releases that don’t have Fiddle:

Ruby by Examples

Ruby: How to implement statfs syscall with Ruby Fiddle FFI

Ruby will retire its broken Kernel#syscall method in the future. In the current Ruby releases you cannot provide NUL octets to syscalls which breaks almost all syscalls using a struct to provide parameters to it (Ruby bug 1472). Luckily starting Ruby 1.9.2 there is Fiddle standard library that can be used to call foreign functions like C-library’s functions, including the wrappers for syscalls. Unfortunate part is that Fiddle is still (2.
Ruby by Examples

Ruby: How to return value from loaded file?

Have you ever wanted to get return value from file which is read with Kernel#load without resorting to global variables or constants. It is actually quite simple when you realize that you can use non-local exit (continuations) to do that.

Posts

libvdpau-va-gl MPEG2 video decoding patch

I noticed that the current version of libvdpau-va-gl doesn’t support MPEG2 video decoding. When I looked behind the curtains I noticed that it supports only H.264 video decoding. I decided to have some fun and I wrote a MPEG2 video decoding patch for it, using the current H.264 code as a base. No warranty :)
© Asko Tontti 2022