The following, very non-robust shell code will give the mount point of $path:
(for i in $(df|cut -c 63-99); do case $path in $i*) echo $i;; esac; done) | tail -n 1
Is there a better way to do this?
Postscript
This script is really awful, but has the redeeming quality that it Works On My Systems. Note that several mount points may...
I need a program that I can pipe a raw PCM stream into, and will send wav files to stdout.
Since the input is a stream, I can't just add headers to it, but I can for every x seconds (For example, program reads ten seconds of the stream, and outputs a ten second long wav file, reads the next ten seconds, outputs a wav file, and so on).
...
Hello, all.
When my program gets to this line,:
pid_t nPid = forkpty( &m_nMasterFD, NULL, NULL, NULL );
it outputs this:
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 148 (RENDER)
Minor opcode: 17 (RenderCreateGlyphSet)
Resource id: 0x3600002
<unknown>: Fatal IO error 4 (Interrupted sys...
I've tried parsing a list of users currently connected via SSH to a server, but the results are very irregular, so I was forced to simply do:
$users = shell_exec('who');
echo "<pre>$users</pre>";
Is there a better way to parse the output of who in the command line before I let PHP mess around with it? I want it in an array which conta...
Hey guys,
I'm working on a netfilter module that modifies TCP ack behavior and I am having some trouble with crashes. I think my problem is that I don't fully understand the netfilter architecture (and maybe the kernel in general, I'm pretty new to this). I have two main questions:
1.) Using kmalloc with the GFP_KERNEL flag seems to ca...
Are there any well known reasons for sigprocmask() to segfault when used in a multithreaded application?
I have an application that creates multiple threads using clone(). I have determined that for some reason when I use sigprocmask it segfaults (not all the time though). From the backtrace() it also seems like the segfault is occuring...
I'm writing a simple program to run through a bunch of files in various directories on my system. It basically involves opening them up and checking for valid XML. One of the options of this program is to list bad xml files.
This leads me to my question. What the best output to format this for use with XARGS. I thought putting each ...
I'm confusing little in terminology.
A file that is given as input to the linker is called Object File.
The linker produces an Image file, which in turn is used as input by the loader.
I got this from "MS PE & COFF Specification"
Q1. Image file is also referred to as Binary Image, Binary File or just Binary. Right?
Q2. So, a...
Is there a standalone tool, that can be ran from a shell script, to generate a makefile from the .cproject? Actually, the same functionality as the CDT itself, but that can be non-interactive.
As is probably obvious, I want to be able to run a script that checkouts and builds the software, comprising from several C++ project. I am tryin...
Hi all,
It may sound a bit trivial but it actually is quite frustrating:
Can anyone explain me this:
[~:user$]expr 3 + 2
6
[~:user$]expr 3 / 2
1
[~:user$]expr 3 * 2
expr: syntax error
When the man page for expr precisely specifies that ARG1 * ARG2 is arithmetic product of both.
Thanks,
...
My tools are Linux, gcc and pthreads. When my program calls new/delete from several threads, and when there is contention for the heap, 'arena's are created (see the following link for reference http://www.bozemanpass.com/info/linux/malloc/Linux_Heap_Contention.html). My program runs 24x7, and arenas are still occasionally being created ...
I want to invoke curl (which invokes a REST service) for every matching row processed via awk.
Input file (delimited by colon). e.g.
$ cat /tmp/input
tiger:EN
haiti:FR
federer:CH
I got as far as this:
awk -F':' '{print $1 "=" $2}' /tmp/input
This just confirms that I can extract the columns out correctly.
Now I need to invoke th...
The program saves a settings file as text which contains floating point numbers of type long double. The settings file can only be saved via the GUI (GTK2), while files can also be loaded via the command line and without bringing up the GUI.
Unfortunately, a user reports that in the files he has saved, due to his locale setting, the num...
I am running a python script in background, but why does it still prints to console, even when piped to a file?
I tried the following command:
python script.py &
python script.py > output.txt &
I tried with a simple script:
print "hello world"
With
python script.py &
It still prints to console.
But
python script.py > output.t...
Want to archive a folder using tar from PHP:
$result = shell_exec("tar cf $sourceFile $sourceFolder -C $source > /dev/null; echo $?");
var_dump($result);
Output:
string(2) "2 "
the > /dev/null; echo $? thing is for outputing the result code of a script under linux;
the -C $source - changes to the right folder before doing anythi...
I have a program, using pyserial, and I want to test it without using a real serial port device.
In windows, I use com0com, and in linux, I know there is a method to create virtual serial port pair without using additional program.
so I look up the manual, and found pts, /dev/ptmx, but I don't know how to create a pair by following the...
I am stuck in a strange predicament. I need to generate UUIDs in my Linux program (which I distribute using RPMs). I do not want to add another dependency to my application by requiring the user to install libuuid (seems like libuuid isn't included in most Linux distros, like CentOS).
Isn't there a standard Linux system call which gener...
Hi, i tried fopen in C, the second parameter is open mode. two modes "r" and "rb" tricks me a lot...it seems they r the same...sometimes it better to use "rb", so, why does "r" exist??
can expain it to me, more detailed or examples
thanx
...
Hi,
I want to create a thumbnail view of a file type similar to thumbnails displayed in gnome/kde.
Wondering if anyone knows which libraries gnome/kde uses to display thumbnail view of different file types in Linux.
...
HI,
I am getting the following linker error on linux:
My guess is it is missing '-lpthread' in the linker thread. My question is if there is a way for me to set my environment on linux such that it will add '-lpthread' when it links?
/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/libutils.a(Threads.o): in ...