I’m going through a book focusing on x86 programming (Professional Assembly Language, WROX 2005). I had some problems last night and I was hoping to sort this out before returning home today so I can get a running-start and continue the text. My machine runs x64 Ubuntu (11.04 if I’m not mistaken) so the text focusing on 32bit x86 is
Why doesn’t “sort file1 > file1” work?
When I am trying to sort a file and save the sorted output in itself, like this the contents of the file1 is getting erased altogether, whereas when i am trying to do the same with ‘tee’ command like this it works fine [ed: “works fine” only for small files with lucky timing, will cause lost data on large ones
vimrc import file
I have a repository of my home config files – http://hg.jackleo.info/home-configs I noticed that my vim configuration is getting bigger and bigger (90% of commits is only related to vim) so I want to trow it to separate repository. The problem is that since i’m using home-config repository at my actual home folder vimrc file is also in same place.
Why data and stack segments are executable?
I have just noticed that my simple program has its data and stack segments executable. I saw it in /proc/[pid]/maps, and simple code confirmed it. For example: then causes prog to execute int3 instruction. Programs written in C and built with gcc have their data, stack and heap non-executable, so why those written in assembly behave in a different manner?
Difference between bash pid and $$
I’m a bash scripting beginner, and I have a “homework” to do. I figured most of the stuff out but there is a part which says that I have to echo the pid of the parent bash and the pid of the two subshells that I will be running. So I looked online and found this (The Linux documentation project):
Implementing clipboard functionality on X (*nix) without access to event loop?
Is it possible to implement copy-paste of text if you have a window but no access to the event loop, and can only make function calls to X. I’ve implemented clipboard on Windows and OSX with nothing but API function calls. Is the same possible on *nix with X? I was told you absolutely need access to the X event
Waiting on multiple semaphores without busy-waiting (C/C++ Linux)
If I have more than one semaphore, how can I have a process block until at least one of the semaphores is free? I know I can do this with a busy-wait loop such as: But is there a way to do this without a busy-loop? Perhaps there’s some IPC technique other than semaphores that I should be using? Thanks
pass stdout as file name for command line util?
I’m working with a command line utility that requires passing the name of a file to write output to, e.g. The only thing it writes to stdout is a message that indicates that it ran successfully. I’d like to be able to pipe everything that is written to output.txt to another command line utility. My motivation is that output.txt will
Print contents of a PDF to the command line
I’m looking for a command-line program that will print out the text of a PDF file, just like cat for a text file. I’ve found pdftotxt, and that would be workable, but I’d prefer something that replicates the cat functionality because I want to pipe to grep. Thanks! Answer On the man pages for pdftotext, I found this: pdftotext [options]
Determine Device of Filesystem in Python
How do you use Python to determine which Linux device/partition contains a given filesystem? e.g. Answer It is not the purdiest, but this will get you started: On OS X: On Ubuntu: To get the device name, chop off the minor number from the partition name. On OS X, also chop the ‘s’ + minor number.