list graphical processes from terminal@j0h Well... try to define what it means to "have a GUI". In the end it means that the process is sending some commands to the GUI server of the OS to display some windows. X is the display server for linux systems, hence all processes with a GUI somehow "use" X. There's really no real difference between GUI and non-GUI process from the point of view of the kernel, and as such there isn't a simple system call to determine whether a process has or not a GUI.

Feb3

comment

Write Python stdout to file immediately@Paul Before introducing new content in an answer you should look the other answers, to avoid these kind of situations. Only edits about formatting/adding references and such don't need the context from other answers. (Btw: Python<3.3 is my definition of ancient version of python.)

Write Python stdout to file immediately@dotancohen Actually the part about print(flush=True) was added to that answer after mine by a third party author. I find it bad taste to rip contents from my answer to put them in an other without credit. I decided to add my answer solely because no answers provided any mention of the simplest way of achieving what the OP wanted in newer versions of python, and I added the "old way" just for completeness. The next time please check the revision history before commenting and or downvoting.

Feb2

comment

Generating a random password; why isn't this portable?What you say is utterly wrong. Forcing users to use only ascii letters, digits and underscore reduces the alphabet size considerably, making much easier to break passwords for attackers. An authentication system that cannot even handle ? or ^ is just too bad to be taken seriously.

Is w command safe for users?If you don't want to let bash save those commands in the history just begin the command with a space: $echo 'a' a $ echo 'b' b $!echo echo 'a' a (note that echo 'b' was not recorded in the history).

Jul5

comment

Who is responsible for the Linux kernel?@trysis I am Italian. Simpatico is a false friend with sympathetic. It means likable/pleasing/enjoyable/funny. The translation for symmpathetic would be comprensivo. In that sentence it would be probably better to say "everything is compatible with everything else", but simpatico does not carry such a meaning.

Jul4

comment

Who is responsible for the Linux kernel?"everything is simpatico with everything else" is this an American way of saying? The word simpatico there doesn't really fit. Did you mean "everything goes along/fits well/matches with everything else", or something like that?

Jun26

comment

Removing lines that are common to the outputs produced by two commandsNo, it isn't related. The decorate-sort-undecorate pattern is used when you want to sort a sequence using a different type of comparison then the one defined by the type of the elements. You create a sequence of pairs with the new "key" as first element and sort that instead, dropping the key afterwards. In this case you aren't doing anything like that. (btw: that pattern is "obsolete", in the sense that you don't have to do that explicitly anymore).

Threads vs (Forked) Processes"handling multi-thread scheduling is tricky and was frequently done incorrectly" citation needed. Implementing user-space threads isn't a problem. The problem with user-space threads is that if a thread does a blocking syscall all the threads gets blocked. The only way to avoid this is by using system level threads.

Feb21

comment

python vs bc in evaluating 6^6^6Side note: in python the 6**6**6 expression is actually computed at compile time. However since you are launching the file directly instead of importing it from a module, this shouldn't matter. To see the difference put 10**12345678 into an a.py file and try to import it from the interactive interpreter. Then close the interpreter, restart it and import a again. The first time it should take an noticeable amount of time (because python is compiling the module), while the second time it loads the .pyc, which should be instantaneous,