I’m hoping someone can fact check my assumptions on the question “Can lstat and/or stat be called form the Linux kernel 3.10.0 in Centos 7. I’ve been searching and reading as much as I can find and have only been able to confuse myself. I can’t tell if the examples I am finding are ava…
Tag: linux
issue on import psutil inside python script
i’m not able to import psutil inside my scripts. But the library is installed on my machine. my library is inside this directory, on which there is also simplejson library: But if i create a script for example this: i get this errors: UPDATE launching pip install psutil i got this: Any ideas on how to r…
sed/awk – remove a multiline block if it contains multiple patterns
In an xml file a multiline block is identified by <start></start>. I need to find and delete these multiline blocks if they contain a set of pattern in any order (pattern1, pattern2, etc). For example, in the following: if searching for pattern1 only, blocks 1, 3, 4 should be deleted if searching …
How can I *only* get the number of bytes available on a disk in bash?
df does a great job for an overview. But what if I want to set a variable in a shell script to the number of bytes available on a disk? Example: But I just want to return 33333333 (bytes available on /), not the whole df output. Answer Portably: The -P option ensures that df will print output in the
Abuse cURL to communicate with Redis
I want to send a PING to Redis to check if the connection is working, now I could just install redis-cli, but I don’t want to and curl is already there. So how can I abuse curl to do that? Basically I need to turn off what’s send here: I was able to get rid of the User-Agent altogether by
C Just Delete Some Part Of File
I have two files. I want to copy source file to destionation file. If they are different, then I just want to copy different line not all file. In the below case, two line are same, but destination has extra line. How can I just delete last line of destination file? For example: Answer On POSIX systems, if yo…
Specify output names on multiple files with curl using ranges
I am trying to download a few hundred URL’s and specify the output name for each, the only difference is an ID in the URL, such as ..something/1/something.., ..something/3/something.., ..something/4/something.. etc. I can use -o filename.zip but it will overwrite for each of the range of files, I am cur…
Openbox. Open different firefox profiles in specific workspaces
I need something like this when I start my openbox session: But all solutions that I’ve found uses the Windows Name parameter, and that doesn’t work very well. (I’ve tried modifying my openbox’s rc.xml and using wmctrl and a couple other solution, but all in vain) Is there a direct sol…
auto-formating tool for django html template files
Is there a *nix tool (or vim plug-in) that would allow me to automatically format django html template files? Hitting the space bar hundreds of time does not sound like a good use of my time but then neither does leaving some weird formatting that is hard to read. Answer Install vim-jinja2-syntax plugin by pu…
How to use Arduino-Makefile with Sparkfun Pro Micro?
So, I am using Arduino-Makefile (https://github.com/sudar/Arduino-Makefile) and trying to program a 5V 16MHz Sparkfun Pro Micro (https://www.sparkfun.com/products/12640). I am using the versions of the Arduino libraries and Arduino-Makefile in the repository of the Linux distro I am using (Linux Mint 17.2). T…