Thursday, March 8, 2018

Delete orphan application menus in KDE

Just look at ~/.local/share/applications/

Wednesday, April 26, 2017

Monkey patch an instance method in Python3

import types

class SomeClass(object):
    def __init__(self, x):
        self.x = x
    def some_method(self, y):
        print("Original method", self.x + y)

# creates instance
instance = SomeClass(1)

# test instance's method
instance.some_method(1)

>>> Original method 2

# The method to patch
def new_method(self, y):
    print("New method", self.x * y)

# monkeypatch using types.MethodType()
instance.some_method = types.MethodType(new_method, instance)

# test patched method
instance.some_method(10)
>>> New method 10

Wednesday, February 22, 2017

Change theme for the embedded terminal in gedit

The embedded terminal in gedit fetchs its theme from gnome-terminal. So that program must be first installed, then when it is configurated with a given profile theme, the same settings are used by gedit.

Wednesday, January 18, 2017

Update flash plugin for Opera

Worked for Opera version 42.0.2393.137

Monday, December 12, 2016

Source .bashrc upon ssh connection

Trick source

Add this to you .bash_profile file:

# .profile
if [ -n "$BASH" ] && [ -r ~/.bashrc ]; then
    . ~/.bashrc
fi

Friday, June 10, 2016

Anaconda2 jupyter notebook fix to export to pdf

Under Linux Mint, the problem arises when issuing:
 $ ~/anaconda2/bin/jupyter nbconvert my_notebook.ipynb --to pdf
During the conversion, LaTeX fails with the error:
! LaTeX Error: File `ulem.sty' not found.
This is solved by installing the texlive-generic-recommended package:
 $ sudo apt-get install texlive-generic-recommended

Get mathjax equations rendered under wkhtmltopdf

Trick source

Try using --javascript-delay [ms]. [ms] is the time in milliseconds wkhtmltopdf waits for complex scripts to finish. --javascript-delay 25000 is a good value to get the job done