Skip to content

Tag: linux

ALSA: Ways to prevent underrun for speaker

I am playing a single channel audio in non-interleaved mode. I am getting underrun when I am writing audio data into speaker : ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred Here is how I write: What are the different ways/parameter configurations to prevent ALSA under run ? (I am using Linux 3.0, AR…

Hide output from expect

Here’s part of an expect script It read password from kwalletcli, and store in variable passwd. So I can connect to the servers with this passwd. However, the output of kwalletcli is pass through expect and show on console. How can I hide that. Answer Try adding to your script. That should turn off the …

How to remove setgid (linux/unix)?

I just changed my file permissions using $ sudo chmod g+s filename and my file permissions turned from drwxr-xr-x to drwxr-sr-x. How do I remove it? Answer Change the + for adding a permission into a – to remove it: If you want to do this programatically, you’ll need to use some bitwise operators. Norma…

Delete a Linux signal handler in C

I use: To add handler of SIGINT event. But how can i delete this handler? Answer Here is what you do: That resets the signal handler back to whatever the default behavior was for that signal (including the default disposition if it hasn’t been set). In the case of SIGINT, it’s aborting your proces…

Substitute a regex pattern using awk

I am trying to write a regex expression to replace one or more ‘+’ symbols present in a file with a space. I tried the following: Expected: Any ideas why this did not work? Answer Use gsub which does global substitution: sub function replaces only 1st match, to replace all matches use gsub.