I tried to measure execution time and format it with this command: But such command works: I tried to determine where another time is located, but all showes to /usr/bin/time or or How to define where another time is located? Answer Users of the bash shell need to use an explicit path in order to run the exte…
Grep out tags from git repo
Trying to sed out the different tags from my repo with shell: Returns, How can I grep out only the different tags as v1, v2, v3, v4: Answer What about good old grep and uniq :
Kill python thread using os
I’ve already asked similar question many times, but still can’t find appropriate solution. I have and external function, that could run in some cases very long. I want to interrupt it after, say, 30 seconds. How do I do that? Threads are good, but I can’t stope them (i don’t have acces…
Get storage device block size from name/descriptor of a file on that device
Suppose that I have file name or an open file decriptor for a text file that resides on a storage device (hard disk, usb flash, dvd, etc.). How can I get block size of that device from file name/descriptor in Linux programmatically in C. I know about ioctl system call, but it accepts an open descriptor for de…
segfault when using shout-python inside a thread
Recently a machine was upgraded/reinstalled from an older Ubuntu version to the most recent Debian version. Since then, I get a segfault in an application I wrote which sends data to an icecast daemon. After some searching, I focused it down to threading. As soon as I call shout.send from inside a thread, I g…
Is there a way to ‘store’ Sudo temporarily
I’m quite new to Linux. I remember using a tutorial were you were able to declare your sudo (+password) at the start and then use terminal without having to do sudo or import your password again. I.e. Sudo yum-get update -> yum-get update. Sorry if this is a very obvious question, I honestly don̵…
Using awk to trim away parts of a text file outside 2 patterns
I’d like an elegant awk solution to edit the lines in a file. So far I’ve only managed to complete the task using 2 sed commands and 1 awk command. Each file is composed of a header of indeterminate length, followed by the data I want to capture, then a footer which always starts with the same str…
python: numpy runs script twice
when I import numpy to my python script, the script is executed twice. Can someone tell me how I can stop this, since everything in my script takes twice as long? Here’s an example: And the output is: So, is my script first executed with normal python and then with numpy again? Maybe I should say that I…
How to send BACKSPACE in expect?
I’m trying to automatize some tool, and I have Problem is that by default in prompt is added last product number , for example When I run my expect script in prom is added So how I can tell in except that send BACKSPACE (delete) default product number add set only new one in prompt for example , somethi…
How can I create a patch to delete a folder and create new folder using diff?
For example I have two directories say old and new. The directory old has a sub-directory abc and the directory new has a sub-directory cde. I tried creating patch by using I got following output in file.patch: and when I tried to patch the file I got following error: When I try to create patch by using: I ge…