Recently, I had to deal with a set of data, some from experiments, and some obtained using MATLAB “Curve Fitting Tool”. As much as I like MATLAB figures, I usually find Excel features more desirable for good-looking plots! So, I needed to extract the data of Curve Fitting Tool. Here is what I did:

Save the figure as a “.fig” file.

Make a m-file with the following code to get the x, y data of the curve!

Then you have access to the data, and you can get the arrays as

Then, your data is ready to copy/export to Excel.

Disk quota exceeded

If the user reaches the quota limit, the filesystem that carries home directory of users on High Performance Computing (HPC) servers (called ZFS) does not let users delete files. So the following command would not work:

The reason is that the system needs to transiently write metadata to the system before performing the deletion process. The solution is the following commands:

The first line overwrite a null file on the file you would like to delete. The second line deletes that file. Now you should have enough quota to perform more deletions at your user directory.

Wordpress/Python integration

Why does it matter? Because we might need to write several posts with relatively similar content at the same time.

First of all, I need to install a Python library to interact with the WordPress blog. We can install it easily by the following code in command prompt. Open CMD.exe in your windows machine, and run:

This command will add python-wordpress-xmlrpc library to your installed Python. This library interacts using WordPress XML-RPC API. It is very easy to work with this library. I need to first import the required classes as:

Then I need to declare my WordPress blog login information:

Then, I can access to the posts by the following line:

Now, I want to write a new post and publish it in my WordPress blog:

In line 2, I can choose the title of the post. In line 3, I can choose the URL of the post. For example, I can choose “how-to-use-python-to-write-a-post-in-your-wordpress-website“. In line 4, I can write my post content. New lines, new tabs, and etc. can be used according to Python syntax. In line 6, you set the status of the post as “publish”ed!

and, the post is automatically uploaded in the WordPress blog.

More information on this Python library : python-wordpress-xmlrpc

Working with High Performance Computing (HPC) servers, I always need to submit sequential jobs or jobs with dependency. So, the job you submit stays on queue and waits for the running job to finish. I use the following command:

for example, if the running job id is 4321234, and you would like to submit myrun.qsub, the command will look like:

But sometimes you have tens of jobs you want to submit all at once. Here is a bash code you can use to submit a chain of jobs:

You can run the code above using the following command in Linux command line:

and one last point! You can set the condition in which the next job will run, simply by changing afterany in the commands above. These are the options: