due to bad internet bandwidth in my country, the client wishes for me to install my PHP/MySQL application on his Windows server or a Linux server. What is the best way to protect the source code? Or the folder where the PHP source code resides. The client should be able to use the rest of the server freely. T…
Tag: linux
How to cat <> a file containing code?
I want to print code into a file using cat <<EOF >>: but when I check the file output, I get this: I tried putting single quotes but the output also carries the single quotes with it. How can I avoid this issue? Answer You only need a minimal change; single-quote the here-document delimiter after …
While loop not equal command not found
I am trying to perform a simple while loop comparing a variable to a string. It fails to load with the error on this line. Error states [: missing `]’ and : command not found. My while loop looks like; Answer There are a couple of errors: See that variable declaration do need to be like var=value. Other…
Check if a directory exists and is accessible
I want to check if a directory exists and it has access rights; if it does, then perform the tasks. This is the code I wrote, which might not have proper syntax. Can you help me to correct it? I believe this can also be written like this. How can we write this more efficiently? Answer The best way to
Alternative to writing many files. MongoDB?
I have a Perl script that produces ~10000 files in the 1kB – 10kB size area, which is not optimal for performance, so I though about using MongoDB instead of writing the many files. I need to run the script on my laptops Linux and OSX. Question Would MongoDB be overkill? Or are there something more suit…
scp a folder to a remote system keeping the directory layout
I have a large directory tree with hundreds of nested sub-folders. I need to copy only 4 folders and their contents to a remote system, but I need to destination folder structure to be kept the same. E.G. I want to copy ./test/sub1/subsub1/* to a target such as user@system:~/test/sub1/subsub1/* but I do not w…
How to remove commas in the middle of a specific line in a file in linux/unix
Someone was trying to be helpful in their test description. However, they added commas to the description so that when the test description is outputted to the log file, the results have extra commas. This makes it difficult to parse the results since the number of commas vary in the results file. I want to u…
Listening for global key-combinations in python on Linux
I just wrote a little program which downloads a new wallpaper from flickr every few minutes. Now I want to add the capability to “like” a wallpaper, so it will occur more often than non-liked or disliked wallpapers. I’d like to assign a global keyboard-shortcut to this function. For example:…
How to compile *only* uuid from linux utils
I have the linux utils code (can be found here: https://www.kernel.org/pub/linux/utils/util-linux/) and I only need libuuid, nothing else. I’ve tried setting many ‘–disable-‘ flags but it still seems to be compiling things I don’t need. Here’s my actual configure command: a…
Why this file do not get downloaded into a specified location?
I am downloading the file in this link. I am using Ubuntu 12.04 and I used the below command to download it. Below is my command line input and output. It says the download is completed but I can’t find the file in that folder. I am accessing this server remotely using PuTTY, and using WinSCP to see the…