[Kotobank::most] Blog feed

1 Useful tips and quirks

Here are my staff that I got during my work or/and playing with podliva.

1.1 Firefox

1.1.1 Removed ALSA support (>= 52.0)

Firefox removed ALSA support. Now I need to handle with apulse, or try to maintain own version with ALSA code. Portage's ~firefox-bin doesn't work with alsa, but firefox (from source) wit -pulseaudio USEFLAG works pretty well.

1.1.2 Sync tabs across devices

There tool out of the box for access to tabs: Simple put about:sync-tabs into the address box.

1.2 Python

Python itself is very poldivic and podlivable language

1.2.1 Importing python files without '.py' extension

import imp
module = imp.load_source("module", "path/to/module")

And that's it.

2 Poor man's all the things

Reinventing bipolar hexagonic wheel with woot intentions only.

2.1 Screenshot to clipboard.

You will need: scrot, xclip.

Insert in some bash script (for example 'scrot-clip') in $PATH and make it executable.

scrot -s -e 'xclip -selection clipboard -t image/png < $f && rm $f'
# then call it and click to window or select rectangle:
$ scrot-clip

2.2 Automatical reverse SSH tunnel? Easy.

You will need: openssh, screen, cron.

Insert into cron with desired timeout something like this:

ps auxf | grep %host%.ssh | grep -v grep || screen -S %host%.ssh -d -m ssh -N %user%@%host% -R 9999:localhost:22 1>/dev/null

This will keep SSH tunnel under the GNU/Screen with provided session name to be grepable among other ssh sessions.

2.3 Automatical background switching

You will need: feh image viewer, cron service.

Again our dear crond hurries to serve to our needs. Put following command to user crontab (crontab -e) with some timeout (15 min is */15 * * * *):

DISPLAY=:0.0 feh --bg-fill "$(find /path/to/wallpapers/|shuf -n1)"

2.4 Game engine (?)

2.4.1 Examples instead of Specification YEAAH

  1. Simple window with widgets

    I want it look like this

    import %enginename% as engine
    
    window = engine.window.Window()  # Chosing backend and properties automatically
    label = engine.text.Label(
        "This is label", pos=engine.Vec(window.width // 2, window.height // 2))
    
    @window.event
    on_draw():
        window.clear()
        window.draw()
    
    engine.ioloop.start()