## Compressing papers with ghostscript

5 May 2017 in research

When searching for ways to compress the size of a ~50MB paper pdf, I’ve discovered the following ghostscript command (askUbuntu, TeX StackExchange)

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed.pdf original.pdf


Argument of -dPDFSETTINGS can be any of:

-dPDFSETTINGS=/screen   # lower quality, smaller size.
-dPDFSETTINGS=/ebook    # for better quality, but slightly larger pdfs.
-dPDFSETTINGS=/prepress # output similar to Acrobat Distiller "Prepress Optimized" setting
-dPDFSETTINGS=/printer  # selects output similar to the Acrobat Distiller "Print Optimized" setting
-dPDFSETTINGS=/default


I wrote a small script to test the different -dPDFSETTINGS modes.

## Gif screencast with byzanz

3 March 2017 in cmd

Here’s a simple example for gif screencasting with byzanz. See the thread How to create animated GIF images of a screencast? on askubuntu.com.

byzanz-record --duration=12 --x=725 --y=365 --width=487 --height=375 out.gif


Animation of Chaikin curve subdivision scheme captured with byzanz.

On Fedora, byzanz can be installed from the official repo.

sudo dnf install byzanz


## 3d fabricated lilium

15 February 2017 in research

We got this giant plastic lilium for the tests of our sensor surface reconstruction. Looking forward to the experiments!

(The small device in the middle is the Morphorider.)

## Array multiplicities via sparse

6 February 2017 in matlab

Multiplicities of array elements can be efficiently computed using sparse. I’ve found this elegant solution in an old Newsgroup thread.

% generate some data
A = randi(10,1,100);
% construct the sparse matrix
S = sparse(A,1,1);
% get unique elements and multiplicities
[uA,~,mult] = find(S);

mult =
(1,1)        8
(2,1)       15
(3,1)       11
(4,1)        5
(5,1)       10
(6,1)        6
(7,1)       10
(8,1)       13
(9,1)       13
(10,1)        9


This method is faster than other solutions – almost twice as fast as histc.

% test array: 2000 random integers from the set 1:1000
% 1000 iterations
Elapsed time is 0.228704 seconds. % histc
Elapsed time is 1.838388 seconds. % bsxfun
Elapsed time is 0.128791 seconds. % sparse


## Nvidia Optimus

19 October 2016 in fedora

Bumblebee on fedoraproject.com

Fedora 24 version, closed source solution from managed NVidia repo

dnf -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora24/noarch/bumblebee-release-1.2-1.noarch.rpm
dnf install bumblebee-nvidia bbswitch-dkms VirtualGL primus kernel-devel


And test

optirun glxgears


I wanted to test optirun with Matlab, so I ran

optirun /usr/local/MATLAB/R2016a/bin/matlab -desktop


which resulted in a bunch of errors

MATLAB is selecting SOFTWARE OPENGL rendering.
version CXXABI_1.3.8' not found (required by /usr/lib64/VirtualGL/librrfaker.so)


## Forgotten tabs

9 October 2016 in music

Once upon a time, I heard a song. This one:

Naturally, I had to tab it. And it remained the only tab I’ve ever published.

Then I kind of forgot about it.

Recently, I was searching for some stuff on UG (Ultimate Guitar, not University of Grenoble…) and wondered what happened to my tab. To my surprise, not only did it have some views, it was also rated as excellent! That felt good.

Strange thing, this tabbing. Are you actually creating something new when tabbing somebody else’s song? To put it another way, are you inventing or discovering?

Anyway, I’ll try to post more of tabs from now on. Of this song, for instance.

And I definitely need to practice more.

## Selecting extraordinary vertices in Blender

28 July 2016 in blender

Extraordinary vertices in a polygon mesh are the ones which are not regular – their degree is other than 6 in a triangle mesh and other than 4 in a quad mesh. Here’s how to select all extraordinary mesh vertices in Blender:

1. Select a regular vertex.
2. Select->Select Similar->Amount of connecting edges.
This will select all regular vertices.
3. Hit Ctrl+I to invert the selection.

## Bézier surfaces in Matlab

1 February 2016 in matlab

The following code is my attempt for a fast and compact Matlab implementation of Bézier surfaces using three-dimensional arrays. It runs in less than ones second for the teapot dataset with 32 cubic patches and 10 000 surface points per patch. The computation itself (4064 calls to the casteljau function) takes only ⅓ of a second.

20 January 2016

## Fixing Fujitsu UH572 touchpad on Fedora

12 October 2015 in fedora

…that’s a lot of F-words. Here’s the thing. Open the grub config file:

sudo su
vim /etc/default/grub


Find the line starting with GRUB_CMDLINE_LINUX. Add i8042.notimeout i8042.nomux to the parameters; save and close. Finally, update grub and reboot:

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
#          NOT -o /boot/grub2/grub.cfg
reboot


And now the touchpad works as it should!