linux

Socket read() hangs for a while when there is no data to read.

Hi' I'm writing a simple http port forwarder. I read data from port 80, and pass the data to my lighttpd server, on port 8080. As long as I write() data on the socket on port 8080 (forwarding the request) there's no problem, but when I read() data from that socket (forwarding the response), the last read() hangs a lot (about 1 or 2 seco...

What language choice is good for a c# developer wishing to develop on the Linux platform?

Are there any good OOP languages that you can use on Linux? Obviously Java comes to mind, even running C# under mono. Looking for a language that can be used for all round development, web dev, desktop, services etc. Besides Mono C# and Java anything else come to mind? ...

Postfix/SMTPD: how to check/view the contents of rejected emails

Our mail server is receiving a regular email addressed to a non-existing recipient at our domain, so it is being rejected. Is there a way to see the contents of the email? ...

Interactive GUI-like command line merging tool (like BeyondCompare or WinMerge) for Linux

May be something that uses reverse-video to show the differences. ...

Component based web project directory layout with git and symlinks

I am planning my directory structure for a linux/apache/php web project like this: Only www.example.com/webroot/ will be exposed in apache www.example.com/ webroot/ index.php comp1/ comp2/ component/ comp1/ comp1.class.php comp1.js comp2/ comp2.class.php comp2.css lib/ lib1/ l...

Linux shell sum columns

How can I sum (using Linux shell) numbers in a column? If possible, I don't want to use powerful tools like awk or perl. I want something like giveMeNumber | sum ...

Automated ETL / Database Migration Solution

I'm looking for an ETL solution that we can create a configure by hand and then deploy to run autonomously. This is basic transformation, it need not be feature heavy. Key points would be free or open source'ed software that could be tailored more to suit specific needs. In fact, this could be reduced to a simple DB migration tool that ...

linux kernel module permissions

Hi All, I wrote a kernel module and a user that opens it with O_RDWR mode, in the module_permission's func i get int op parameter , and would like to know if its value is the same as O_RDWR or maybe the system call open changes it to another known value , and if so where can i find it.. thanks a lot.. ...

Make Tar + gzip ignore directory paths

Anybody know if it is possible that when making a tar + gzip through 'tar c ...' command if the relative paths will be ignored upon expanding. e.g. tar cvf test.tgz foo ../../files/bar and then expanding the test.tgz with: tar xvf test.tgz gives a dir containing: foo files/bar i want the dir to contain the files foo bar is thi...

iteratively creating graphs

I have a bunch of files containing x and y coordinates, representing time and value (space-separated, but can be amended) For example, in each file I will have this sort of points: 15:06:59 0.0140 15:07:00 0.0142 ...etc.... I want to create a word file (or some equivalent) to show all these graphs. Currently, I am using Exc...

Using grep to find all emails

Hi, How to properly construct regular expression for "grep" linux program, to find all email in, say /etc directory ? Currently, my script is following: grep -srhw "[[:alnum:]]*@[[:alnum:]]*" /etc It working OK - a see some of the emails, but when i modify it, to catch the one-or-more charactes before- and after the "@" sign ... grep...

Grab a random number of bytes from a file with bash?

I have a file of 256MB. I'd like to retrieve a random amount of data from this file and copy it to another file. Is there a way to do this in bash or some other way? G-Man Edit: choose a random number between 1 and 256 then copy that number of mb from one file to another. ...

Clone-equivalent of fork?

I'd like to use the namespacing features of the clone function. Reading the manpage, it seems like clone has lots of intricate details I need to worry about. Is there an equivalent clone invocation to good ol' fork()? I'm already familiar with fork, and believe that if I have a starting point in clone, I can add flags and options from ...

UNIX Parse HTML Page Display Contents of a Tag - One Liner?

I have an HTML file and I am interested in the data enclosed by <pre> </pre> tags. Is there a one-liner that can do achieve this? Sample file : <html> <title> Hello There! </title> <body> <pre> John Working Kathy Working Mary Working Kim N/A </pre> </body> </html> Output should be : John Kathy Mary Kim Much appreciat...

compare time using date command

Say I want a certain block of bash script execute only if it is between 8 am (8:00) and 5 pm (17:00), and do nothing otherwise. The script is running continuously So far I am using date command. How to use it compare it current time within the range? Thanks ...

Passwordless SSH using cgi-perl script

Hello, This is my first shot at trying out cgi-perl scripts. I have SSH keys set up between my (root user) local machine and a remote machine. I'm trying to run a command on the remote box and display the output on a webpage hosted from my local machine. The script runs fine from command line however, it throws SSH key error when called...

How to keep asm output from Linux kernel module build

I'm working on a Linux kernel module for a 2.6.x kernel and I need to view the assembly output, though it's currently being done as a temporary file an deleted afterwords. I'd like to have the assembly output mixed with my C source file so I can easily trace where my problem lies. This is for an ARMv6 core and apparently objdump doesn'...

Creating a "virtual" path (/bla) in Mac OS X and Linux that calls custom code

Just something I'd like to play with, I would like to create a "virtual" file/directory in the File System of Linux or Mac OS X (Not sure if I can share the same code - does POSIX help?), for example /foo and then perform custom code when something is read or written to it. Similar how /dev/null allows for stuff like echo "Hello!" > /d...

Winlibre - An Aptitude-Synaptic for Windows. Would that be useful?

Hi everyone. Last year, in 2009 GSoC, I participated with an organization called Winlibre. The basic idea is having a project similar to Aptitude (or Apt-get) and a GUI like Synaptic but for Windows and just to hold (initially), only open source software. The project was just ok, we finished what we considered was a good starting point ...

Extract Lines when Column K is empty with AWK/Perl

I have data that looks like this: foo 78 xxx bar yyy qux 99 zzz xuq xyz They are tab delimited. How can I extract lines where column 2 is empty, yielding bar yyy xuq xyz I tried this but doesn't seem to work: awk '$2==""' myfile.txt ...