Reputation
285
Top tag
Next privilege 300 Rep.
Create new tags
Badges
2 15
Impact
~14k people reached

  • 0 posts edited
  • 0 helpful flags
  • 129 votes cast
May
21
comment How to get system time with microsecond Resolution
@Coderaemon Probably in the order of milliseconds (or more) since it has to launch a new process, read its output and compute something.
May
15
comment Uninstalling programs on Linux
@DmitryGrigoryev Using apt is simpler and provides a better tui than using apt-get.
Mar
17
comment Check if the residence's connection has internet access
Yes, although I still find your answer useful. Thanks!
Mar
11
comment 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.
Feb
3
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.)
Feb
3
comment Write Python stdout to file immediately
@Paul Please avoid copy pasting contents between answers, or at the bery least mention the original authors that provided the content.
Feb
3
comment 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.
Feb
2
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.
Jan
26
comment How can I kill a process and be sure the PID hasn't been reused
@StéphaneChazelas Yes, but you let it continue afterwards. I explicitly said: depending on the type of task that that process is performing you may have some trouble for stopping it some milliseconds. Thanks for the tip on lstart, I'll edit it in.
Jan
26
comment How can I kill a process and be sure the PID hasn't been reused
You can save the start time of the original process and, before killing, check that the start time of the process with that pid matches what you saved. The pair pid, start-time is a unique identifier for the processes in Linux.
Oct
6
comment 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).
Jul
5
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.
Jul
4
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?
Jun
26
comment Removing lines that are common to the outputs produced by two commands
No, 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).
Jun
19
comment Can I “drag” a file into a window without a file manager?
You don't need the second fix. Simply copy the Dragbox directory into the PYTHONPATH somewhere (like in the python2 site-packages, either system or per-user). That line is executed only when dragbox cannot import that package.
May
27
comment Quickest way to rename files, without retyping directory path
Why are you using sudo for moving a file between two directories in your home?
May
5
comment 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.
Feb
21
comment python vs bc in evaluating 6^6^6
Side 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,
Dec
3
comment Why is the root directory denoted by a / sign?
Because the empty string would have been a horrible choice!
Nov
6
comment Why does no one use the true Bourne shell as /bin/sh?
@strugee Those aren't the only differences. For example sh doesn't have tilde and brace expansion, some built-ins are missing(e.g. pushd and popd, select) no arithmetic expansion. A lot of variables are missing, e.g. PIPESTATUS.