How to package and distribute standalone python project on Windows

UPDATE: thanks to lots of contributed hooks, I would choose pyinstaller these days. I recently had a need to distribute an app written in python as standalone on windows machines. Usual way to do it is to use py2exe(or similar) to generate standalone exe from your python script and then use Inno Setup or NSIS to write an installer for it. As it turned out, py2exe, nuitka and pyinstall were unable to track all dependencies of the project automatically (i....

May 5, 2017 · 3 min · 460 words · Ruslan Kuprieiev

CRIU as a debug tool and replacement for google coredumper

I’m currently working on a CRIU images -> core dump conversion for CRIT(CRiu Image Tool) and while looking for some info on manually generating core dump, I’ve found an interesting yet outdated (OMG last changed in 2007!) project called google coredumper that allows generating core dumps whenever you want to, which looks like a cool tool to have for debugging. CRIU is able to dump processes at any point too, but it is also providing a lot more info about the process’ state, because it can literally fully restore it from images, so I thought that coredump users (if there are any left) could use CRIU for their purposes....

April 7, 2015 · 1 min · 181 words · Ruslan Kuprieiev

python google protobuf and optional field with empty repeated inside (or the 'has_field = true' analog in python)

So I was searching for something to represent protobufs in a human-readable format. After lots of googling I’ve found that there is a magic built-in module called text_format, which does just what I need - it converts protobufs to/from human readable format, which looks quite similar to JSON. But it is not actually a valid JSON, as JSON-supported types don’t match protobufs, and it has a slightly different format. Pb text is fine for reading, but it has a very limited amount of tools that actually support it....

January 14, 2015 · 2 min · 404 words · Ruslan Kuprieiev

An elegant way to control a bunch of ssh connections

Lets say you want to establish ssh tunnel and put it into background: ssh -fNL 12345:localhost:54321 user@remote When you are done using tunnel you could use: pkill -f "ssh -fNL 12345:localhost:54321 user@remote" but it just doesn’t look right :) Things get a lot more messy when you need to have a bunch of ssh sessions. Lets say you have some client program and server program, and you want to use ssh to tunnel a connection from host1 to host2....

November 28, 2014 · 3 min · 535 words · Ruslan Kuprieiev

How to set PID using ns_last_pid

So there is this cool project called CRIU (Checkpoint/Restore In Userspace). And I was wondering how it gets certain PID when restoring a process. I always thought that it is not possible to set PID without some kind of kernel hacking. I did some investigation and here is what I figured out. There is a file /proc/sys/kernel/ns_last_pid, which contains the last PID that was assigned by the kernel. So, when the kernel needs to assign a new one, it looks into ns_last_pid, gets last_pid, and assigns last_pid + 1....

June 14, 2014 · 2 min · 338 words · Ruslan Kuprieiev