Skip to content
Advertisement

C non-blocking keyboard input

I’m trying to write a program in C (on Linux) that loops until the user presses a key, but shouldn’t require a keypress to continue each loop. Is there a simple way to do this? I figure I could possibly do it with select() but that seems like a lot of work. Alternatively, is there a way to catch a

Forcing driver to device match

I have a piece of usb hardware, for which I know the driver. However, the vendor id and product id do not match the VID, PID pair registered in the driver. Is there a way in linux to force a driver to be associated with a known device, that do not involve kernel module recompilation to add a PID /

how can I diff two sections of the same file?

I have a source file with two similar yet subtly different sections. I’d like to merge the two sections into one subroutine with a parameter that handles the subtle differences, but I need to be sure I’m aware of them all so I don’t miss any. What I usually do in such cases is copy each of the sections to

Using Windows DLL from Linux

We need to interface to 3rd party app, but company behind the app doesn’t disclose message protocol and provides only Windows DLL to interface to. Our application is Linux-based so I cannot directly communicate with DLL. I couldn’t find any existing solution so I’m considering writing socket-based bridge between Linux and Windows, however I’m sure it is not such a

What is the safest way to empty a directory in *nix?

I’m scared that one day, I’m going to put a space or miss out something in the command I currently use: Is there a safer way of emptying the current directory’s contents? Answer The safest way is to sit on your hands before pressing Enter. That aside, you could create an alias like this one (for Bash) alias rm=”pwd;read;rm” That

How to do multiline search and replace with a script?

I’m trying to replace every multiline import inside a Python source file.. So, the source goes like and I’d like to get something like I tried to use sed but it looks like it doesn’t support non-greedy matching of the closing parenthesis, so it “eats” the second import.. 🙁 Any hint? Is this impossible with sed? Should I try with

Network usage top/htop on Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question

Advertisement