Friday, June 16, 2017

Make selinux play nicely with certs

During certs upgrades, I noticed that my new cert was not getting accepted, i.e. my application was unable to read it even though owner and permission were set correctly.
The root cause of the problem was Selinux... it detected that I changed the cert and was preventing it from being read as malicious?

So I had to issue following command for it to accept it.

# restorecon -RvF /etc/pki/tls/private/jira.key
restorecon reset /etc/pki/tls/private/jira.key context unconfined_u:object_r:user_tmp_t:s0->system_u:object_r:cert_t:s0

Thursday, June 15, 2017

Ejecting harddrive should not be this hard...

Ever got annoyed with the message that your external harddrive can't be ejected since something is using it?

Well... I ran into it many many time... and now that I am on my fav mac I decided to find out what was going on vs just force ejecting it.

So... I ran

sudo lsof | grep /Volumes/Ultimate/

where Ultimate is my external harddrive name...

it showed me bunch of stuff to my surprise!

back up.... lsof is a command to show you a list of open files on the disk

# lsof

COMMAND  PID       USER   FD      TYPE     DEVICE  SIZE/OFF       NODE NAME
init       1       root  cwd       DIR        8,1      4096          2 /
Now... I saw bunch of Spotlight commands... so my mac decided to index my ext harddrive... To fix that I selected System Preferences -> Spotlight and added ext harddrive to Privacy pane.

Next I had bunch of BDLDaemon commands... so it appears that it was my BitDefender trying to protect me and scanning my ex harddrive... well... i chose to let it finish just to make sure i did not have any virus, etc on my drive...

The end





Tuesday, June 13, 2017

Pandas DataFrame pretty print

Recently while trying to output dataframe as a part of my logging process, I saw that dataframe, while being relatively small, was broken down over several lines... For ease of the log reading, I wanted to "pretty print" that dataframe.

I end up specifying max width option that allowed for desired output.

    pd.set_option('display.width', 1000)
    print meta_data
    pd.reset_option('display.width')

Monday, June 12, 2017

Troubleshooting your mac...

just a list of what I did before to troubleshoot and fix your mac issues

Restart and hold Shift key to enter Safe Mode

Restart + CMD + R to diagnose your harddrive, update OS, or reinstall OS... or use time machine to get to a prev working state.